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

Side by Side Diff: src/parsing/parser.cc

Issue 2033223003: [debug] implement intuitive semantics for stepping over await call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix arm64 Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 5580 matching lines...) Expand 10 before | Expand all | Expand 10 after
5591 Expression* right, 5591 Expression* right,
5592 int pos) { 5592 int pos) {
5593 return parser_->RewriteAssignExponentiation(left, right, pos); 5593 return parser_->RewriteAssignExponentiation(left, right, pos);
5594 } 5594 }
5595 5595
5596 void ParserTraits::RewriteNonPattern(Type::ExpressionClassifier* classifier, 5596 void ParserTraits::RewriteNonPattern(Type::ExpressionClassifier* classifier,
5597 bool* ok) { 5597 bool* ok) {
5598 parser_->RewriteNonPattern(classifier, ok); 5598 parser_->RewriteNonPattern(classifier, ok);
5599 } 5599 }
5600 5600
5601 Expression* ParserTraits::RewriteAwaitExpression(Expression* value, int pos) { 5601 Expression* ParserTraits::RewriteAwaitExpression(Expression* value,
5602 int await_pos) {
5602 // yield %AsyncFunctionAwait(.generator_object, <operand>) 5603 // yield %AsyncFunctionAwait(.generator_object, <operand>)
5603 Variable* generator_object_variable = 5604 Variable* generator_object_variable =
5604 parser_->function_state_->generator_object_variable(); 5605 parser_->function_state_->generator_object_variable();
5605 5606
5606 // If generator_object_variable is null, 5607 // If generator_object_variable is null,
5607 if (!generator_object_variable) return value; 5608 if (!generator_object_variable) return value;
5608 5609
5609 Expression* generator_object = 5610 auto factory = parser_->factory();
5610 parser_->factory()->NewVariableProxy(generator_object_variable); 5611 const int nopos = RelocInfo::kNoPosition;
5612
5613 Variable* temp_var = parser_->scope_->NewTemporary(
5614 parser_->ast_value_factory()->empty_string());
5615 VariableProxy* temp_proxy = factory->NewVariableProxy(temp_var);
5616 Block* do_block = factory->NewBlock(nullptr, 2, false, nopos);
5617
5618 // Wrap value evaluation to provide a break location.
5619 Expression* value_assignment =
5620 factory->NewAssignment(Token::ASSIGN, temp_proxy, value, nopos);
5621 do_block->statements()->Add(
5622 factory->NewExpressionStatement(value_assignment, value->position()),
5623 zone());
5611 5624
5612 ZoneList<Expression*>* async_function_await_args = 5625 ZoneList<Expression*>* async_function_await_args =
5613 new (zone()) ZoneList<Expression*>(2, zone()); 5626 new (zone()) ZoneList<Expression*>(2, zone());
5627 Expression* generator_object =
5628 factory->NewVariableProxy(generator_object_variable);
5614 async_function_await_args->Add(generator_object, zone()); 5629 async_function_await_args->Add(generator_object, zone());
5615 async_function_await_args->Add(value, zone()); 5630 async_function_await_args->Add(temp_proxy, zone());
5616 Expression* async_function_await = parser_->factory()->NewCallRuntime( 5631 Expression* async_function_await = parser_->factory()->NewCallRuntime(
5617 Context::ASYNC_FUNCTION_AWAIT_INDEX, async_function_await_args, 5632 Context::ASYNC_FUNCTION_AWAIT_INDEX, async_function_await_args, nopos);
5618 RelocInfo::kNoPosition); 5633 // Wrap await to provide a break location between value evaluation and yield.
5634 Expression* await_assignment = factory->NewAssignment(
5635 Token::ASSIGN, temp_proxy, async_function_await, nopos);
5636 do_block->statements()->Add(
5637 factory->NewExpressionStatement(await_assignment, await_pos), zone());
5638 Expression* do_expr = factory->NewDoExpression(do_block, temp_var, nopos);
5619 5639
5620 generator_object = 5640 generator_object = factory->NewVariableProxy(generator_object_variable);
5621 parser_->factory()->NewVariableProxy(generator_object_variable); 5641 return factory->NewYield(generator_object, do_expr, nopos);
5622 return parser_->factory()->NewYield(generator_object, async_function_await,
5623 pos);
5624 } 5642 }
5625 5643
5626 Zone* ParserTraits::zone() const { 5644 Zone* ParserTraits::zone() const {
5627 return parser_->function_state_->scope()->zone(); 5645 return parser_->function_state_->scope()->zone();
5628 } 5646 }
5629 5647
5630 5648
5631 ZoneList<Expression*>* ParserTraits::GetNonPatternList() const { 5649 ZoneList<Expression*>* ParserTraits::GetNonPatternList() const {
5632 return parser_->function_state_->non_patterns_to_rewrite(); 5650 return parser_->function_state_->non_patterns_to_rewrite();
5633 } 5651 }
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
6942 try_block, target); 6960 try_block, target);
6943 final_loop = target; 6961 final_loop = target;
6944 } 6962 }
6945 6963
6946 return final_loop; 6964 return final_loop;
6947 } 6965 }
6948 6966
6949 6967
6950 } // namespace internal 6968 } // namespace internal
6951 } // namespace v8 6969 } // namespace v8
OLDNEW
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698