| 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/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // In this case, it'll reset the scanner using the bookmark. | 557 // In this case, it'll reset the scanner using the bookmark. |
| 558 void SkipLazyFunctionBody(int* materialized_literal_count, | 558 void SkipLazyFunctionBody(int* materialized_literal_count, |
| 559 int* expected_property_count, bool* ok, | 559 int* expected_property_count, bool* ok, |
| 560 Scanner::BookmarkScope* bookmark = nullptr); | 560 Scanner::BookmarkScope* bookmark = nullptr); |
| 561 | 561 |
| 562 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 562 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
| 563 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); | 563 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); |
| 564 | 564 |
| 565 Block* BuildParameterInitializationBlock( | 565 Block* BuildParameterInitializationBlock( |
| 566 const ParserFormalParameters& parameters, bool* ok); | 566 const ParserFormalParameters& parameters, bool* ok); |
| 567 Block* BuildRejectPromiseOnException(Block* block); | 567 Block* BuildRejectPromiseOnException(Block* block, bool* ok); |
| 568 | 568 |
| 569 // Consumes the ending }. | 569 // Consumes the ending }. |
| 570 ZoneList<Statement*>* ParseEagerFunctionBody( | 570 ZoneList<Statement*>* ParseEagerFunctionBody( |
| 571 const AstRawString* function_name, int pos, | 571 const AstRawString* function_name, int pos, |
| 572 const ParserFormalParameters& parameters, FunctionKind kind, | 572 const ParserFormalParameters& parameters, FunctionKind kind, |
| 573 FunctionLiteral::FunctionType function_type, bool* ok); | 573 FunctionLiteral::FunctionType function_type, bool* ok); |
| 574 | 574 |
| 575 void ThrowPendingError(Isolate* isolate, Handle<Script> script); | 575 void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
| 576 | 576 |
| 577 class TemplateLiteral : public ZoneObject { | 577 class TemplateLiteral : public ZoneObject { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 V8_INLINE void RewriteNonPattern(ExpressionClassifier* classifier, bool* ok); | 651 V8_INLINE void RewriteNonPattern(ExpressionClassifier* classifier, bool* ok); |
| 652 | 652 |
| 653 V8_INLINE void QueueDestructuringAssignmentForRewriting( | 653 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
| 654 Expression* assignment); | 654 Expression* assignment); |
| 655 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); | 655 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); |
| 656 | 656 |
| 657 friend class InitializerRewriter; | 657 friend class InitializerRewriter; |
| 658 void RewriteParameterInitializer(Expression* expr, Scope* scope); | 658 void RewriteParameterInitializer(Expression* expr, Scope* scope); |
| 659 | 659 |
| 660 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); | 660 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); |
| 661 Expression* BuildPromiseResolve(Expression* value, int pos); | 661 Expression* BuildResolvePromise(Expression* value, int pos); |
| 662 Expression* BuildPromiseReject(Expression* value, int pos); | 662 Expression* BuildRejectPromise(Expression* value, int pos); |
| 663 VariableProxy* BuildDotPromise(); |
| 664 VariableProxy* BuildDotDebugIsActive(); |
| 663 | 665 |
| 664 // Generic AST generator for throwing errors from compiled code. | 666 // Generic AST generator for throwing errors from compiled code. |
| 665 Expression* NewThrowError(Runtime::FunctionId function_id, | 667 Expression* NewThrowError(Runtime::FunctionId function_id, |
| 666 MessageTemplate::Template message, | 668 MessageTemplate::Template message, |
| 667 const AstRawString* arg, int pos); | 669 const AstRawString* arg, int pos); |
| 668 | 670 |
| 669 void FinalizeIteratorUse(Variable* completion, Expression* condition, | 671 void FinalizeIteratorUse(Variable* completion, Expression* condition, |
| 670 Variable* iter, Block* iterator_use, Block* result); | 672 Variable* iter, Block* iterator_use, Block* result); |
| 671 | 673 |
| 672 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, | 674 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 int size) const { | 957 int size) const { |
| 956 return new (zone()) ZoneList<v8::internal::Statement*>(size, zone()); | 958 return new (zone()) ZoneList<v8::internal::Statement*>(size, zone()); |
| 957 } | 959 } |
| 958 | 960 |
| 959 V8_INLINE void AddParameterInitializationBlock( | 961 V8_INLINE void AddParameterInitializationBlock( |
| 960 const ParserFormalParameters& parameters, | 962 const ParserFormalParameters& parameters, |
| 961 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { | 963 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { |
| 962 if (parameters.is_simple) return; | 964 if (parameters.is_simple) return; |
| 963 auto* init_block = BuildParameterInitializationBlock(parameters, ok); | 965 auto* init_block = BuildParameterInitializationBlock(parameters, ok); |
| 964 if (!*ok) return; | 966 if (!*ok) return; |
| 965 if (is_async) init_block = BuildRejectPromiseOnException(init_block); | 967 if (is_async) { |
| 968 init_block = BuildRejectPromiseOnException(init_block, ok); |
| 969 if (!*ok) return; |
| 970 } |
| 966 if (init_block != nullptr) body->Add(init_block, zone()); | 971 if (init_block != nullptr) body->Add(init_block, zone()); |
| 967 } | 972 } |
| 968 | 973 |
| 969 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters, | 974 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters, |
| 970 Expression* pattern, | 975 Expression* pattern, |
| 971 Expression* initializer, | 976 Expression* initializer, |
| 972 int initializer_end_position, | 977 int initializer_end_position, |
| 973 bool is_rest) { | 978 bool is_rest) { |
| 974 bool is_simple = pattern->IsVariableProxy() && initializer == nullptr; | 979 bool is_simple = pattern->IsVariableProxy() && initializer == nullptr; |
| 975 const AstRawString* name = is_simple | 980 const AstRawString* name = is_simple |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 static const int kLiteralTypeSlot = 0; | 1093 static const int kLiteralTypeSlot = 0; |
| 1089 static const int kElementsSlot = 1; | 1094 static const int kElementsSlot = 1; |
| 1090 | 1095 |
| 1091 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 1096 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 1092 }; | 1097 }; |
| 1093 | 1098 |
| 1094 } // namespace internal | 1099 } // namespace internal |
| 1095 } // namespace v8 | 1100 } // namespace v8 |
| 1096 | 1101 |
| 1097 #endif // V8_PARSING_PARSER_H_ | 1102 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |