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" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 V8_INLINE void AddTemplateSpan(TemplateLiteralState* state, bool tail); | 622 V8_INLINE void AddTemplateSpan(TemplateLiteralState* state, bool tail); |
623 V8_INLINE void AddTemplateExpression(TemplateLiteralState* state, | 623 V8_INLINE void AddTemplateExpression(TemplateLiteralState* state, |
624 Expression* expression); | 624 Expression* expression); |
625 V8_INLINE Expression* CloseTemplateLiteral(TemplateLiteralState* state, | 625 V8_INLINE Expression* CloseTemplateLiteral(TemplateLiteralState* state, |
626 int start, Expression* tag); | 626 int start, Expression* tag); |
627 V8_INLINE Expression* NoTemplateTag() { return NULL; } | 627 V8_INLINE Expression* NoTemplateTag() { return NULL; } |
628 V8_INLINE static bool IsTaggedTemplate(const Expression* tag) { | 628 V8_INLINE static bool IsTaggedTemplate(const Expression* tag) { |
629 return tag != NULL; | 629 return tag != NULL; |
630 } | 630 } |
631 | 631 |
| 632 V8_INLINE ZoneList<v8::internal::Expression*>* PrepareSpreadCallArguments( |
| 633 Expression* function, ZoneList<v8::internal::Expression*>* list); |
| 634 V8_INLINE ZoneList<v8::internal::Expression*>* PrepareSpreadCallNewArguments( |
| 635 Expression* function, ZoneList<v8::internal::Expression*>* list); |
| 636 |
632 private: | 637 private: |
633 Parser* parser_; | 638 Parser* parser_; |
634 }; | 639 }; |
635 | 640 |
636 | 641 |
637 class Parser : public ParserBase<ParserTraits> { | 642 class Parser : public ParserBase<ParserTraits> { |
638 public: | 643 public: |
639 Parser(CompilationInfo* info, uintptr_t stack_limit, uint32_t hash_seed, | 644 Parser(CompilationInfo* info, uintptr_t stack_limit, uint32_t hash_seed, |
640 UnicodeCache* unicode_cache); | 645 UnicodeCache* unicode_cache); |
641 ~Parser() { | 646 ~Parser() { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 void ThrowPendingError(Isolate* isolate, Handle<Script> script); | 835 void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
831 | 836 |
832 TemplateLiteralState OpenTemplateLiteral(int pos); | 837 TemplateLiteralState OpenTemplateLiteral(int pos); |
833 void AddTemplateSpan(TemplateLiteralState* state, bool tail); | 838 void AddTemplateSpan(TemplateLiteralState* state, bool tail); |
834 void AddTemplateExpression(TemplateLiteralState* state, | 839 void AddTemplateExpression(TemplateLiteralState* state, |
835 Expression* expression); | 840 Expression* expression); |
836 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, | 841 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, |
837 Expression* tag); | 842 Expression* tag); |
838 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); | 843 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); |
839 | 844 |
| 845 ZoneList<v8::internal::Expression*>* PrepareSpreadCallArguments( |
| 846 Expression* function, ZoneList<v8::internal::Expression*>* list); |
| 847 ZoneList<v8::internal::Expression*>* PrepareSpreadCallNewArguments( |
| 848 Expression* function, ZoneList<v8::internal::Expression*>* list); |
| 849 |
840 Scanner scanner_; | 850 Scanner scanner_; |
841 PreParser* reusable_preparser_; | 851 PreParser* reusable_preparser_; |
842 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 852 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
843 Target* target_stack_; // for break, continue statements | 853 Target* target_stack_; // for break, continue statements |
844 ScriptCompiler::CompileOptions compile_options_; | 854 ScriptCompiler::CompileOptions compile_options_; |
845 ParseData* cached_parse_data_; | 855 ParseData* cached_parse_data_; |
846 | 856 |
847 bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions. | 857 bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions. |
848 | 858 |
849 // Pending errors. | 859 // Pending errors. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 void ParserTraits::AddTemplateExpression(TemplateLiteralState* state, | 955 void ParserTraits::AddTemplateExpression(TemplateLiteralState* state, |
946 Expression* expression) { | 956 Expression* expression) { |
947 parser_->AddTemplateExpression(state, expression); | 957 parser_->AddTemplateExpression(state, expression); |
948 } | 958 } |
949 | 959 |
950 | 960 |
951 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 961 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
952 int start, Expression* tag) { | 962 int start, Expression* tag) { |
953 return parser_->CloseTemplateLiteral(state, start, tag); | 963 return parser_->CloseTemplateLiteral(state, start, tag); |
954 } | 964 } |
| 965 |
| 966 |
| 967 ZoneList<v8::internal::Expression*>* ParserTraits::PrepareSpreadCallArguments( |
| 968 Expression* function, ZoneList<v8::internal::Expression*>* list) { |
| 969 return parser_->PrepareSpreadCallArguments(function, list); |
| 970 } |
| 971 |
| 972 |
| 973 ZoneList<v8::internal::Expression*>* |
| 974 ParserTraits::PrepareSpreadCallNewArguments( |
| 975 Expression* function, ZoneList<v8::internal::Expression*>* list) { |
| 976 return parser_->PrepareSpreadCallNewArguments(function, list); |
| 977 } |
955 } } // namespace v8::internal | 978 } } // namespace v8::internal |
956 | 979 |
957 #endif // V8_PARSER_H_ | 980 #endif // V8_PARSER_H_ |
OLD | NEW |