Skip to content

Commit c93f357

Browse files
committed
deps: V8: cherry-pick fa4cb172cde2
Original commit message: [runtime] Fix Promise.all context promise hooks We have to take the slow path in Promise.all if context promise hooks are set. The fast-path doesn't create intermediate promises by default. Bug: chromium:1204132, v8:11025 Change-Id: Ide92de00a4f6df05e0ddbc8814f6673bd667f426 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2866771 Reviewed-by: Victor Gomes <victorgomes@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#74326} Refs: v8/v8@fa4cb17 PR-URL: #38273 Backport-PR-URL: #38991 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>
1 parent 3c6c28b commit c93f357

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.12',
39+
'v8_embedder_string': '-node.13',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/src/builtins/promise-all.tq

+1-2
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ Reject(Object) {
231231
// the PromiseReaction (aka we can pass undefined to
232232
// PerformPromiseThen), since this is only necessary for DevTools and
233233
// PromiseHooks.
234-
if (promiseResolveFunction != Undefined ||
235-
IsIsolatePromiseHookEnabledOrDebugIsActiveOrHasAsyncEventDelegate() ||
234+
if (promiseResolveFunction != Undefined || NeedsAnyPromiseHooks() ||
236235
IsPromiseSpeciesProtectorCellInvalid() || Is<Smi>(nextValue) ||
237236
!IsPromiseThenLookupChainIntact(
238237
nativeContext, UnsafeCast<HeapObject>(nextValue).map)) {

deps/v8/test/mjsunit/promise-hooks.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ exceptions();
246246
(function regress1126309() {
247247
function __f_16(test) {
248248
test();
249-
d8.promise.setHooks( undefined, () => {});
249+
d8.promise.setHooks(undefined, () => {});
250250
%PerformMicrotaskCheckpoint();
251251
d8.promise.setHooks();
252252
}
@@ -262,3 +262,14 @@ exceptions();
262262
%PerformMicrotaskCheckpoint();
263263
d8.promise.setHooks();
264264
})();
265+
266+
267+
(function promiseAll() {
268+
let initCount = 0;
269+
d8.promise.setHooks(() => { initCount++});
270+
Promise.all([Promise.resolve(1)]);
271+
%PerformMicrotaskCheckpoint();
272+
assertEquals(initCount, 3);
273+
274+
d8.promise.setHooks();
275+
})();

0 commit comments

Comments
 (0)