Skip to content

Commit

Permalink
deps: V8: cherry-pick 4c074516397b
Browse files Browse the repository at this point in the history
Original commit message:

    [promises] Fix slow path when context promise hooks are present

    Bug: chromium:1201936
    Change-Id: I1ee545e33587ddf4a5c7e1cbd64b53d36c75a146
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2850936
    Reviewed-by: Marja Hölttä <marja@chromium.org>
    Reviewed-by: Jakob Gruber <jgruber@chromium.org>
    Commit-Queue: Camillo Bruni <cbruni@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#74267}

Refs: v8/v8@4c07451

PR-URL: #36394
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Stephen Belanger authored and targos committed May 17, 2021
1 parent 043b1aa commit a84e9b3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.14',
'v8_embedder_string': '-node.15',

##### V8 defaults for Node.js #####

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/builtins/promise-jobs.tq
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// https://tc39.es/ecma262/#sec-promise-jobs
namespace promise {
extern macro IsJSPromiseMap(Map): bool;
extern macro NeedsAnyPromiseHooks(): bool;

// https://tc39.es/ecma262/#sec-promiseresolvethenablejob
transitioning builtin
Expand All @@ -25,7 +26,7 @@ PromiseResolveThenableJob(implicit context: Context)(
const promiseThen = *NativeContextSlot(ContextSlot::PROMISE_THEN_INDEX);
const thenableMap = thenable.map;
if (TaggedEqual(then, promiseThen) && IsJSPromiseMap(thenableMap) &&
!IsIsolatePromiseHookEnabledOrDebugIsActiveOrHasAsyncEventDelegate() &&
!NeedsAnyPromiseHooks() &&
IsPromiseSpeciesLookupChainIntact(nativeContext, thenableMap)) {
// We know that the {thenable} is a JSPromise, which doesn't require
// any special treatment and that {then} corresponds to the initial
Expand Down
6 changes: 3 additions & 3 deletions deps/v8/src/codegen/code-stub-assembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13435,11 +13435,11 @@ TNode<BoolT> CodeStubAssembler::
return Word32NotEqual(flags, Int32Constant(0));
}

TNode<BoolT> CodeStubAssembler::
IsAnyPromiseHookEnabledOrHasAsyncEventDelegate(TNode<Uint32T> flags) {
TNode<BoolT> CodeStubAssembler::NeedsAnyPromiseHooks(TNode<Uint32T> flags) {
uint32_t mask = Isolate::PromiseHookFields::HasContextPromiseHook::kMask |
Isolate::PromiseHookFields::HasIsolatePromiseHook::kMask |
Isolate::PromiseHookFields::HasAsyncEventDelegate::kMask;
Isolate::PromiseHookFields::HasAsyncEventDelegate::kMask |
Isolate::PromiseHookFields::IsDebugActive::kMask;
return IsSetWord32(flags, mask);
}

Expand Down
10 changes: 4 additions & 6 deletions deps/v8/src/codegen/code-stub-assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3528,12 +3528,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
return IsAnyPromiseHookEnabledOrDebugIsActiveOrHasAsyncEventDelegate(
PromiseHookFlags());
}
TNode<BoolT> IsAnyPromiseHookEnabledOrHasAsyncEventDelegate(
TNode<Uint32T> flags);
TNode<BoolT>
IsAnyPromiseHookEnabledOrHasAsyncEventDelegate() {
return IsAnyPromiseHookEnabledOrHasAsyncEventDelegate(
PromiseHookFlags());

TNode<BoolT> NeedsAnyPromiseHooks(TNode<Uint32T> flags);
TNode<BoolT> NeedsAnyPromiseHooks() {
return NeedsAnyPromiseHooks(PromiseHookFlags());
}

// for..in helpers
Expand Down

0 comments on commit a84e9b3

Please sign in to comment.