• Benedikt Meurer's avatar
    [stack-traces] Implement fast-path for JSFunction::GetDebugName(). · 6daff990
    Benedikt Meurer authored
    For stack traces, especially all stack traces exposed via the Inspector
    (i.e. for the purpose of async stack traces), JSFunction::GetDebugName()
    is still a bottleneck, even after the removal of "displayName" support.
    As outlined in https://bit.ly/devtools-function-displayName-removal a
    follow-up optimization here would be to improve the performance of the
    "name" lookup. Previously, it'd always use the LookupIterator combined
    with JSReceiver::GetDataProperty(), which in the common case would find
    the "name" property and the return undefined, since it doesn't invoke
    getters on AccessorInfos, and eventually fall through to the actual
    logic in SharedFunctionInfo::DebugName().
    
    Now we had a similar situation with Function.prototype.bind(), which
    also needs to lookup "name" on regular function objects quite often, and
    what we implemented there is to just look into the DescriptorArray of
    the incoming function object and see if the entry for the "name"
    descriptor is still untouched (key is "name" and value is an
    AccessorInfo), and if so completely bypass the slow-path lookup via the
    LookupIterator.
    
    With this CL (and the optimization in https://crrev.com/c/2695386), the
    cost of symbolization is now significantly lower than the cost of the
    actual stack trace capturing, for the async stack traces in the example
    from https://crbug.com/1077657 as indicated by the perf profile below:
    
    ```
    - 26.03% v8_inspector::AsyncStackTrace::capture
       + 17.34% v8::StackTrace::CurrentStackTrace
       - 7.27% v8_inspector::(anonymous namespace)::toFramesVector
          - 7.18% v8_inspector::V8Debugger::symbolize
             - 6.27% v8_inspector::StackFrame::StackFrame
                + 2.52% v8_inspector::toProtocolString
                + 1.88% v8::internal::StackFrameInfo::GetLineNumber
               0.78% operator new[]
         0.55% operator new[]
    ```
    
    Bug: chromium:1077657, v8:8742, chromium:1069425, chromium:1177685
    Change-Id: I38f23816295f4381f5109cc78e4856dc0b67b097
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2695593
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72758}
    6daff990
Name
Last commit
Last update
..
api Loading commit data...
asmjs Loading commit data...
ast Loading commit data...
base Loading commit data...
baseline Loading commit data...
builtins Loading commit data...
codegen Loading commit data...
common Loading commit data...
compiler Loading commit data...
compiler-dispatcher Loading commit data...
d8 Loading commit data...
date Loading commit data...
debug Loading commit data...
deoptimizer Loading commit data...
diagnostics Loading commit data...
execution Loading commit data...
extensions Loading commit data...
flags Loading commit data...
handles Loading commit data...
heap Loading commit data...
ic Loading commit data...
init Loading commit data...
inspector Loading commit data...
interpreter Loading commit data...
json Loading commit data...
libplatform Loading commit data...
libsampler Loading commit data...
logging Loading commit data...
numbers Loading commit data...
objects Loading commit data...
parsing Loading commit data...
profiler Loading commit data...
protobuf Loading commit data...
regexp Loading commit data...
roots Loading commit data...
runtime Loading commit data...
sanitizer Loading commit data...
snapshot Loading commit data...
strings Loading commit data...
tasks Loading commit data...
third_party Loading commit data...
torque Loading commit data...
tracing Loading commit data...
trap-handler Loading commit data...
utils Loading commit data...
wasm Loading commit data...
zone Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
OWNERS Loading commit data...