Commit 4c074516 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[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/+/2850936Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74267}
parent c85723a6
......@@ -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
......@@ -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
......
......@@ -13900,11 +13900,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);
}
......
......@@ -3565,12 +3565,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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment