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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
746 ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) { | 746 ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) { |
747 return new(zone) ZoneList<v8::internal::Statement*>(size, zone); | 747 return new(zone) ZoneList<v8::internal::Statement*>(size, zone); |
748 } | 748 } |
749 ZoneList<const v8::internal::AstRawString*>* NewFormalParameterList( | 749 ZoneList<const v8::internal::AstRawString*>* NewFormalParameterList( |
750 int size, Zone* zone) { | 750 int size, Zone* zone) { |
751 return new (zone) ZoneList<const v8::internal::AstRawString*>(size, zone); | 751 return new (zone) ZoneList<const v8::internal::AstRawString*>(size, zone); |
752 } | 752 } |
753 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type, | 753 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type, |
754 FunctionKind kind = kNormalFunction); | 754 FunctionKind kind = kNormalFunction); |
755 | 755 |
756 // Utility functions | 756 void RecordArrowFunctionParameter( |
757 int DeclareArrowParametersFromExpression(Expression* expression, Scope* scope, | 757 ZoneList<const v8::internal::AstRawString*>* params, VariableProxy* proxy, |
arv (Not doing code reviews)
2015/04/13 18:26:38
Why can't this be?
ZoneList<const AstRawString*>*
| |
758 FormalParameterErrorLocations* locs, | 758 FormalParameterErrorLocations* error_locs, bool* ok); |
759 bool* ok); | 759 ZoneList<const v8::internal::AstRawString*>* |
760 ParseArrowFunctionFormalParameterList( | |
761 Expression* params, const Scanner::Location& params_loc, | |
762 FormalParameterErrorLocations* error_locs, bool* is_rest, bool* ok); | |
760 | 763 |
761 // Temporary glue; these functions will move to ParserBase. | 764 // Temporary glue; these functions will move to ParserBase. |
762 Expression* ParseV8Intrinsic(bool* ok); | 765 Expression* ParseV8Intrinsic(bool* ok); |
763 FunctionLiteral* ParseFunctionLiteral( | 766 FunctionLiteral* ParseFunctionLiteral( |
764 const AstRawString* name, Scanner::Location function_name_location, | 767 const AstRawString* name, Scanner::Location function_name_location, |
765 bool name_is_strict_reserved, FunctionKind kind, | 768 bool name_is_strict_reserved, FunctionKind kind, |
766 int function_token_position, FunctionLiteral::FunctionType type, | 769 int function_token_position, FunctionLiteral::FunctionType type, |
767 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 770 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
768 V8_INLINE void SkipLazyFunctionBody(const AstRawString* name, | 771 V8_INLINE void SkipLazyFunctionBody(const AstRawString* name, |
769 int* materialized_literal_count, | 772 int* materialized_literal_count, |
770 int* expected_property_count, bool* ok); | 773 int* expected_property_count, bool* ok); |
771 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( | 774 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
772 const AstRawString* name, int pos, Variable* fvar, | 775 const AstRawString* name, int pos, Variable* fvar, |
773 Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 776 Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
774 | 777 |
775 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 778 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
776 Scanner::Location class_name_location, | 779 Scanner::Location class_name_location, |
777 bool name_is_strict_reserved, int pos, | 780 bool name_is_strict_reserved, int pos, |
778 bool* ok); | 781 bool* ok); |
779 | 782 |
783 int DeclareFormalParameters(ZoneList<const AstRawString*>* params, | |
784 Scope* scope, bool has_rest, bool* ok); | |
785 | |
780 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, | 786 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, |
781 bool* ok); | 787 bool* ok); |
782 | 788 |
783 class TemplateLiteral : public ZoneObject { | 789 class TemplateLiteral : public ZoneObject { |
784 public: | 790 public: |
785 TemplateLiteral(Zone* zone, int pos) | 791 TemplateLiteral(Zone* zone, int pos) |
786 : cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {} | 792 : cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {} |
787 | 793 |
788 const ZoneList<Expression*>* cooked() const { return &cooked_; } | 794 const ZoneList<Expression*>* cooked() const { return &cooked_; } |
789 const ZoneList<Expression*>* raw() const { return &raw_; } | 795 const ZoneList<Expression*>* raw() const { return &raw_; } |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1046 Expression* SpreadCallNew(Expression* function, | 1052 Expression* SpreadCallNew(Expression* function, |
1047 ZoneList<v8::internal::Expression*>* args, int pos); | 1053 ZoneList<v8::internal::Expression*>* args, int pos); |
1048 | 1054 |
1049 Scanner scanner_; | 1055 Scanner scanner_; |
1050 PreParser* reusable_preparser_; | 1056 PreParser* reusable_preparser_; |
1051 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 1057 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
1052 Target* target_stack_; // for break, continue statements | 1058 Target* target_stack_; // for break, continue statements |
1053 ScriptCompiler::CompileOptions compile_options_; | 1059 ScriptCompiler::CompileOptions compile_options_; |
1054 ParseData* cached_parse_data_; | 1060 ParseData* cached_parse_data_; |
1055 | 1061 |
1056 bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions. | |
1057 | |
1058 PendingCompilationErrorHandler pending_error_handler_; | 1062 PendingCompilationErrorHandler pending_error_handler_; |
1059 | 1063 |
1060 // Other information which will be stored in Parser and moved to Isolate after | 1064 // Other information which will be stored in Parser and moved to Isolate after |
1061 // parsing. | 1065 // parsing. |
1062 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; | 1066 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; |
1063 int total_preparse_skipped_; | 1067 int total_preparse_skipped_; |
1064 HistogramTimer* pre_parse_timer_; | 1068 HistogramTimer* pre_parse_timer_; |
1065 | 1069 |
1066 bool parsing_on_main_thread_; | 1070 bool parsing_on_main_thread_; |
1067 }; | 1071 }; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1170 } | 1174 } |
1171 | 1175 |
1172 | 1176 |
1173 Expression* ParserTraits::SpreadCallNew( | 1177 Expression* ParserTraits::SpreadCallNew( |
1174 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1178 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
1175 return parser_->SpreadCallNew(function, args, pos); | 1179 return parser_->SpreadCallNew(function, args, pos); |
1176 } | 1180 } |
1177 } } // namespace v8::internal | 1181 } } // namespace v8::internal |
1178 | 1182 |
1179 #endif // V8_PARSER_H_ | 1183 #endif // V8_PARSER_H_ |
OLD | NEW |