• Benedikt Meurer's avatar
    [inspector] Capture stack trace only once for JSError objects. · 765ca6a0
    Benedikt Meurer authored
    When creating a new JSError object (or using the non-standard API
    `Error.captureStackTrace`) V8 would previously capture the "simple stack
    trace" (as FixedArray of CallSiteInfo instances) to be used for the non-
    standard `error.stack` property, and if the inspector was active also
    capture the "detailed stack trace" (as FixedArray of StackFrameInfo
    instances). This turns out to be quite a lot of overhead, both in terms
    of execution time as well as memory pressure, especially since the
    information needed for the inspector is a proper subset of the
    information needed by `error.stack`.
    
    So this CL addresses the above issue by capturing only the "simple stack
    trace" (in the common case) and computing the "detailed stack trace"
    from the "simple stack trace" when on demand. This is accomplished by
    introducing a new ErrorStackData container that is used to store the
    stack trace information on JSErrors when the inspector is active. When
    capturing stack trace for a JSError object while the inspector is
    active, we take the maximum of the program controlled stack trace limit
    and the inspector requested stack trace limit, and memorize the program
    controlled stack trace limit for later formatting (to ensure that the
    presence of the inspector is not observable by the program).
    
    On the `standalone.js` benchmark from crbug.com/1283162 (with the
    default max call stack size of 200) we reduce execution time by around
    16% compared to ToT. And compared to V8 9.9.4 (the version prior to the
    regression in crbug.com/1280831), we are 6% faster now.
    
    Doc: https://bit.ly/v8-cheaper-inspector-stack-traces
    Bug: chromium:1280831, chromium:1278650, chromium:1258599
    Bug: chromium:1280803, chromium:1280832, chromium:1280818
    Fixed: chromium:1283162
    Change-Id: I57dac73e0ecf7d50ea57c3eb4981067deb28133e
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3366660Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#78542}
    765ca6a0
Name
Last commit
Last update
.github Loading commit data...
bazel 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...
.bazelrc Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.mailmap Loading commit data...
.vpython Loading commit data...
.vpython3 Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.bazel Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
COMMON_OWNERS Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LOONG_OWNERS Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
RISCV_OWNERS Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
WORKSPACE Loading commit data...
codereview.settings Loading commit data...