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

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

Issue 1865833002: [generators] Decouple generator resume from fullcodegen. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
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 5767 matching lines...) Expand 10 before | Expand all | Expand 10 after
5778 Token::ASSIGN, input_proxy, factory->NewUndefinedLiteral(nopos), nopos); 5778 Token::ASSIGN, input_proxy, factory->NewUndefinedLiteral(nopos), nopos);
5779 initialize_input = factory->NewExpressionStatement(assignment, nopos); 5779 initialize_input = factory->NewExpressionStatement(assignment, nopos);
5780 } 5780 }
5781 5781
5782 5782
5783 // let mode = kNext; 5783 // let mode = kNext;
5784 Variable* var_mode = scope->NewTemporary(avfactory->empty_string()); 5784 Variable* var_mode = scope->NewTemporary(avfactory->empty_string());
5785 Statement* initialize_mode; 5785 Statement* initialize_mode;
5786 { 5786 {
5787 Expression* mode_proxy = factory->NewVariableProxy(var_mode); 5787 Expression* mode_proxy = factory->NewVariableProxy(var_mode);
5788 Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::NEXT, nopos); 5788 Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::kNext, nopos);
5789 Expression* assignment = 5789 Expression* assignment =
5790 factory->NewAssignment(Token::ASSIGN, mode_proxy, knext, nopos); 5790 factory->NewAssignment(Token::ASSIGN, mode_proxy, knext, nopos);
5791 initialize_mode = factory->NewExpressionStatement(assignment, nopos); 5791 initialize_mode = factory->NewExpressionStatement(assignment, nopos);
5792 } 5792 }
5793 5793
5794 5794
5795 // let output = undefined; 5795 // let output = undefined;
5796 Variable* var_output = scope->NewTemporary(avfactory->empty_string()); 5796 Variable* var_output = scope->NewTemporary(avfactory->empty_string());
5797 Statement* initialize_output; 5797 Statement* initialize_output;
5798 { 5798 {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
5976 if_done = factory->NewIfStatement( 5976 if_done = factory->NewIfStatement(
5977 property, break_loop, factory->NewEmptyStatement(nopos), nopos); 5977 property, break_loop, factory->NewEmptyStatement(nopos), nopos);
5978 } 5978 }
5979 5979
5980 5980
5981 // mode = kReturn; 5981 // mode = kReturn;
5982 Statement* set_mode_return; 5982 Statement* set_mode_return;
5983 { 5983 {
5984 Expression* mode_proxy = factory->NewVariableProxy(var_mode); 5984 Expression* mode_proxy = factory->NewVariableProxy(var_mode);
5985 Expression* kreturn = 5985 Expression* kreturn =
5986 factory->NewSmiLiteral(JSGeneratorObject::RETURN, nopos); 5986 factory->NewSmiLiteral(JSGeneratorObject::kReturn, nopos);
5987 Expression* assignment = 5987 Expression* assignment =
5988 factory->NewAssignment(Token::ASSIGN, mode_proxy, kreturn, nopos); 5988 factory->NewAssignment(Token::ASSIGN, mode_proxy, kreturn, nopos);
5989 set_mode_return = factory->NewExpressionStatement(assignment, nopos); 5989 set_mode_return = factory->NewExpressionStatement(assignment, nopos);
5990 } 5990 }
5991 5991
5992 // Yield(output); 5992 // Yield(output);
5993 Statement* yield_output; 5993 Statement* yield_output;
5994 { 5994 {
5995 Expression* output_proxy = factory->NewVariableProxy(var_output); 5995 Expression* output_proxy = factory->NewVariableProxy(var_output);
5996 Yield* yield = factory->NewYield(generator, output_proxy, nopos); 5996 Yield* yield = factory->NewYield(generator, output_proxy, nopos);
5997 yield_output = factory->NewExpressionStatement(yield, nopos); 5997 yield_output = factory->NewExpressionStatement(yield, nopos);
5998 } 5998 }
5999 5999
6000 6000
6001 // mode = kNext; 6001 // mode = kNext;
6002 Statement* set_mode_next; 6002 Statement* set_mode_next;
6003 { 6003 {
6004 Expression* mode_proxy = factory->NewVariableProxy(var_mode); 6004 Expression* mode_proxy = factory->NewVariableProxy(var_mode);
6005 Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::NEXT, nopos); 6005 Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::kNext, nopos);
6006 Expression* assignment = 6006 Expression* assignment =
6007 factory->NewAssignment(Token::ASSIGN, mode_proxy, knext, nopos); 6007 factory->NewAssignment(Token::ASSIGN, mode_proxy, knext, nopos);
6008 set_mode_next = factory->NewExpressionStatement(assignment, nopos); 6008 set_mode_next = factory->NewExpressionStatement(assignment, nopos);
6009 } 6009 }
6010 6010
6011 6011
6012 // mode = kThrow; 6012 // mode = kThrow;
6013 Statement* set_mode_throw; 6013 Statement* set_mode_throw;
6014 { 6014 {
6015 Expression* mode_proxy = factory->NewVariableProxy(var_mode); 6015 Expression* mode_proxy = factory->NewVariableProxy(var_mode);
6016 Expression* kthrow = 6016 Expression* kthrow =
6017 factory->NewSmiLiteral(JSGeneratorObject::THROW, nopos); 6017 factory->NewSmiLiteral(JSGeneratorObject::kThrow, nopos);
6018 Expression* assignment = 6018 Expression* assignment =
6019 factory->NewAssignment(Token::ASSIGN, mode_proxy, kthrow, nopos); 6019 factory->NewAssignment(Token::ASSIGN, mode_proxy, kthrow, nopos);
6020 set_mode_throw = factory->NewExpressionStatement(assignment, nopos); 6020 set_mode_throw = factory->NewExpressionStatement(assignment, nopos);
6021 } 6021 }
6022 6022
6023 6023
6024 // input = function.sent; 6024 // input = function.sent;
6025 Statement* get_input; 6025 Statement* get_input;
6026 { 6026 {
6027 Expression* function_sent = FunctionSentExpression(scope, factory, nopos); 6027 Expression* function_sent = FunctionSentExpression(scope, factory, nopos);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
6095 case_return->Add(factory->NewBreakStatement(switch_mode, nopos), zone); 6095 case_return->Add(factory->NewBreakStatement(switch_mode, nopos), zone);
6096 6096
6097 auto case_throw = new (zone) ZoneList<Statement*>(5, zone); 6097 auto case_throw = new (zone) ZoneList<Statement*>(5, zone);
6098 case_throw->Add(get_throw, zone); 6098 case_throw->Add(get_throw, zone);
6099 case_throw->Add(check_throw, zone); 6099 case_throw->Add(check_throw, zone);
6100 case_throw->Add(call_throw, zone); 6100 case_throw->Add(call_throw, zone);
6101 case_throw->Add(validate_throw_output, zone); 6101 case_throw->Add(validate_throw_output, zone);
6102 case_throw->Add(factory->NewBreakStatement(switch_mode, nopos), zone); 6102 case_throw->Add(factory->NewBreakStatement(switch_mode, nopos), zone);
6103 6103
6104 auto cases = new (zone) ZoneList<CaseClause*>(3, zone); 6104 auto cases = new (zone) ZoneList<CaseClause*>(3, zone);
6105 Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::NEXT, nopos); 6105 Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::kNext, nopos);
6106 Expression* kreturn = 6106 Expression* kreturn =
6107 factory->NewSmiLiteral(JSGeneratorObject::RETURN, nopos); 6107 factory->NewSmiLiteral(JSGeneratorObject::kReturn, nopos);
6108 Expression* kthrow = 6108 Expression* kthrow =
6109 factory->NewSmiLiteral(JSGeneratorObject::THROW, nopos); 6109 factory->NewSmiLiteral(JSGeneratorObject::kThrow, nopos);
6110 cases->Add(factory->NewCaseClause(knext, case_next, nopos), zone); 6110 cases->Add(factory->NewCaseClause(knext, case_next, nopos), zone);
6111 cases->Add(factory->NewCaseClause(kreturn, case_return, nopos), zone); 6111 cases->Add(factory->NewCaseClause(kreturn, case_return, nopos), zone);
6112 cases->Add(factory->NewCaseClause(kthrow, case_throw, nopos), zone); 6112 cases->Add(factory->NewCaseClause(kthrow, case_throw, nopos), zone);
6113 6113
6114 switch_mode->Initialize(factory->NewVariableProxy(var_mode), cases); 6114 switch_mode->Initialize(factory->NewVariableProxy(var_mode), cases);
6115 } 6115 }
6116 6116
6117 6117
6118 // while (true) { ... } 6118 // while (true) { ... }
6119 // Already defined earlier: WhileStatement* loop = ... 6119 // Already defined earlier: WhileStatement* loop = ...
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
6869 try_block, target); 6869 try_block, target);
6870 final_loop = target; 6870 final_loop = target;
6871 } 6871 }
6872 6872
6873 return final_loop; 6873 return final_loop;
6874 } 6874 }
6875 6875
6876 6876
6877 } // namespace internal 6877 } // namespace internal
6878 } // namespace v8 6878 } // namespace v8
OLDNEW
« src/deoptimizer.cc ('K') | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698