• Peter Marshall's avatar
    [cpu-profiler] Add source positions for inlined function calls · af0428ac
    Peter Marshall authored
    Currently in both kCallerLineNumbers and kLeafNodeLineNumbers modes, we
    correctly capture inline stacks. In leaf number mode, this is simple as
    we simply add the path onto the existing tree. For caller line numbers
    mode this is more complex, because each path through various inlined
    function should be represented in the tree, even when there are
    multiple callsites to the same function inlined.
    
    Currently we don't correctly show line numbers for inlined functions.
    We do actually have this information though, which is generated by
    turbofan and stored in the source_position_table data structure on the
    code object.
    
    This also changes the behavior of the SourcePositionTable class. A
    problem we uncovered is that the PC that the sampler provides for every
    frame except the leaf is the return address of the calling frame. This
    address is *after* the call has already happened. It can be attributed
    to the next line of the function, rather than the calling line, which
    is wrong. We fix that here by using lower_bound in GetSourceLineNumber.
    
    The same problem happens in GetInlineStack - the PC of the caller is
    actually the instruction after the call. The information turbofan
    generates assumes that the instruction after the call is not part of
    the call (fair enough). To fix this we do the same thing as above - use
    lower_bound and then iterate back by one.
    
    TBR=alph@chromium.org
    
    Bug: v8:8575, v8:8606
    Change-Id: Idc4bd4bdc8fb70b70ecc1a77a1e3744a86f83483
    Reviewed-on: https://chromium-review.googlesource.com/c/1374290
    Commit-Queue: Peter Marshall <petermarshall@chromium.org>
    Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#58545}
    af0428ac
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...