| OLD | NEW |
| 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 546 Block* BuildRejectPromiseOnExceptionForParameters(Block* block); |
| 546 | 547 |
| 547 ZoneList<Statement*>* ParseFunction( | 548 ZoneList<Statement*>* ParseFunction( |
| 548 const AstRawString* function_name, int pos, FunctionKind kind, | 549 const AstRawString* function_name, int pos, FunctionKind kind, |
| 549 FunctionLiteral::FunctionType function_type, | 550 FunctionLiteral::FunctionType function_type, |
| 550 DeclarationScope* function_scope, int* num_parameters, | 551 DeclarationScope* function_scope, int* num_parameters, |
| 551 int* function_length, bool* has_duplicate_parameters, | 552 int* function_length, bool* has_duplicate_parameters, |
| 552 int* materialized_literal_count, int* expected_property_count, bool* ok); | 553 int* materialized_literal_count, int* expected_property_count, bool* ok); |
| 553 | 554 |
| 554 void ThrowPendingError(Isolate* isolate, Handle<Script> script); | 555 void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
| 555 | 556 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 622 |
| 622 V8_INLINE void QueueDestructuringAssignmentForRewriting( | 623 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
| 623 Expression* assignment); | 624 Expression* assignment); |
| 624 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); | 625 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); |
| 625 | 626 |
| 626 friend class InitializerRewriter; | 627 friend class InitializerRewriter; |
| 627 void RewriteParameterInitializer(Expression* expr, Scope* scope); | 628 void RewriteParameterInitializer(Expression* expr, Scope* scope); |
| 628 | 629 |
| 629 Expression* BuildInitialYield(int pos, FunctionKind kind); | 630 Expression* BuildInitialYield(int pos, FunctionKind kind); |
| 630 Assignment* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); | 631 Assignment* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); |
| 631 Expression* BuildResolvePromise(Expression* value, int pos); | 632 Expression* BuildResolvePromise(); |
| 632 Expression* BuildRejectPromise(Expression* value, int pos); | 633 Expression* BuildRejectPromise(Variable* value); |
| 633 Variable* PromiseVariable(); | 634 Variable* PromiseVariable(); |
| 635 Variable* AsyncReturnVariable(); |
| 634 | 636 |
| 635 // Generic AST generator for throwing errors from compiled code. | 637 // Generic AST generator for throwing errors from compiled code. |
| 636 Expression* NewThrowError(Runtime::FunctionId function_id, | 638 Expression* NewThrowError(Runtime::FunctionId function_id, |
| 637 MessageTemplate::Template message, | 639 MessageTemplate::Template message, |
| 638 const AstRawString* arg, int pos); | 640 const AstRawString* arg, int pos); |
| 639 | 641 |
| 640 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, | 642 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, |
| 641 Expression* condition, Variable* iter, | 643 Expression* condition, Variable* iter, |
| 642 Block* iterator_use, Block* result); | 644 Block* iterator_use, Block* result); |
| 643 | 645 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 factory()->NewThrow(exception, pos), pos); | 1037 factory()->NewThrow(exception, pos), pos); |
| 1036 } | 1038 } |
| 1037 | 1039 |
| 1038 V8_INLINE void AddParameterInitializationBlock( | 1040 V8_INLINE void AddParameterInitializationBlock( |
| 1039 const ParserFormalParameters& parameters, ZoneList<Statement*>* body, | 1041 const ParserFormalParameters& parameters, ZoneList<Statement*>* body, |
| 1040 bool is_async, bool* ok) { | 1042 bool is_async, bool* ok) { |
| 1041 if (parameters.is_simple) return; | 1043 if (parameters.is_simple) return; |
| 1042 auto* init_block = BuildParameterInitializationBlock(parameters, ok); | 1044 auto* init_block = BuildParameterInitializationBlock(parameters, ok); |
| 1043 if (!*ok) return; | 1045 if (!*ok) return; |
| 1044 if (is_async) { | 1046 if (is_async) { |
| 1045 init_block = BuildRejectPromiseOnException(init_block); | 1047 init_block = BuildRejectPromiseOnExceptionForParameters(init_block); |
| 1046 } | 1048 } |
| 1047 if (init_block != nullptr) body->Add(init_block, zone()); | 1049 if (init_block != nullptr) body->Add(init_block, zone()); |
| 1048 } | 1050 } |
| 1049 | 1051 |
| 1050 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters, | 1052 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters, |
| 1051 Expression* pattern, | 1053 Expression* pattern, |
| 1052 Expression* initializer, | 1054 Expression* initializer, |
| 1053 int initializer_end_position, | 1055 int initializer_end_position, |
| 1054 bool is_rest) { | 1056 bool is_rest) { |
| 1055 parameters->UpdateArityAndFunctionLength(initializer != nullptr, is_rest); | 1057 parameters->UpdateArityAndFunctionLength(initializer != nullptr, is_rest); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 | 1193 |
| 1192 private: | 1194 private: |
| 1193 ParserTarget** variable_; | 1195 ParserTarget** variable_; |
| 1194 ParserTarget* previous_; | 1196 ParserTarget* previous_; |
| 1195 }; | 1197 }; |
| 1196 | 1198 |
| 1197 } // namespace internal | 1199 } // namespace internal |
| 1198 } // namespace v8 | 1200 } // namespace v8 |
| 1199 | 1201 |
| 1200 #endif // V8_PARSING_PARSER_H_ | 1202 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |