• Alexey Kozyatinskiy's avatar
    [inspector] reworked async instrumentation for promises · ed9b2072
    Alexey Kozyatinskiy authored
    Old instrumentation was designed to collect promise creation stack and
    promise scheduled stack together. In DevTools for last 6 months we
    show only creation stack for promises. We got strong support from users
    for new model. Now we can drop support for scheduled stacks and
    simplify implementation.
    
    New promise instrumentation is straightforward:
    - we send kDebugPromiseThen when promise is created by .then call,
    - we send kDebugPromiseCatch when promise is created by .catch call,
    - we send kDebugWillHandle before chained callback and kDebugDidHandle
      after chained callback,
    - and we send separate kDebugAsyncFunctionPromiseCreated for internal
      promise inside async await function.
    
    Advantages:
    - we reduce amount of captured stacks (we do not capture stack for
      promise that constructed not by .then or .catch),
    - we can consider async task related to .then and .catch as one shot
      since chained callback is executed once,
    - on V8 side we can implement required instrumentation using only
      promise hooks,
    
    Disadvantage:
    - see await-promise test, sometimes scheduled stack was useful since we
      add catch handler in native code,
    
    Implementation details:
    - on kInit promise hook we need to figure out why promise was created.
      We analyze builtin functions until first user defined function on
      current stack. If there is kAsyncFunctionPromiseCreate function then
      we send kDebugAsyncFunctionPromiseCreated event. If there is
      kPromiseThen or kPromiseCatch then only if this function is bottom
      builtin function we send corresponded event to inspector. We need it
      because Promise.all internally calls .then and in this case we have
      Promise.all and Promise.then on stack at the same time and we do not
      need to report this internally created promise to inspector.
    
    Bug: chromium:778796
    Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
    Change-Id: I53f47ce8c5c4a9897655c3396c249ea59529ae47
    Reviewed-on: https://chromium-review.googlesource.com/765208
    Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
    Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#49553}
    ed9b2072
Name
Last commit
Last update
..
arm Loading commit data...
arm64 Loading commit data...
ia32 Loading commit data...
mips Loading commit data...
mips64 Loading commit data...
ppc Loading commit data...
s390 Loading commit data...
x64 Loading commit data...
builtins-api.cc Loading commit data...
builtins-arguments-gen.cc Loading commit data...
builtins-arguments-gen.h Loading commit data...
builtins-array-gen.cc Loading commit data...
builtins-array.cc Loading commit data...
builtins-arraybuffer.cc Loading commit data...
builtins-async-function-gen.cc Loading commit data...
builtins-async-gen.cc Loading commit data...
builtins-async-gen.h Loading commit data...
builtins-async-generator-gen.cc Loading commit data...
builtins-async-iterator-gen.cc Loading commit data...
builtins-bigint.cc Loading commit data...
builtins-boolean-gen.cc Loading commit data...
builtins-boolean.cc Loading commit data...
builtins-call-gen.cc Loading commit data...
builtins-call-gen.h Loading commit data...
builtins-call.cc Loading commit data...
builtins-callsite.cc Loading commit data...
builtins-collections-gen.cc Loading commit data...
builtins-collections.cc Loading commit data...
builtins-console-gen.cc Loading commit data...
builtins-console.cc Loading commit data...
builtins-constructor-gen.cc Loading commit data...
builtins-constructor-gen.h Loading commit data...
builtins-constructor.h Loading commit data...
builtins-conversion-gen.cc Loading commit data...
builtins-dataview.cc Loading commit data...
builtins-date-gen.cc Loading commit data...
builtins-date.cc Loading commit data...
builtins-debug-gen.cc Loading commit data...
builtins-definitions.h Loading commit data...
builtins-descriptors.h Loading commit data...
builtins-error.cc Loading commit data...
builtins-function-gen.cc Loading commit data...
builtins-function.cc Loading commit data...
builtins-generator-gen.cc Loading commit data...
builtins-global-gen.cc Loading commit data...
builtins-global.cc Loading commit data...
builtins-handler-gen.cc Loading commit data...
builtins-ic-gen.cc Loading commit data...
builtins-internal-gen.cc Loading commit data...
builtins-internal.cc Loading commit data...
builtins-interpreter-gen.cc Loading commit data...
builtins-interpreter.cc Loading commit data...
builtins-intl-gen.cc Loading commit data...
builtins-intl.cc Loading commit data...
builtins-intl.h Loading commit data...
builtins-iterator-gen.cc Loading commit data...
builtins-iterator-gen.h Loading commit data...
builtins-json.cc Loading commit data...
builtins-math-gen.cc Loading commit data...
builtins-math.cc Loading commit data...
builtins-number-gen.cc Loading commit data...
builtins-number.cc Loading commit data...
builtins-object-gen.cc Loading commit data...
builtins-object.cc Loading commit data...
builtins-promise-gen.cc Loading commit data...
builtins-promise-gen.h Loading commit data...
builtins-promise.cc Loading commit data...
builtins-proxy-gen.cc Loading commit data...
builtins-proxy-gen.h Loading commit data...
builtins-reflect-gen.cc Loading commit data...
builtins-reflect.cc Loading commit data...
builtins-regexp-gen.cc Loading commit data...
builtins-regexp-gen.h Loading commit data...
builtins-regexp.cc Loading commit data...
builtins-sharedarraybuffer-gen.cc Loading commit data...
builtins-sharedarraybuffer.cc Loading commit data...
builtins-string-gen.cc Loading commit data...
builtins-string-gen.h Loading commit data...
builtins-string.cc Loading commit data...
builtins-symbol-gen.cc Loading commit data...
builtins-symbol.cc Loading commit data...
builtins-typedarray-gen.cc Loading commit data...
builtins-typedarray.cc Loading commit data...
builtins-utils-gen.h Loading commit data...
builtins-utils.h Loading commit data...
builtins-wasm-gen.cc Loading commit data...
builtins.cc Loading commit data...
builtins.h Loading commit data...
setup-builtins-internal.cc Loading commit data...