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ä <[email protected]>
    Reviewed-by: Jakob Gruber <[email protected]>
    Commit-Queue: Camillo Bruni <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#74267}

Refs: v8/v8@4c07451

PR-URL: #36394
Backport-PR-URL: #38577
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Vladimir de Turckheim <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Stephen Belanger authored and MylesBorins committed Aug 31, 2021
1 parent ec0f0ef commit 9d7177c
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.79',
'v8_embedder_string': '-node.80',

##### 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 = nativeContext[NativeContextSlot::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 @@ -12781,11 +12781,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 @@ -3747,12 +3747,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 9d7177c

Please sign in to comment.