• Benedikt Meurer's avatar
    [builtins] Optimize PromiseResolveThenableJob for the common case. · 1f8dcc5d
    Benedikt Meurer authored
    The idea here is that in case the `thenable` is a JSPromise and `then`
    is the initial `Promise.prototype.then` method, and the @@species lookup
    chain is intact, we can skip creating the temporary promise and the
    closures (with the shared context), and instead directly call into our
    PerformPromiseThen. This is sound since - given above mentioned
    conditions - our short-cut
    
      PerformPromiseThen(thenable, undefined, undefined, promise_to_resolve)
    
    is not observably different from the actual
    
      resolve, reject = CreateResolvingFunctions(promise_to_resolve)
      result_capability = NewPromiseCapability(%Promise%)
      PerformPromiseThen(thenable, resolve, reject, result_capability)
    
    except through PromiseHooks (and potentially via the async stack
    traces). So we disable the fast-path if either promise hooks are enabled
    or the debugger is active for now.
    
    This improves the performance on the wikipedia benchmark by 20-25% and
    the bluebird-doxbee benchmark by around 20%.
    
    Bug: v8:7253
    Change-Id: I23c92ad365c2b71d65057573f2d8febe2afe00b0
    Reviewed-on: https://chromium-review.googlesource.com/911800
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#51261}
    1f8dcc5d
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides 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...
.editorconfig Loading commit data...
.git-blame-ignore-revs 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...