Issue #2089 - Optimize Promise.then and Promise.all/race with default resolving functions

Based-on: m-c 1401508,1412200,1473970/{1-4}
This commit is contained in:
Martok 2023-01-22 15:14:08 +01:00 • committed by roytam1
commit 9744b0c2bc
17 changed files with 906 additions and 142 deletions

View file

@ -0,0 +1,18 @@
// Don't assert when the promise in the resolving functions is wrapped in a CCW.
function newPromiseCapability(newTarget) {
var resolve, reject, promise = Reflect.construct(Promise, [function(r1, r2) {
resolve = r1;
reject = r2;
}], newTarget);
return {promise, resolve, reject};
}
var g = newGlobal();
var {promise, reject} = newPromiseCapability(g.Promise);
g.settlePromiseNow(promise);
// Don't assert when rejecting the promise.
reject(0);