Commit 27edf11e authored by jgruber's avatar jgruber Committed by Commit bot

[async-await] Remove RejectPromiseNoDebugEvent

Just desugar directly into the runtime call instead.

BUG=v8:5639

Review-Url: https://codereview.chromium.org/2633353002
Cr-Commit-Position: refs/heads/master@{#42492}
parent 4ffe0850
...@@ -107,8 +107,6 @@ enum ContextLookupFlags { ...@@ -107,8 +107,6 @@ enum ContextLookupFlags {
V(PROMISE_ID_RESOLVE_HANDLER_INDEX, JSFunction, promise_id_resolve_handler) \ V(PROMISE_ID_RESOLVE_HANDLER_INDEX, JSFunction, promise_id_resolve_handler) \
V(PROMISE_ID_REJECT_HANDLER_INDEX, JSFunction, promise_id_reject_handler) \ V(PROMISE_ID_REJECT_HANDLER_INDEX, JSFunction, promise_id_reject_handler) \
V(RANGE_ERROR_FUNCTION_INDEX, JSFunction, range_error_function) \ V(RANGE_ERROR_FUNCTION_INDEX, JSFunction, range_error_function) \
V(REJECT_PROMISE_NO_DEBUG_EVENT_INDEX, JSFunction, \
reject_promise_no_debug_event) \
V(REFERENCE_ERROR_FUNCTION_INDEX, JSFunction, reference_error_function) \ V(REFERENCE_ERROR_FUNCTION_INDEX, JSFunction, reference_error_function) \
V(SET_ADD_METHOD_INDEX, JSFunction, set_add) \ V(SET_ADD_METHOD_INDEX, JSFunction, set_add) \
V(SET_DELETE_METHOD_INDEX, JSFunction, set_delete) \ V(SET_DELETE_METHOD_INDEX, JSFunction, set_delete) \
......
...@@ -106,11 +106,6 @@ function AsyncFunctionAwaitCaught(generator, awaited, outerPromise) { ...@@ -106,11 +106,6 @@ function AsyncFunctionAwaitCaught(generator, awaited, outerPromise) {
AsyncFunctionAwait(generator, awaited, outerPromise); AsyncFunctionAwait(generator, awaited, outerPromise);
} }
// How the parser rejects promises from async/await desugaring
function RejectPromiseNoDebugEvent(promise, reason) {
return %promise_internal_reject(promise, reason, false);
}
function AsyncFunctionPromiseCreate() { function AsyncFunctionPromiseCreate() {
var promise = %promise_internal_constructor(UNDEFINED); var promise = %promise_internal_constructor(UNDEFINED);
if (DEBUG_IS_ACTIVE) { if (DEBUG_IS_ACTIVE) {
...@@ -135,7 +130,6 @@ function AsyncFunctionPromiseRelease(promise) { ...@@ -135,7 +130,6 @@ function AsyncFunctionPromiseRelease(promise) {
%InstallToContext([ %InstallToContext([
"async_function_await_caught", AsyncFunctionAwaitCaught, "async_function_await_caught", AsyncFunctionAwaitCaught,
"async_function_await_uncaught", AsyncFunctionAwaitUncaught, "async_function_await_uncaught", AsyncFunctionAwaitUncaught,
"reject_promise_no_debug_event", RejectPromiseNoDebugEvent,
"async_function_promise_create", AsyncFunctionPromiseCreate, "async_function_promise_create", AsyncFunctionPromiseCreate,
"async_function_promise_release", AsyncFunctionPromiseRelease, "async_function_promise_release", AsyncFunctionPromiseRelease,
]); ]);
......
...@@ -3018,15 +3018,15 @@ Expression* Parser::BuildResolvePromise(Expression* value, int pos) { ...@@ -3018,15 +3018,15 @@ Expression* Parser::BuildResolvePromise(Expression* value, int pos) {
} }
Expression* Parser::BuildRejectPromise(Expression* value, int pos) { Expression* Parser::BuildRejectPromise(Expression* value, int pos) {
// %RejectPromiseNoDebugEvent(.promise, value, true), .promise // %promise_internal_reject(.promise, value, false), .promise
// The NoDebugEvent variant disables the additional debug event for the // Disables the additional debug event for the rejection since a debug event
// rejection since a debug event already happened for the exception that got // already happened for the exception that got us here.
// us here. ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(3, zone());
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone());
args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); args->Add(factory()->NewVariableProxy(PromiseVariable()), zone());
args->Add(value, zone()); args->Add(value, zone());
args->Add(factory()->NewBooleanLiteral(false, pos), zone());
Expression* call_runtime = factory()->NewCallRuntime( Expression* call_runtime = factory()->NewCallRuntime(
Context::REJECT_PROMISE_NO_DEBUG_EVENT_INDEX, args, pos); Context::PROMISE_INTERNAL_REJECT_INDEX, args, pos);
return factory()->NewBinaryOperation( return factory()->NewBinaryOperation(
Token::COMMA, call_runtime, Token::COMMA, call_runtime,
factory()->NewVariableProxy(PromiseVariable()), pos); factory()->NewVariableProxy(PromiseVariable()), pos);
......
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