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

Unified Diff: src/js/promise.js

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: fix some nits Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/prologue.js ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/promise.js
diff --git a/src/js/promise.js b/src/js/promise.js
index 65a8bf3f4ddf0ec598c7c0a21067dff943a5ea66..42b772bab1580883b53e8ff6d6ddac255af37da2 100644
--- a/src/js/promise.js
+++ b/src/js/promise.js
@@ -293,6 +293,16 @@ function PromiseReject(r) {
}
}
+// Shortcut Promise.reject and Promise.resolve() implementations, used by
+// Async Functions implementation.
+function PromiseCreateRejected(r) {
+ return %_Call(PromiseReject, GlobalPromise, r);
+}
+
+function PromiseCreateResolved(x) {
+ return %_Call(PromiseResolve, GlobalPromise, x);
+}
+
// ES#sec-promise.prototype.then
// Promise.prototype.then ( onFulfilled, onRejected )
// Multi-unwrapped chaining with thenable coercion.
@@ -487,6 +497,8 @@ utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [
"promise_reject", RejectPromise,
"promise_resolve", FulfillPromise,
"promise_then", PromiseThen,
+ "promise_create_rejected", PromiseCreateRejected,
+ "promise_create_resolved", PromiseCreateResolved
]);
// This allows extras to create promises quickly without building extra
@@ -506,6 +518,10 @@ utils.Export(function(to) {
to.PromiseChain = PromiseChain;
to.PromiseDefer = PromiseDefer;
to.PromiseAccept = PromiseAccept;
+
+ to.PromiseCreateRejected = PromiseCreateRejected;
+ to.PromiseCreateResolved = PromiseCreateResolved;
+ to.PromiseThen = PromiseThen;
});
})
« no previous file with comments | « src/js/prologue.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698