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.h

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 years, 11 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/objects-printer.cc ('k') | src/parsing/parser.cc » ('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 #ifndef V8_PARSING_PARSER_H_ 5 #ifndef V8_PARSING_PARSER_H_
6 #define V8_PARSING_PARSER_H_ 6 #define V8_PARSING_PARSER_H_
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/base/compiler-specific.h" 10 #include "src/base/compiler-specific.h"
(...skipping 10 matching lines...) Expand all
21 21
22 class ScriptCompiler; 22 class ScriptCompiler;
23 23
24 namespace internal { 24 namespace internal {
25 25
26 class ParseInfo; 26 class ParseInfo;
27 class ScriptData; 27 class ScriptData;
28 class ParserTarget; 28 class ParserTarget;
29 class ParserTargetScope; 29 class ParserTargetScope;
30 30
31 enum class IteratorType { kNormal, kAsync };
32
31 class FunctionEntry BASE_EMBEDDED { 33 class FunctionEntry BASE_EMBEDDED {
32 public: 34 public:
33 enum { 35 enum {
34 kStartPositionIndex, 36 kStartPositionIndex,
35 kEndPositionIndex, 37 kEndPositionIndex,
36 kNumParametersIndex, 38 kNumParametersIndex,
37 kFunctionLengthIndex, 39 kFunctionLengthIndex,
38 kLiteralCountIndex, 40 kLiteralCountIndex,
39 kPropertyCountIndex, 41 kPropertyCountIndex,
40 kFlagsIndex, 42 kFlagsIndex,
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 Expression* current_value_; 443 Expression* current_value_;
442 int recursion_level_; 444 int recursion_level_;
443 bool* ok_; 445 bool* ok_;
444 446
445 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() 447 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW()
446 }; 448 };
447 449
448 // !%_IsJSReceiver(result = iterator.next()) && 450 // !%_IsJSReceiver(result = iterator.next()) &&
449 // %ThrowIteratorResultNotAnObject(result) 451 // %ThrowIteratorResultNotAnObject(result)
450 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, 452 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result,
451 int pos); 453 IteratorType type, int pos);
452 454
453 // Initialize the components of a for-in / for-of statement. 455 // Initialize the components of a for-in / for-of statement.
454 Statement* InitializeForEachStatement(ForEachStatement* stmt, 456 Statement* InitializeForEachStatement(ForEachStatement* stmt,
455 Expression* each, Expression* subject, 457 Expression* each, Expression* subject,
456 Statement* body, int each_keyword_pos); 458 Statement* body, int each_keyword_pos);
457 Statement* InitializeForOfStatement(ForOfStatement* stmt, Expression* each, 459 Statement* InitializeForOfStatement(ForOfStatement* stmt, Expression* each,
458 Expression* iterable, Statement* body, 460 Expression* iterable, Statement* body,
459 bool finalize, 461 bool finalize,
460 int next_result_pos = kNoSourcePosition); 462 int next_result_pos = kNoSourcePosition);
463 Statement* InitializeForAwaitOfStatement(
464 ForEachStatement* for_of, Expression* each, Expression* iterable,
465 Statement* body, bool finalize, int next_result_pos = kNoSourcePosition);
461 Block* RewriteForVarInLegacy(const ForInfo& for_info); 466 Block* RewriteForVarInLegacy(const ForInfo& for_info);
462 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block, 467 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block,
463 Expression** each_variable, bool* ok); 468 Expression** each_variable, bool* ok);
464 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info, 469 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info,
465 bool* ok); 470 bool* ok);
466 471
467 Statement* DesugarLexicalBindingsInForStatement( 472 Statement* DesugarLexicalBindingsInForStatement(
468 ForStatement* loop, Statement* init, Expression* cond, Statement* next, 473 ForStatement* loop, Statement* init, Expression* cond, Statement* next,
469 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok); 474 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok);
470 475
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 Expression* BuildRejectPromise(Expression* value, int pos); 633 Expression* BuildRejectPromise(Expression* value, int pos);
629 Variable* PromiseVariable(); 634 Variable* PromiseVariable();
630 635
631 // Generic AST generator for throwing errors from compiled code. 636 // Generic AST generator for throwing errors from compiled code.
632 Expression* NewThrowError(Runtime::FunctionId function_id, 637 Expression* NewThrowError(Runtime::FunctionId function_id,
633 MessageTemplate::Template message, 638 MessageTemplate::Template message,
634 const AstRawString* arg, int pos); 639 const AstRawString* arg, int pos);
635 640
636 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, 641 void FinalizeIteratorUse(Scope* use_scope, Variable* completion,
637 Expression* condition, Variable* iter, 642 Expression* condition, Variable* iter,
638 Block* iterator_use, Block* result); 643 Block* iterator_use, Block* result,
644 IteratorType type);
639 645
640 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, 646 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion,
641 int pos); 647 IteratorType type, int pos);
642 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, 648 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator,
643 Variable* input, Variable* output); 649 Variable* input, Variable* output, IteratorType type);
644 void BuildIteratorCloseForCompletion(Scope* scope, 650 void BuildIteratorCloseForCompletion(Scope* scope,
645 ZoneList<Statement*>* statements, 651 ZoneList<Statement*>* statements,
646 Variable* iterator, 652 Variable* iterator,
647 Expression* completion); 653 Expression* completion,
654 IteratorType type);
648 Statement* CheckCallable(Variable* var, Expression* error, int pos); 655 Statement* CheckCallable(Variable* var, Expression* error, int pos);
649 656
650 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos); 657 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos);
651 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body, 658 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body,
652 FunctionKind kind, int pos); 659 FunctionKind kind, int pos);
653 V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body, 660 V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body,
654 Block* block, 661 Block* block,
655 Expression* return_value, bool* ok); 662 Expression* return_value, bool* ok);
656 663
657 Expression* RewriteYieldStar(Expression* generator, Expression* expression, 664 Expression* RewriteYieldStar(Expression* generator, Expression* expression,
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 1181
1175 private: 1182 private:
1176 ParserTarget** variable_; 1183 ParserTarget** variable_;
1177 ParserTarget* previous_; 1184 ParserTarget* previous_;
1178 }; 1185 };
1179 1186
1180 } // namespace internal 1187 } // namespace internal
1181 } // namespace v8 1188 } // namespace v8
1182 1189
1183 #endif // V8_PARSING_PARSER_H_ 1190 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698