• Peter Marshall's avatar
    [cpu-profiler] Reduce the size of inlining information · a0572f0b
    Peter Marshall authored
    Previously we stored the source position table, which stored a mapping
    of pc offsets to line numbers, and the inline_locations, which stored a
    mapping of pc offsets to stacks of {CodeEntry, line_number} pairs. This
    was slightly wasteful because we had two different tables which were
    both keyed on the pc offset and contained some overlapping information.
    
    This CL combines the two tables in a way. The source position table now
    maps a pc offset to a pair of {line_number, inlining_id}. If the
    inlining_id is valid, then it can be used to look up the inlining stack
    which is stored in inline_locations, but is now keyed by inlining_id
    rather than pc offset. This also has the nice effect of de-duplicating
    inline stacks which we previously duplicated.
    
    The new structure is similar to how this data is stored by the compiler,
    except that we convert 'source positions' (char offset in a file) into
    line numbers as we go, because we only care about attributing ticks to
    a given line.
    
    Also remove the helper RecordInliningInfo() as this is only actually
    used to add inline stacks by one caller (where it is now inlined). The
    other callers would always bail out or are only called from
    test-cpu-profiler.
    
    Remove AddInlineStack and replace it with SetInlineStacks which adds all
    of the stacks at once. We need to do it this way because the source pos
    table is passed into the constructor of CodeEntry, so we need to create
    it before the CodeEntry, but the inline stacks are not (they are part of
    rare_data which is not always present), so we need to add them after
    construction. Given that we calculate both the source pos table and the
    inline stacks before construction, it's just easier to add them all at
    once.
    
    Also add a print() method to CodeEntry to make future debugging easier
    as I'm constantly rewriting this locally.
    
    Bug: v8:8575, v8:7719, v8:7203
    
    Change-Id: I39324d6ea13d116d5da5d0a0d243cae76a749c79
    Reviewed-on: https://chromium-review.googlesource.com/c/1392195
    Commit-Queue: Peter Marshall <petermarshall@chromium.org>
    Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#58554}
    a0572f0b
profile-generator.h 14.4 KB