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

Unified Diff: src/js/async-await.js

Issue 2590563003: [promises] Remove deferred object (Closed)
Patch Set: rebase Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.cc ('k') | src/js/promise.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/async-await.js
diff --git a/src/js/async-await.js b/src/js/async-await.js
index 62f42478e2ab776fa038ccc3aa6e28242843afc1..f5958d13e482d0ef43073a332cfca1f2767c348f 100644
--- a/src/js/async-await.js
+++ b/src/js/async-await.js
@@ -13,7 +13,6 @@
var AsyncFunctionNext;
var AsyncFunctionThrow;
-var CreateInternalPromiseCapability;
var PromiseCreate;
var PromiseNextMicrotaskID;
var RejectPromise;
@@ -21,7 +20,6 @@ var RejectPromise;
utils.Import(function(from) {
AsyncFunctionNext = from.AsyncFunctionNext;
AsyncFunctionThrow = from.AsyncFunctionThrow;
- CreateInternalPromiseCapability = from.CreateInternalPromiseCapability;
PromiseCreate = from.PromiseCreate;
RejectPromise = from.RejectPromise;
});
@@ -40,7 +38,7 @@ function PromiseCastResolved(value) {
if (%is_promise(value)) {
return value;
} else {
- var promise = PromiseCreate();
+ var promise = PromiseCreate(UNDEFINED);
%promise_resolve(promise, value);
return promise;
}
@@ -79,12 +77,11 @@ function AsyncFunctionAwait(generator, awaited, outerPromise) {
return;
}
- // Just forwarding the exception, so no debugEvent for throwawayCapability.
- var throwawayCapability = CreateInternalPromiseCapability(promise);
+ var throwawayPromise = PromiseCreate(promise);
// The Promise will be thrown away and not handled, but it shouldn't trigger
// unhandled reject events as its work is done
- %PromiseMarkAsHandled(throwawayCapability.promise);
+ %PromiseMarkAsHandled(throwawayPromise);
if (DEBUG_IS_ACTIVE) {
if (%is_promise(awaited)) {
@@ -95,11 +92,10 @@ function AsyncFunctionAwait(generator, awaited, outerPromise) {
// Mark the dependency to outerPromise in case the throwaway Promise is
// found on the Promise stack
- SET_PRIVATE(throwawayCapability.promise, promiseHandledBySymbol,
- outerPromise);
+ SET_PRIVATE(throwawayPromise, promiseHandledBySymbol, outerPromise);
}
- %perform_promise_then(promise, onFulfilled, onRejected, throwawayCapability);
+ %perform_promise_then(promise, onFulfilled, onRejected, throwawayPromise);
}
// Called by the parser from the desugaring of 'await' when catch
« no previous file with comments | « src/isolate.cc ('k') | src/js/promise.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698