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

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

Issue 2672313003: [async await] fix async await desugaring
Patch Set: refactor Created 3 years, 10 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 | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/parser.cc » ('J')
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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // If may_abort == true, the (pre-)parser may decide to abort skipping 535 // If may_abort == true, the (pre-)parser may decide to abort skipping
536 // in order to force the function to be eagerly parsed, after all. 536 // in order to force the function to be eagerly parsed, after all.
537 LazyParsingResult SkipFunction( 537 LazyParsingResult SkipFunction(
538 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, 538 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters,
539 int* function_length, bool* has_duplicate_parameters, 539 int* function_length, bool* has_duplicate_parameters,
540 int* materialized_literal_count, int* expected_property_count, 540 int* materialized_literal_count, int* expected_property_count,
541 bool is_inner_function, bool may_abort, bool* ok); 541 bool is_inner_function, bool may_abort, bool* ok);
542 542
543 Block* BuildParameterInitializationBlock( 543 Block* BuildParameterInitializationBlock(
544 const ParserFormalParameters& parameters, bool* ok); 544 const ParserFormalParameters& parameters, bool* ok);
545 Block* BuildRejectPromiseOnException(Block* block); 545 Block* BuildRejectPromiseOnException(Block* block);
neis 2017/02/08 10:28:41 I find it a bit confusing to have both foo(T) and
gsathya 2017/02/09 00:55:45 There are no longer two functions with the same na
546 Block* BuildRejectPromiseOnExceptionForParameters(Block* block);
547 Block* BuildRejectPromiseOnException(Block* block, bool do_return_promise);
neis 2017/02/08 10:28:41 Please keep the argument name in sync with the one
gsathya 2017/02/09 00:55:45 Done.
546 548
547 ZoneList<Statement*>* ParseFunction( 549 ZoneList<Statement*>* ParseFunction(
548 const AstRawString* function_name, int pos, FunctionKind kind, 550 const AstRawString* function_name, int pos, FunctionKind kind,
549 FunctionLiteral::FunctionType function_type, 551 FunctionLiteral::FunctionType function_type,
550 DeclarationScope* function_scope, int* num_parameters, 552 DeclarationScope* function_scope, int* num_parameters,
551 int* function_length, bool* has_duplicate_parameters, 553 int* function_length, bool* has_duplicate_parameters,
552 int* materialized_literal_count, int* expected_property_count, bool* ok); 554 int* materialized_literal_count, int* expected_property_count, bool* ok);
553 555
554 void ThrowPendingError(Isolate* isolate, Handle<Script> script); 556 void ThrowPendingError(Isolate* isolate, Handle<Script> script);
555 557
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 623
622 V8_INLINE void QueueDestructuringAssignmentForRewriting( 624 V8_INLINE void QueueDestructuringAssignmentForRewriting(
623 Expression* assignment); 625 Expression* assignment);
624 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); 626 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok);
625 627
626 friend class InitializerRewriter; 628 friend class InitializerRewriter;
627 void RewriteParameterInitializer(Expression* expr, Scope* scope); 629 void RewriteParameterInitializer(Expression* expr, Scope* scope);
628 630
629 Expression* BuildInitialYield(int pos, FunctionKind kind); 631 Expression* BuildInitialYield(int pos, FunctionKind kind);
630 Assignment* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); 632 Assignment* BuildCreateJSGeneratorObject(int pos, FunctionKind kind);
631 Expression* BuildResolvePromise(Expression* value, int pos); 633 Expression* BuildResolvePromise();
632 Expression* BuildRejectPromise(Expression* value, int pos); 634 Expression* BuildRejectPromise();
633 Variable* PromiseVariable(); 635 Variable* PromiseVariable();
636 Variable* AsyncReturnVariable();
634 637
635 // Generic AST generator for throwing errors from compiled code. 638 // Generic AST generator for throwing errors from compiled code.
636 Expression* NewThrowError(Runtime::FunctionId function_id, 639 Expression* NewThrowError(Runtime::FunctionId function_id,
637 MessageTemplate::Template message, 640 MessageTemplate::Template message,
638 const AstRawString* arg, int pos); 641 const AstRawString* arg, int pos);
639 642
640 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, 643 void FinalizeIteratorUse(Scope* use_scope, Variable* completion,
641 Expression* condition, Variable* iter, 644 Expression* condition, Variable* iter,
642 Block* iterator_use, Block* result); 645 Block* iterator_use, Block* result);
643 646
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 factory()->NewThrow(exception, pos), pos); 1038 factory()->NewThrow(exception, pos), pos);
1036 } 1039 }
1037 1040
1038 V8_INLINE void AddParameterInitializationBlock( 1041 V8_INLINE void AddParameterInitializationBlock(
1039 const ParserFormalParameters& parameters, ZoneList<Statement*>* body, 1042 const ParserFormalParameters& parameters, ZoneList<Statement*>* body,
1040 bool is_async, bool* ok) { 1043 bool is_async, bool* ok) {
1041 if (parameters.is_simple) return; 1044 if (parameters.is_simple) return;
1042 auto* init_block = BuildParameterInitializationBlock(parameters, ok); 1045 auto* init_block = BuildParameterInitializationBlock(parameters, ok);
1043 if (!*ok) return; 1046 if (!*ok) return;
1044 if (is_async) { 1047 if (is_async) {
1045 init_block = BuildRejectPromiseOnException(init_block); 1048 init_block = BuildRejectPromiseOnExceptionForParameters(init_block);
1046 } 1049 }
1047 if (init_block != nullptr) body->Add(init_block, zone()); 1050 if (init_block != nullptr) body->Add(init_block, zone());
1048 } 1051 }
1049 1052
1050 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters, 1053 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters,
1051 Expression* pattern, 1054 Expression* pattern,
1052 Expression* initializer, 1055 Expression* initializer,
1053 int initializer_end_position, 1056 int initializer_end_position,
1054 bool is_rest) { 1057 bool is_rest) {
1055 parameters->UpdateArityAndFunctionLength(initializer != nullptr, is_rest); 1058 parameters->UpdateArityAndFunctionLength(initializer != nullptr, is_rest);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 1194
1192 private: 1195 private:
1193 ParserTarget** variable_; 1196 ParserTarget** variable_;
1194 ParserTarget* previous_; 1197 ParserTarget* previous_;
1195 }; 1198 };
1196 1199
1197 } // namespace internal 1200 } // namespace internal
1198 } // namespace v8 1201 } // namespace v8
1199 1202
1200 #endif // V8_PARSING_PARSER_H_ 1203 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698