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

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

Issue 2124813002: [debugger] omit exception events for rethrown exceptions in async. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 4 years, 5 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/interpreter/bytecode-generator.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 4761 matching lines...) Expand 10 before | Expand all | Expand 10 after
4772 Expression* allocation = BuildCreateJSGeneratorObject(pos, kind); 4772 Expression* allocation = BuildCreateJSGeneratorObject(pos, kind);
4773 VariableProxy* init_proxy = factory()->NewVariableProxy( 4773 VariableProxy* init_proxy = factory()->NewVariableProxy(
4774 function_state_->generator_object_variable()); 4774 function_state_->generator_object_variable());
4775 Assignment* assignment = factory()->NewAssignment( 4775 Assignment* assignment = factory()->NewAssignment(
4776 Token::INIT, init_proxy, allocation, kNoSourcePosition); 4776 Token::INIT, init_proxy, allocation, kNoSourcePosition);
4777 VariableProxy* get_proxy = factory()->NewVariableProxy( 4777 VariableProxy* get_proxy = factory()->NewVariableProxy(
4778 function_state_->generator_object_variable()); 4778 function_state_->generator_object_variable());
4779 // The position of the yield is important for reporting the exception 4779 // The position of the yield is important for reporting the exception
4780 // caused by calling the .throw method on a generator suspended at the 4780 // caused by calling the .throw method on a generator suspended at the
4781 // initial yield (i.e. right after generator instantiation). 4781 // initial yield (i.e. right after generator instantiation).
4782 Yield* yield = factory()->NewYield(get_proxy, assignment, 4782 Yield* yield =
4783 scope_->start_position()); 4783 factory()->NewYield(get_proxy, assignment, scope_->start_position(),
4784 Yield::kOnExceptionThrow);
4784 try_block->statements()->Add( 4785 try_block->statements()->Add(
4785 factory()->NewExpressionStatement(yield, kNoSourcePosition), 4786 factory()->NewExpressionStatement(yield, kNoSourcePosition),
4786 zone()); 4787 zone());
4787 } 4788 }
4788 4789
4789 ParseStatementList(try_block->statements(), Token::RBRACE, CHECK_OK); 4790 ParseStatementList(try_block->statements(), Token::RBRACE, CHECK_OK);
4790 4791
4791 Statement* final_return = factory()->NewReturnStatement( 4792 Statement* final_return = factory()->NewReturnStatement(
4792 BuildIteratorResult(nullptr, true), kNoSourcePosition); 4793 BuildIteratorResult(nullptr, true), kNoSourcePosition);
4793 try_block->statements()->Add(final_return, zone()); 4794 try_block->statements()->Add(final_return, zone());
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
5726 Expression* async_function_await = parser_->factory()->NewCallRuntime( 5727 Expression* async_function_await = parser_->factory()->NewCallRuntime(
5727 Context::ASYNC_FUNCTION_AWAIT_INDEX, async_function_await_args, nopos); 5728 Context::ASYNC_FUNCTION_AWAIT_INDEX, async_function_await_args, nopos);
5728 // Wrap await to provide a break location between value evaluation and yield. 5729 // Wrap await to provide a break location between value evaluation and yield.
5729 Expression* await_assignment = factory->NewAssignment( 5730 Expression* await_assignment = factory->NewAssignment(
5730 Token::ASSIGN, temp_proxy, async_function_await, nopos); 5731 Token::ASSIGN, temp_proxy, async_function_await, nopos);
5731 do_block->statements()->Add( 5732 do_block->statements()->Add(
5732 factory->NewExpressionStatement(await_assignment, await_pos), zone()); 5733 factory->NewExpressionStatement(await_assignment, await_pos), zone());
5733 Expression* do_expr = factory->NewDoExpression(do_block, temp_var, nopos); 5734 Expression* do_expr = factory->NewDoExpression(do_block, temp_var, nopos);
5734 5735
5735 generator_object = factory->NewVariableProxy(generator_object_variable); 5736 generator_object = factory->NewVariableProxy(generator_object_variable);
5736 return factory->NewYield(generator_object, do_expr, nopos); 5737 return factory->NewYield(generator_object, do_expr, nopos,
5738 Yield::kOnExceptionRethrow);
5737 } 5739 }
5738 5740
5739 ZoneList<Expression*>* ParserTraits::GetNonPatternList() const { 5741 ZoneList<Expression*>* ParserTraits::GetNonPatternList() const {
5740 return parser_->function_state_->non_patterns_to_rewrite(); 5742 return parser_->function_state_->non_patterns_to_rewrite();
5741 } 5743 }
5742 5744
5743 5745
5744 ZoneList<typename ParserTraits::Type::ExpressionClassifier::Error>* 5746 ZoneList<typename ParserTraits::Type::ExpressionClassifier::Error>*
5745 ParserTraits::GetReportedErrorList() const { 5747 ParserTraits::GetReportedErrorList() const {
5746 return parser_->function_state_->GetReportedErrorList(); 5748 return parser_->function_state_->GetReportedErrorList();
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
6339 factory->NewSmiLiteral(JSGeneratorObject::kReturn, nopos); 6341 factory->NewSmiLiteral(JSGeneratorObject::kReturn, nopos);
6340 Expression* assignment = 6342 Expression* assignment =
6341 factory->NewAssignment(Token::ASSIGN, mode_proxy, kreturn, nopos); 6343 factory->NewAssignment(Token::ASSIGN, mode_proxy, kreturn, nopos);
6342 set_mode_return = factory->NewExpressionStatement(assignment, nopos); 6344 set_mode_return = factory->NewExpressionStatement(assignment, nopos);
6343 } 6345 }
6344 6346
6345 // Yield(output); 6347 // Yield(output);
6346 Statement* yield_output; 6348 Statement* yield_output;
6347 { 6349 {
6348 Expression* output_proxy = factory->NewVariableProxy(var_output); 6350 Expression* output_proxy = factory->NewVariableProxy(var_output);
6349 Yield* yield = factory->NewYield(generator, output_proxy, nopos); 6351 Yield* yield = factory->NewYield(generator, output_proxy, nopos,
6352 Yield::kOnExceptionThrow);
6350 yield_output = factory->NewExpressionStatement(yield, nopos); 6353 yield_output = factory->NewExpressionStatement(yield, nopos);
6351 } 6354 }
6352 6355
6353 6356
6354 // mode = kNext; 6357 // mode = kNext;
6355 Statement* set_mode_next; 6358 Statement* set_mode_next;
6356 { 6359 {
6357 Expression* mode_proxy = factory->NewVariableProxy(var_mode); 6360 Expression* mode_proxy = factory->NewVariableProxy(var_mode);
6358 Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::kNext, nopos); 6361 Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::kNext, nopos);
6359 Expression* assignment = 6362 Expression* assignment =
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
6992 6995
6993 #ifdef DEBUG 6996 #ifdef DEBUG
6994 void Parser::Print(AstNode* node) { 6997 void Parser::Print(AstNode* node) {
6995 ast_value_factory()->Internalize(Isolate::Current()); 6998 ast_value_factory()->Internalize(Isolate::Current());
6996 node->Print(Isolate::Current()); 6999 node->Print(Isolate::Current());
6997 } 7000 }
6998 #endif // DEBUG 7001 #endif // DEBUG
6999 7002
7000 } // namespace internal 7003 } // namespace internal
7001 } // namespace v8 7004 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698