| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 return true; | 675 return true; |
| 676 } | 676 } |
| 677 return false; | 677 return false; |
| 678 } | 678 } |
| 679 bool Parse(); | 679 bool Parse(); |
| 680 void ParseOnBackground(); | 680 void ParseOnBackground(); |
| 681 | 681 |
| 682 // Handle errors detected during parsing, move statistics to Isolate, | 682 // Handle errors detected during parsing, move statistics to Isolate, |
| 683 // internalize strings (move them to the heap). | 683 // internalize strings (move them to the heap). |
| 684 void Internalize(); | 684 void Internalize(); |
| 685 void HandleSourceURLComments(); |
| 685 | 686 |
| 686 private: | 687 private: |
| 687 friend class ParserTraits; | 688 friend class ParserTraits; |
| 688 | 689 |
| 689 // Limit the allowed number of local variables in a function. The hard limit | 690 // Limit the allowed number of local variables in a function. The hard limit |
| 690 // is that offsets computed by FullCodeGenerator::StackOperand and similar | 691 // is that offsets computed by FullCodeGenerator::StackOperand and similar |
| 691 // functions are ints, and they should not overflow. In addition, accessing | 692 // functions are ints, and they should not overflow. In addition, accessing |
| 692 // local variables creates user-controlled constants in the generated code, | 693 // local variables creates user-controlled constants in the generated code, |
| 693 // and we don't want too much user-controlled memory inside the code (this was | 694 // and we don't want too much user-controlled memory inside the code (this was |
| 694 // the reason why this limit was introduced in the first place; see | 695 // the reason why this limit was introduced in the first place; see |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 bool* ok); | 873 bool* ok); |
| 873 | 874 |
| 874 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 875 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
| 875 SingletonLogger* logger); | 876 SingletonLogger* logger); |
| 876 | 877 |
| 877 // Consumes the ending }. | 878 // Consumes the ending }. |
| 878 ZoneList<Statement*>* ParseEagerFunctionBody( | 879 ZoneList<Statement*>* ParseEagerFunctionBody( |
| 879 const AstRawString* function_name, int pos, Variable* fvar, | 880 const AstRawString* function_name, int pos, Variable* fvar, |
| 880 Token::Value fvar_init_op, bool is_generator, bool* ok); | 881 Token::Value fvar_init_op, bool is_generator, bool* ok); |
| 881 | 882 |
| 882 void HandleSourceURLComments(); | |
| 883 | |
| 884 void ThrowPendingError(); | 883 void ThrowPendingError(); |
| 885 | 884 |
| 886 TemplateLiteralState OpenTemplateLiteral(int pos); | 885 TemplateLiteralState OpenTemplateLiteral(int pos); |
| 887 void AddTemplateSpan(TemplateLiteralState* state, bool tail); | 886 void AddTemplateSpan(TemplateLiteralState* state, bool tail); |
| 888 void AddTemplateExpression(TemplateLiteralState* state, | 887 void AddTemplateExpression(TemplateLiteralState* state, |
| 889 Expression* expression); | 888 Expression* expression); |
| 890 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, | 889 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, |
| 891 Expression* tag); | 890 Expression* tag); |
| 892 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); | 891 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); |
| 893 | 892 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 } | 1002 } |
| 1004 | 1003 |
| 1005 | 1004 |
| 1006 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 1005 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
| 1007 int start, Expression* tag) { | 1006 int start, Expression* tag) { |
| 1008 return parser_->CloseTemplateLiteral(state, start, tag); | 1007 return parser_->CloseTemplateLiteral(state, start, tag); |
| 1009 } | 1008 } |
| 1010 } } // namespace v8::internal | 1009 } } // namespace v8::internal |
| 1011 | 1010 |
| 1012 #endif // V8_PARSER_H_ | 1011 #endif // V8_PARSER_H_ |
| OLD | NEW |