| 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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
| 6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast.h" | 9 #include "src/ast.h" |
| 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency | 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 | 747 |
| 748 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, | 748 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, |
| 749 int pos = RelocInfo::kNoPosition); | 749 int pos = RelocInfo::kNoPosition); |
| 750 Expression* SuperPropertyReference(Scope* scope, AstNodeFactory* factory, | 750 Expression* SuperPropertyReference(Scope* scope, AstNodeFactory* factory, |
| 751 int pos); | 751 int pos); |
| 752 Expression* SuperCallReference(Scope* scope, AstNodeFactory* factory, | 752 Expression* SuperCallReference(Scope* scope, AstNodeFactory* factory, |
| 753 int pos); | 753 int pos); |
| 754 Expression* NewTargetExpression(Scope* scope, AstNodeFactory* factory, | 754 Expression* NewTargetExpression(Scope* scope, AstNodeFactory* factory, |
| 755 int pos); | 755 int pos); |
| 756 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, | 756 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, |
| 757 int end_pos); | 757 int end_pos, LanguageMode language_mode); |
| 758 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, | 758 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, |
| 759 AstNodeFactory* factory); | 759 AstNodeFactory* factory); |
| 760 Expression* ExpressionFromIdentifier(const AstRawString* name, | 760 Expression* ExpressionFromIdentifier(const AstRawString* name, |
| 761 int start_position, int end_position, | 761 int start_position, int end_position, |
| 762 Scope* scope, AstNodeFactory* factory); | 762 Scope* scope, AstNodeFactory* factory); |
| 763 Expression* ExpressionFromString(int pos, Scanner* scanner, | 763 Expression* ExpressionFromString(int pos, Scanner* scanner, |
| 764 AstNodeFactory* factory); | 764 AstNodeFactory* factory); |
| 765 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory); | 765 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory); |
| 766 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { | 766 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { |
| 767 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); | 767 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 789 bool* ok); | 789 bool* ok); |
| 790 | 790 |
| 791 void ReindexLiterals(const ParserFormalParameterParsingState& parsing_state); | 791 void ReindexLiterals(const ParserFormalParameterParsingState& parsing_state); |
| 792 | 792 |
| 793 // Temporary glue; these functions will move to ParserBase. | 793 // Temporary glue; these functions will move to ParserBase. |
| 794 Expression* ParseV8Intrinsic(bool* ok); | 794 Expression* ParseV8Intrinsic(bool* ok); |
| 795 FunctionLiteral* ParseFunctionLiteral( | 795 FunctionLiteral* ParseFunctionLiteral( |
| 796 const AstRawString* name, Scanner::Location function_name_location, | 796 const AstRawString* name, Scanner::Location function_name_location, |
| 797 FunctionNameValidity function_name_validity, FunctionKind kind, | 797 FunctionNameValidity function_name_validity, FunctionKind kind, |
| 798 int function_token_position, FunctionLiteral::FunctionType type, | 798 int function_token_position, FunctionLiteral::FunctionType type, |
| 799 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 799 FunctionLiteral::ArityRestriction arity_restriction, |
| 800 LanguageMode language_mode, bool* ok); |
| 800 V8_INLINE void SkipLazyFunctionBody( | 801 V8_INLINE void SkipLazyFunctionBody( |
| 801 int* materialized_literal_count, int* expected_property_count, bool* ok, | 802 int* materialized_literal_count, int* expected_property_count, bool* ok, |
| 802 Scanner::BookmarkScope* bookmark = nullptr); | 803 Scanner::BookmarkScope* bookmark = nullptr); |
| 803 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( | 804 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
| 804 const AstRawString* name, int pos, | 805 const AstRawString* name, int pos, |
| 805 const ParserFormalParameterParsingState& formal_parameters, | 806 const ParserFormalParameterParsingState& formal_parameters, |
| 806 Variable* fvar, Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 807 Variable* fvar, Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
| 807 | 808 |
| 808 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 809 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
| 809 Scanner::Location class_name_location, | 810 Scanner::Location class_name_location, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 Statement* body); | 1092 Statement* body); |
| 1092 Statement* DesugarLexicalBindingsInForStatement( | 1093 Statement* DesugarLexicalBindingsInForStatement( |
| 1093 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, | 1094 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, |
| 1094 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 1095 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
| 1095 Statement* body, bool* ok); | 1096 Statement* body, bool* ok); |
| 1096 | 1097 |
| 1097 FunctionLiteral* ParseFunctionLiteral( | 1098 FunctionLiteral* ParseFunctionLiteral( |
| 1098 const AstRawString* name, Scanner::Location function_name_location, | 1099 const AstRawString* name, Scanner::Location function_name_location, |
| 1099 FunctionNameValidity function_name_validity, FunctionKind kind, | 1100 FunctionNameValidity function_name_validity, FunctionKind kind, |
| 1100 int function_token_position, FunctionLiteral::FunctionType type, | 1101 int function_token_position, FunctionLiteral::FunctionType type, |
| 1101 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 1102 FunctionLiteral::ArityRestriction arity_restriction, |
| 1103 LanguageMode language_mode, bool* ok); |
| 1102 | 1104 |
| 1103 | 1105 |
| 1104 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 1106 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
| 1105 Scanner::Location class_name_location, | 1107 Scanner::Location class_name_location, |
| 1106 bool name_is_strict_reserved, int pos, | 1108 bool name_is_strict_reserved, int pos, |
| 1107 bool* ok); | 1109 bool* ok); |
| 1108 | 1110 |
| 1109 // Magical syntax support. | 1111 // Magical syntax support. |
| 1110 Expression* ParseV8Intrinsic(bool* ok); | 1112 Expression* ParseV8Intrinsic(bool* ok); |
| 1111 | 1113 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1131 | 1133 |
| 1132 bool TargetStackContainsLabel(const AstRawString* label); | 1134 bool TargetStackContainsLabel(const AstRawString* label); |
| 1133 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); | 1135 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); |
| 1134 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); | 1136 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); |
| 1135 | 1137 |
| 1136 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); | 1138 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); |
| 1137 Statement* BuildAssertIsCoercible(Variable* var); | 1139 Statement* BuildAssertIsCoercible(Variable* var); |
| 1138 | 1140 |
| 1139 // Factory methods. | 1141 // Factory methods. |
| 1140 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, | 1142 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, |
| 1141 int end_pos); | 1143 int end_pos, LanguageMode language_mode); |
| 1142 | 1144 |
| 1143 // Skip over a lazy function, either using cached data if we have it, or | 1145 // Skip over a lazy function, either using cached data if we have it, or |
| 1144 // by parsing the function with PreParser. Consumes the ending }. | 1146 // by parsing the function with PreParser. Consumes the ending }. |
| 1145 // | 1147 // |
| 1146 // If bookmark is set, the (pre-)parser may decide to abort skipping | 1148 // If bookmark is set, the (pre-)parser may decide to abort skipping |
| 1147 // in order to force the function to be eagerly parsed, after all. | 1149 // in order to force the function to be eagerly parsed, after all. |
| 1148 // In this case, it'll reset the scanner using the bookmark. | 1150 // In this case, it'll reset the scanner using the bookmark. |
| 1149 void SkipLazyFunctionBody(int* materialized_literal_count, | 1151 void SkipLazyFunctionBody(int* materialized_literal_count, |
| 1150 int* expected_property_count, bool* ok, | 1152 int* expected_property_count, bool* ok, |
| 1151 Scanner::BookmarkScope* bookmark = nullptr); | 1153 Scanner::BookmarkScope* bookmark = nullptr); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 auto* init_block = | 1341 auto* init_block = |
| 1340 parser_->BuildParameterInitializationBlock(formal_parameters, ok); | 1342 parser_->BuildParameterInitializationBlock(formal_parameters, ok); |
| 1341 if (!*ok) return; | 1343 if (!*ok) return; |
| 1342 if (init_block != nullptr) { | 1344 if (init_block != nullptr) { |
| 1343 body->Add(init_block, parser_->zone()); | 1345 body->Add(init_block, parser_->zone()); |
| 1344 } | 1346 } |
| 1345 } | 1347 } |
| 1346 } } // namespace v8::internal | 1348 } } // namespace v8::internal |
| 1347 | 1349 |
| 1348 #endif // V8_PARSER_H_ | 1350 #endif // V8_PARSER_H_ |
| OLD | NEW |