Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: src/js/promise.js

Issue 2353303003: [promises] Don't create resolving functions for PromiseCreate (Closed)
Patch Set: remove unnecessary function Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils, extrasUtils) { 5 (function(global, utils, extrasUtils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } else { 241 } else {
242 maybeResolveCallbacks.push(onResolve, deferred); 242 maybeResolveCallbacks.push(onResolve, deferred);
243 GET_PRIVATE(promise, promiseRejectReactionsSymbol).push(onReject, deferred); 243 GET_PRIVATE(promise, promiseRejectReactionsSymbol).push(onReject, deferred);
244 } 244 }
245 } 245 }
246 246
247 function PromiseIdResolveHandler(x) { return x; } 247 function PromiseIdResolveHandler(x) { return x; }
248 function PromiseIdRejectHandler(r) { %_ReThrow(r); } 248 function PromiseIdRejectHandler(r) { %_ReThrow(r); }
249 SET_PRIVATE(PromiseIdRejectHandler, promiseForwardingHandlerSymbol, true); 249 SET_PRIVATE(PromiseIdRejectHandler, promiseForwardingHandlerSymbol, true);
250 250
251 function PromiseNopResolver() {}
252
253 // ------------------------------------------------------------------- 251 // -------------------------------------------------------------------
254 // Define exported functions. 252 // Define exported functions.
255 253
256 // For bootstrapper. 254 // For bootstrapper.
257 255
258 // ES#sec-ispromise IsPromise ( x ) 256 // ES#sec-ispromise IsPromise ( x )
259 function IsPromise(x) { 257 function IsPromise(x) {
260 return IS_RECEIVER(x) && HAS_DEFINED_PRIVATE(x, promiseStateSymbol); 258 return IS_RECEIVER(x) && HAS_DEFINED_PRIVATE(x, promiseStateSymbol);
261 } 259 }
262 260
263 function PromiseCreate() { 261 function PromiseCreate() {
264 return new GlobalPromise(PromiseNopResolver); 262 return PromiseInit(new GlobalPromise(promiseRawSymbol));
265 } 263 }
266 264
267 // ES#sec-promise-resolve-functions 265 // ES#sec-promise-resolve-functions
268 // Promise Resolve Functions, steps 6-13 266 // Promise Resolve Functions, steps 6-13
269 function ResolvePromise(promise, resolution) { 267 function ResolvePromise(promise, resolution) {
270 if (resolution === promise) { 268 if (resolution === promise) {
271 return RejectPromise(promise, 269 return RejectPromise(promise,
272 %make_type_error(kPromiseCyclic, resolution), 270 %make_type_error(kPromiseCyclic, resolution),
273 true); 271 true);
274 } 272 }
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 to.PromiseNextMicrotaskID = PromiseNextMicrotaskID; 696 to.PromiseNextMicrotaskID = PromiseNextMicrotaskID;
699 697
700 to.GlobalPromise = GlobalPromise; 698 to.GlobalPromise = GlobalPromise;
701 to.NewPromiseCapability = NewPromiseCapability; 699 to.NewPromiseCapability = NewPromiseCapability;
702 to.PerformPromiseThen = PerformPromiseThen; 700 to.PerformPromiseThen = PerformPromiseThen;
703 to.ResolvePromise = ResolvePromise; 701 to.ResolvePromise = ResolvePromise;
704 to.RejectPromise = RejectPromise; 702 to.RejectPromise = RejectPromise;
705 }); 703 });
706 704
707 }) 705 })
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698