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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 Isolate* isolate() { return isolate_; } | 635 Isolate* isolate() { return isolate_; } |
636 CompilationInfo* info() const { return info_; } | 636 CompilationInfo* info() const { return info_; } |
637 | 637 |
638 // Called by ParseProgram after setting up the scanner. | 638 // Called by ParseProgram after setting up the scanner. |
639 FunctionLiteral* DoParseProgram(CompilationInfo* info, | 639 FunctionLiteral* DoParseProgram(CompilationInfo* info, |
640 Handle<String> source); | 640 Handle<String> source); |
641 | 641 |
642 void SetCachedData(); | 642 void SetCachedData(); |
643 | 643 |
644 bool inside_with() const { return scope_->inside_with(); } | 644 bool inside_with() const { return scope_->inside_with(); } |
645 CachedDataMode cached_data_mode() const { return info_->cached_data_mode(); } | 645 ScriptCompiler::CompileOptions compile_options() const { |
| 646 return info_->compile_options(); |
| 647 } |
646 Scope* DeclarationScope(VariableMode mode) { | 648 Scope* DeclarationScope(VariableMode mode) { |
647 return IsLexicalVariableMode(mode) | 649 return IsLexicalVariableMode(mode) |
648 ? scope_ : scope_->DeclarationScope(); | 650 ? scope_ : scope_->DeclarationScope(); |
649 } | 651 } |
650 | 652 |
651 // All ParseXXX functions take as the last argument an *ok parameter | 653 // All ParseXXX functions take as the last argument an *ok parameter |
652 // which is set to false if parsing failed; it is unchanged otherwise. | 654 // which is set to false if parsing failed; it is unchanged otherwise. |
653 // By making the 'exception handling' explicit, we are forced to check | 655 // By making the 'exception handling' explicit, we are forced to check |
654 // for failure at the call sites. | 656 // for failure at the call sites. |
655 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token, | 657 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 void InternalizeUseCounts(); | 785 void InternalizeUseCounts(); |
784 | 786 |
785 Isolate* isolate_; | 787 Isolate* isolate_; |
786 | 788 |
787 Handle<Script> script_; | 789 Handle<Script> script_; |
788 Scanner scanner_; | 790 Scanner scanner_; |
789 PreParser* reusable_preparser_; | 791 PreParser* reusable_preparser_; |
790 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 792 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
791 Target* target_stack_; // for break, continue statements | 793 Target* target_stack_; // for break, continue statements |
792 ParseData* cached_parse_data_; | 794 ParseData* cached_parse_data_; |
793 CachedDataMode cached_data_mode_; | |
794 AstValueFactory* ast_value_factory_; | 795 AstValueFactory* ast_value_factory_; |
795 | 796 |
796 CompilationInfo* info_; | 797 CompilationInfo* info_; |
797 | 798 |
798 // Pending errors. | 799 // Pending errors. |
799 bool has_pending_error_; | 800 bool has_pending_error_; |
800 Scanner::Location pending_error_location_; | 801 Scanner::Location pending_error_location_; |
801 const char* pending_error_message_; | 802 const char* pending_error_message_; |
802 const AstRawString* pending_error_arg_; | 803 const AstRawString* pending_error_arg_; |
803 const char* pending_error_char_arg_; | 804 const char* pending_error_char_arg_; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 private: | 876 private: |
876 static const int kLiteralTypeSlot = 0; | 877 static const int kLiteralTypeSlot = 0; |
877 static const int kElementsSlot = 1; | 878 static const int kElementsSlot = 1; |
878 | 879 |
879 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 880 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
880 }; | 881 }; |
881 | 882 |
882 } } // namespace v8::internal | 883 } } // namespace v8::internal |
883 | 884 |
884 #endif // V8_PARSER_H_ | 885 #endif // V8_PARSER_H_ |
OLD | NEW |