Commit ca4d8136 authored by jgruber's avatar jgruber Committed by Commit bot

[async-await] Remove call indirection in Create and Reject

Instead of exporting/importing PromiseCreate and RejectPromise and going
through them, just call the runtime function / the TF builtin on the
context directly.

BUG=v8:5639

Review-Url: https://codereview.chromium.org/2599003002
Cr-Commit-Position: refs/heads/master@{#42160}
parent 9691f6ac
......@@ -13,15 +13,10 @@
var AsyncFunctionNext;
var AsyncFunctionThrow;
var PromiseCreate;
var PromiseNextMicrotaskID;
var RejectPromise;
utils.Import(function(from) {
AsyncFunctionNext = from.AsyncFunctionNext;
AsyncFunctionThrow = from.AsyncFunctionThrow;
PromiseCreate = from.PromiseCreate;
RejectPromise = from.RejectPromise;
});
var promiseAsyncStackIDSymbol =
......@@ -38,7 +33,7 @@ function PromiseCastResolved(value) {
if (%is_promise(value)) {
return value;
} else {
var promise = PromiseCreate(UNDEFINED);
var promise = %promise_internal_constructor(UNDEFINED);
%promise_resolve(promise, value);
return promise;
}
......@@ -77,7 +72,7 @@ function AsyncFunctionAwait(generator, awaited, outerPromise) {
return;
}
var throwawayPromise = PromiseCreate(promise);
var throwawayPromise = %promise_internal_constructor(promise);
// The Promise will be thrown away and not handled, but it shouldn't trigger
// unhandled reject events as its work is done
......@@ -115,11 +110,11 @@ function AsyncFunctionAwaitCaught(generator, awaited, outerPromise) {
// How the parser rejects promises from async/await desugaring
function RejectPromiseNoDebugEvent(promise, reason) {
return RejectPromise(promise, reason, false);
return %PromiseReject(promise, reason, false);
}
function AsyncFunctionPromiseCreate() {
var promise = PromiseCreate();
var promise = %promise_internal_constructor(UNDEFINED);
if (DEBUG_IS_ACTIVE) {
// Push the Promise under construction in an async function on
// the catch prediction stack to handle exceptions thrown before
......
......@@ -36,11 +36,6 @@ function PromiseCreate(parent) {
return %promise_internal_constructor(parent);
}
// Only used by async-await.js
function RejectPromise(promise, reason, debugEvent) {
%PromiseReject(promise, reason, debugEvent);
}
// Export to bindings
function DoRejectPromise(promise, reason) {
%PromiseReject(promise, reason, true);
......@@ -174,9 +169,4 @@ utils.InstallFunctions(extrasUtils, 0, [
"markPromiseAsHandled", MarkPromiseAsHandled
]);
utils.Export(function(to) {
to.PromiseCreate = PromiseCreate;
to.RejectPromise = RejectPromise;
});
})
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