From 33d95eeb7d5cb8ba4e4eecdf02d494903d356b31 Mon Sep 17 00:00:00 2001 From: jameslahm Date: Tue, 15 Feb 2022 15:56:37 +0800 Subject: [PATCH] [errors] Correct 'Promise.allSettled.call()' error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally, 'Promise.allSettled.call()' will throw "Promise.all called on non-object". It should be "Promise.allSettled called on non-object". Bug: v8:12122 Change-Id: Ib2c8eba32abec474feece3aaebf0e6c7d09c433a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3459923 Reviewed-by: Mathias Bynens Reviewed-by: Marja Hölttä Commit-Queue: Marja Hölttä Cr-Commit-Position: refs/heads/main@{#79085} --- AUTHORS | 1 + src/builtins/promise-all.tq | 8 +++---- tools/v8heapconst.py | 42 ++++++++++++++++++------------------- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/AUTHORS b/AUTHORS index 9ad2949716..3a4a088d11 100644 --- a/AUTHORS +++ b/AUTHORS @@ -63,6 +63,7 @@ Anna Henningsen Antoine du Hamel Anton Bershanskiy <8knots@protonmail.com> Anton Bikineev +Ao Wang Archil Sharashenidze Bangfu Tao Ben Coe diff --git a/src/builtins/promise-all.tq b/src/builtins/promise-all.tq index cd55ec9f3b..29c468ed3e 100644 --- a/src/builtins/promise-all.tq +++ b/src/builtins/promise-all.tq @@ -319,12 +319,12 @@ Reject(JSAny) { transitioning macro GeneratePromiseAll( implicit context: Context)( receiver: JSAny, iterable: JSAny, createResolveElementFunctor: F1, - createRejectElementFunctor: F2): JSAny { + createRejectElementFunctor: F2, message: constexpr string): JSAny { const nativeContext = LoadNativeContext(context); // Let C be the this value. // If Type(C) is not Object, throw a TypeError exception. const receiver = Cast(receiver) - otherwise ThrowTypeError(MessageTemplate::kCalledOnNonObject, 'Promise.all'); + otherwise ThrowTypeError(MessageTemplate::kCalledOnNonObject, message); // Let promiseCapability be ? NewPromiseCapability(C). // Don't fire debugEvent so that forwarding the rejection through all does @@ -368,7 +368,7 @@ transitioning javascript builtin PromiseAll( js-implicit context: Context, receiver: JSAny)(iterable: JSAny): JSAny { return GeneratePromiseAll( receiver, iterable, PromiseAllResolveElementFunctor{}, - PromiseAllRejectElementFunctor{}); + PromiseAllRejectElementFunctor{}, 'Promise.all'); } // ES#sec-promise.allsettled @@ -377,7 +377,7 @@ transitioning javascript builtin PromiseAllSettled( js-implicit context: Context, receiver: JSAny)(iterable: JSAny): JSAny { return GeneratePromiseAll( receiver, iterable, PromiseAllSettledResolveElementFunctor{}, - PromiseAllSettledRejectElementFunctor{}); + PromiseAllSettledRejectElementFunctor{}, 'Promise.allSettled'); } extern macro PromiseAllResolveElementSharedFunConstant(): SharedFunctionInfo; diff --git a/tools/v8heapconst.py b/tools/v8heapconst.py index db11e83b56..135450c237 100644 --- a/tools/v8heapconst.py +++ b/tools/v8heapconst.py @@ -525,27 +525,27 @@ KNOWN_OBJECTS = { ("old_space", 0x04ac9): "StringSplitCache", ("old_space", 0x04ed1): "RegExpMultipleCache", ("old_space", 0x052d9): "BuiltinsConstantsTable", - ("old_space", 0x05701): "AsyncFunctionAwaitRejectSharedFun", - ("old_space", 0x05725): "AsyncFunctionAwaitResolveSharedFun", - ("old_space", 0x05749): "AsyncGeneratorAwaitRejectSharedFun", - ("old_space", 0x0576d): "AsyncGeneratorAwaitResolveSharedFun", - ("old_space", 0x05791): "AsyncGeneratorYieldResolveSharedFun", - ("old_space", 0x057b5): "AsyncGeneratorReturnResolveSharedFun", - ("old_space", 0x057d9): "AsyncGeneratorReturnClosedRejectSharedFun", - ("old_space", 0x057fd): "AsyncGeneratorReturnClosedResolveSharedFun", - ("old_space", 0x05821): "AsyncIteratorValueUnwrapSharedFun", - ("old_space", 0x05845): "PromiseAllResolveElementSharedFun", - ("old_space", 0x05869): "PromiseAllSettledResolveElementSharedFun", - ("old_space", 0x0588d): "PromiseAllSettledRejectElementSharedFun", - ("old_space", 0x058b1): "PromiseAnyRejectElementSharedFun", - ("old_space", 0x058d5): "PromiseCapabilityDefaultRejectSharedFun", - ("old_space", 0x058f9): "PromiseCapabilityDefaultResolveSharedFun", - ("old_space", 0x0591d): "PromiseCatchFinallySharedFun", - ("old_space", 0x05941): "PromiseGetCapabilitiesExecutorSharedFun", - ("old_space", 0x05965): "PromiseThenFinallySharedFun", - ("old_space", 0x05989): "PromiseThrowerFinallySharedFun", - ("old_space", 0x059ad): "PromiseValueThunkFinallySharedFun", - ("old_space", 0x059d1): "ProxyRevokeSharedFun", + ("old_space", 0x05705): "AsyncFunctionAwaitRejectSharedFun", + ("old_space", 0x05729): "AsyncFunctionAwaitResolveSharedFun", + ("old_space", 0x0574d): "AsyncGeneratorAwaitRejectSharedFun", + ("old_space", 0x05771): "AsyncGeneratorAwaitResolveSharedFun", + ("old_space", 0x05795): "AsyncGeneratorYieldResolveSharedFun", + ("old_space", 0x057b9): "AsyncGeneratorReturnResolveSharedFun", + ("old_space", 0x057dd): "AsyncGeneratorReturnClosedRejectSharedFun", + ("old_space", 0x05801): "AsyncGeneratorReturnClosedResolveSharedFun", + ("old_space", 0x05825): "AsyncIteratorValueUnwrapSharedFun", + ("old_space", 0x05849): "PromiseAllResolveElementSharedFun", + ("old_space", 0x0586d): "PromiseAllSettledResolveElementSharedFun", + ("old_space", 0x05891): "PromiseAllSettledRejectElementSharedFun", + ("old_space", 0x058b5): "PromiseAnyRejectElementSharedFun", + ("old_space", 0x058d9): "PromiseCapabilityDefaultRejectSharedFun", + ("old_space", 0x058fd): "PromiseCapabilityDefaultResolveSharedFun", + ("old_space", 0x05921): "PromiseCatchFinallySharedFun", + ("old_space", 0x05945): "PromiseGetCapabilitiesExecutorSharedFun", + ("old_space", 0x05969): "PromiseThenFinallySharedFun", + ("old_space", 0x0598d): "PromiseThrowerFinallySharedFun", + ("old_space", 0x059b1): "PromiseValueThunkFinallySharedFun", + ("old_space", 0x059d5): "ProxyRevokeSharedFun", } # Lower 32 bits of first page addresses for various heap spaces.