Commit 34a0ac3c authored by gsathya's avatar gsathya Committed by Commit bot

[promises] Use PromiseCreate when applicable

Review-Url: https://codereview.chromium.org/2376613003
Cr-Commit-Position: refs/heads/master@{#40011}
parent a16f2ab0
...@@ -370,7 +370,7 @@ function DoRejectPromise(promise, reason) { ...@@ -370,7 +370,7 @@ function DoRejectPromise(promise, reason) {
function NewPromiseCapability(C, debugEvent) { function NewPromiseCapability(C, debugEvent) {
if (C === GlobalPromise) { if (C === GlobalPromise) {
// Optimized case, avoid extra closure. // Optimized case, avoid extra closure.
var promise = PromiseInit(new GlobalPromise(promiseRawSymbol)); var promise = PromiseCreate();
var callbacks = CreateResolvingFunctions(promise, debugEvent); var callbacks = CreateResolvingFunctions(promise, debugEvent);
return { return {
promise: promise, promise: promise,
...@@ -476,7 +476,7 @@ function PromiseResolve(x) { ...@@ -476,7 +476,7 @@ function PromiseResolve(x) {
// Avoid creating resolving functions. // Avoid creating resolving functions.
if (this === GlobalPromise) { if (this === GlobalPromise) {
var promise = PromiseInit(new GlobalPromise(promiseRawSymbol)); var promise = PromiseCreate();
var resolveResult = ResolvePromise(promise, x); var resolveResult = ResolvePromise(promise, x);
return promise; return promise;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment