[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}
This commit is contained in:
parent
c85723a6f1
commit
4c07451639
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user