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