diff --git a/common.gypi b/common.gypi index 0cab2b8fd68591..b0afb5ace7e1df 100644 --- a/common.gypi +++ b/common.gypi @@ -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.12', + 'v8_embedder_string': '-node.13', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/builtins/promise-misc.tq b/deps/v8/src/builtins/promise-misc.tq index c6661e371732cb..50e2c8f0de1419 100644 --- a/deps/v8/src/builtins/promise-misc.tq +++ b/deps/v8/src/builtins/promise-misc.tq @@ -134,7 +134,7 @@ transitioning macro RunContextPromiseHookResolve(implicit context: Context)( @export transitioning macro RunContextPromiseHookBefore(implicit context: Context)( - promiseOrCapability: JSPromise|PromiseCapability) { + promiseOrCapability: JSPromise|PromiseCapability|Undefined) { RunContextPromiseHook( ContextSlot::PROMISE_HOOK_BEFORE_FUNCTION_INDEX, promiseOrCapability, PromiseHookFlags()); @@ -142,7 +142,7 @@ transitioning macro RunContextPromiseHookBefore(implicit context: Context)( @export transitioning macro RunContextPromiseHookBefore(implicit context: Context)( - promiseOrCapability: JSPromise|PromiseCapability, flags: uint32) { + promiseOrCapability: JSPromise|PromiseCapability|Undefined, flags: uint32) { RunContextPromiseHook( ContextSlot::PROMISE_HOOK_BEFORE_FUNCTION_INDEX, promiseOrCapability, flags); @@ -150,7 +150,7 @@ transitioning macro RunContextPromiseHookBefore(implicit context: Context)( @export transitioning macro RunContextPromiseHookAfter(implicit context: Context)( - promiseOrCapability: JSPromise|PromiseCapability) { + promiseOrCapability: JSPromise|PromiseCapability|Undefined) { RunContextPromiseHook( ContextSlot::PROMISE_HOOK_AFTER_FUNCTION_INDEX, promiseOrCapability, PromiseHookFlags()); @@ -158,7 +158,7 @@ transitioning macro RunContextPromiseHookAfter(implicit context: Context)( @export transitioning macro RunContextPromiseHookAfter(implicit context: Context)( - promiseOrCapability: JSPromise|PromiseCapability, flags: uint32) { + promiseOrCapability: JSPromise|PromiseCapability|Undefined, flags: uint32) { RunContextPromiseHook( ContextSlot::PROMISE_HOOK_AFTER_FUNCTION_INDEX, promiseOrCapability, flags); @@ -166,7 +166,7 @@ transitioning macro RunContextPromiseHookAfter(implicit context: Context)( transitioning macro RunContextPromiseHook(implicit context: Context)( slot: Slot, - promiseOrCapability: JSPromise|PromiseCapability, flags: uint32) { + promiseOrCapability: JSPromise|PromiseCapability|Undefined, flags: uint32) { if (!IsContextPromiseHookEnabled(flags)) return; const maybeHook = *NativeContextSlot(slot); if (IsUndefined(maybeHook)) return; @@ -181,6 +181,9 @@ transitioning macro RunContextPromiseHook(implicit context: Context)( case (capability: PromiseCapability): { promise = Cast(capability.promise) otherwise return; } + case (Undefined): { + return; + } } try { diff --git a/deps/v8/test/mjsunit/promise-hooks.js b/deps/v8/test/mjsunit/promise-hooks.js index 9e13206a525f95..db7041a8f5de97 100644 --- a/deps/v8/test/mjsunit/promise-hooks.js +++ b/deps/v8/test/mjsunit/promise-hooks.js @@ -1,7 +1,7 @@ // Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// + // Flags: --allow-natives-syntax --opt --no-always-opt --no-stress-opt --deopt-every-n-times=0 --ignore-unhandled-promises let log = []; @@ -242,3 +242,13 @@ optimizerBailout(async () => { }); basicTest(); exceptions(); + +(function regress1126309() { + function __f_16(test) { + test(); + d8.promise.setHooks( undefined, () => {}); + %PerformMicrotaskCheckpoint(); + d8.promise.setHooks(); + } + __f_16(async () => { await Promise.resolve()}); +})();