[promises] Don't create resolving functions for PromiseCreate

Previously passing in the PromiseNopResolver function to the Promise
constructor would result in creating the resolving functions to be in
passed in to the executor, but the PromiseNopResolver does not use
these resolving functions resulting in wastefully creating these closures.

Instead we pass in the promiseRawSymbol to the promise constructor
so that these unnecessary resolving functions are not created.

BUG=v8:5046

Review-Url: https://codereview.chromium.org/2353303003
Cr-Commit-Position: refs/heads/master@{#39791}
This commit is contained in:
gsathya 2016-09-27 11:46:03 -07:00 committed by Commit bot
parent 01824e5e96
commit 1f89abcb9a

View File

@ -248,8 +248,6 @@ function PromiseIdResolveHandler(x) { return x; }
function PromiseIdRejectHandler(r) { %_ReThrow(r); }
SET_PRIVATE(PromiseIdRejectHandler, promiseForwardingHandlerSymbol, true);
function PromiseNopResolver() {}
// -------------------------------------------------------------------
// Define exported functions.
@ -261,7 +259,7 @@ function IsPromise(x) {
}
function PromiseCreate() {
return new GlobalPromise(PromiseNopResolver);
return PromiseInit(new GlobalPromise(promiseRawSymbol));
}
// ES#sec-promise-resolve-functions