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

Unified Diff: src/parsing/parser.cc

Issue 2317383002: Async/await Promise dependency graph (Closed)
Patch Set: Fix parser Created 4 years, 3 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/promise.js ('k') | test/mjsunit/harmony/async-debug-caught-exception-cases.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 4973857c37ea0f2cf2854c35000be559db065e3a..2621150be01cea0cb1b427dd1e857532d1717687 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -4380,7 +4380,8 @@ Expression* Parser::ExpressionListToExpression(ZoneList<Expression*>* args) {
Expression* Parser::RewriteAwaitExpression(Expression* value, int await_pos) {
// yield do {
// tmp = <operand>;
- // tmp = %AsyncFunctionAwait(.generator_object, tmp);
+ // tmp2 = .promise;
+ // tmp = %AsyncFunctionAwait(.generator_object, tmp, tmp2);
// }
Variable* generator_object_variable =
function_state_->generator_object_variable();
@@ -4400,12 +4401,23 @@ Expression* Parser::RewriteAwaitExpression(Expression* value, int await_pos) {
factory()->NewExpressionStatement(value_assignment, value->position()),
zone());
+ Variable* promise_temp_var =
+ NewTemporary(ast_value_factory()->empty_string());
+ Expression* promise_assignment = factory()->NewAssignment(
+ Token::ASSIGN, factory()->NewVariableProxy(promise_temp_var),
+ BuildDotPromise(), nopos);
+ do_block->statements()->Add(
+ factory()->NewExpressionStatement(promise_assignment, value->position()),
+ zone());
Dan Ehrenberg 2016/09/14 01:09:14 This parser change should address the Blink failur
Dan Ehrenberg 2016/09/14 01:32:38 Sorry, issues still remaining; will work on more t
+
ZoneList<Expression*>* async_function_await_args =
- new (zone()) ZoneList<Expression*>(2, zone());
+ new (zone()) ZoneList<Expression*>(3, zone());
Expression* generator_object =
factory()->NewVariableProxy(generator_object_variable);
async_function_await_args->Add(generator_object, zone());
async_function_await_args->Add(factory()->NewVariableProxy(temp_var), zone());
+ async_function_await_args->Add(factory()->NewVariableProxy(promise_temp_var),
+ zone());
// The parser emits calls to AsyncFunctionAwaitCaught, but the
// AstNumberingVisitor will rewrite this to AsyncFunctionAwaitUncaught
« no previous file with comments | « src/js/promise.js ('k') | test/mjsunit/harmony/async-debug-caught-exception-cases.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698