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