Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: src/parser.h

Issue 527233003: Parser cleanup: less member variables. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 kHasInitializers, 652 kHasInitializers,
653 kHasNoInitializers 653 kHasNoInitializers
654 }; 654 };
655 655
656 // Returns NULL if parsing failed. 656 // Returns NULL if parsing failed.
657 FunctionLiteral* ParseProgram(); 657 FunctionLiteral* ParseProgram();
658 658
659 FunctionLiteral* ParseLazy(); 659 FunctionLiteral* ParseLazy();
660 FunctionLiteral* ParseLazy(Utf16CharacterStream* source); 660 FunctionLiteral* ParseLazy(Utf16CharacterStream* source);
661 661
662 Isolate* isolate() { return isolate_; } 662 Isolate* isolate() { return info_->isolate(); }
663 CompilationInfo* info() const { return info_; } 663 CompilationInfo* info() const { return info_; }
664 Handle<Script> script() const { return info_->script(); }
665 AstValueFactory* ast_value_factory() const {
666 return info_->ast_value_factory();
667 }
664 668
665 // Called by ParseProgram after setting up the scanner. 669 // Called by ParseProgram after setting up the scanner.
666 FunctionLiteral* DoParseProgram(CompilationInfo* info, 670 FunctionLiteral* DoParseProgram(CompilationInfo* info,
667 Handle<String> source); 671 Handle<String> source);
668 672
669 void SetCachedData(); 673 void SetCachedData();
670 674
671 bool inside_with() const { return scope_->inside_with(); } 675 bool inside_with() const { return scope_->inside_with(); }
672 ScriptCompiler::CompileOptions compile_options() const { 676 ScriptCompiler::CompileOptions compile_options() const {
673 return info_->compile_options(); 677 return info_->compile_options();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 Token::Value fvar_init_op, bool is_generator, bool* ok); 810 Token::Value fvar_init_op, bool is_generator, bool* ok);
807 811
808 void HandleSourceURLComments(); 812 void HandleSourceURLComments();
809 813
810 void ThrowPendingError(); 814 void ThrowPendingError();
811 815
812 // Handle errors detected during parsing, move statistics to Isolate, 816 // Handle errors detected during parsing, move statistics to Isolate,
813 // internalize strings (move them to the heap). 817 // internalize strings (move them to the heap).
814 void Internalize(); 818 void Internalize();
815 819
816 Isolate* isolate_;
817
818 Handle<Script> script_;
819 Scanner scanner_; 820 Scanner scanner_;
820 PreParser* reusable_preparser_; 821 PreParser* reusable_preparser_;
821 Scope* original_scope_; // for ES5 function declarations in sloppy eval 822 Scope* original_scope_; // for ES5 function declarations in sloppy eval
822 Target* target_stack_; // for break, continue statements 823 Target* target_stack_; // for break, continue statements
823 ParseData* cached_parse_data_; 824 ParseData* cached_parse_data_;
824 AstValueFactory* ast_value_factory_;
825 825
826 CompilationInfo* info_; 826 CompilationInfo* info_;
827 827
828 // Pending errors. 828 // Pending errors.
829 bool has_pending_error_; 829 bool has_pending_error_;
830 Scanner::Location pending_error_location_; 830 Scanner::Location pending_error_location_;
831 const char* pending_error_message_; 831 const char* pending_error_message_;
832 const AstRawString* pending_error_arg_; 832 const AstRawString* pending_error_arg_;
833 const char* pending_error_char_arg_; 833 const char* pending_error_char_arg_;
834 bool pending_error_is_reference_error_; 834 bool pending_error_is_reference_error_;
(...skipping 12 matching lines...) Expand all
847 parser_->scanner()->IdentifierIsFutureStrictReserved(identifier); 847 parser_->scanner()->IdentifierIsFutureStrictReserved(identifier);
848 } 848 }
849 849
850 850
851 Scope* ParserTraits::NewScope(Scope* parent_scope, ScopeType scope_type) { 851 Scope* ParserTraits::NewScope(Scope* parent_scope, ScopeType scope_type) {
852 return parser_->NewScope(parent_scope, scope_type); 852 return parser_->NewScope(parent_scope, scope_type);
853 } 853 }
854 854
855 855
856 const AstRawString* ParserTraits::EmptyIdentifierString() { 856 const AstRawString* ParserTraits::EmptyIdentifierString() {
857 return parser_->ast_value_factory_->empty_string(); 857 return parser_->ast_value_factory()->empty_string();
858 } 858 }
859 859
860 860
861 void ParserTraits::SkipLazyFunctionBody(const AstRawString* function_name, 861 void ParserTraits::SkipLazyFunctionBody(const AstRawString* function_name,
862 int* materialized_literal_count, 862 int* materialized_literal_count,
863 int* expected_property_count, 863 int* expected_property_count,
864 bool* ok) { 864 bool* ok) {
865 return parser_->SkipLazyFunctionBody( 865 return parser_->SkipLazyFunctionBody(
866 function_name, materialized_literal_count, expected_property_count, ok); 866 function_name, materialized_literal_count, expected_property_count, ok);
867 } 867 }
868 868
869 869
870 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( 870 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody(
871 const AstRawString* name, int pos, Variable* fvar, 871 const AstRawString* name, int pos, Variable* fvar,
872 Token::Value fvar_init_op, bool is_generator, bool* ok) { 872 Token::Value fvar_init_op, bool is_generator, bool* ok) {
873 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op, 873 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op,
874 is_generator, ok); 874 is_generator, ok);
875 } 875 }
876 876
877 void ParserTraits::CheckConflictingVarDeclarations(v8::internal::Scope* scope, 877 void ParserTraits::CheckConflictingVarDeclarations(v8::internal::Scope* scope,
878 bool* ok) { 878 bool* ok) {
879 parser_->CheckConflictingVarDeclarations(scope, ok); 879 parser_->CheckConflictingVarDeclarations(scope, ok);
880 } 880 }
881 881
882 882
883 AstValueFactory* ParserTraits::ast_value_factory() { 883 AstValueFactory* ParserTraits::ast_value_factory() {
884 return parser_->ast_value_factory_; 884 return parser_->ast_value_factory();
885 } 885 }
886 886
887 887
888 // Support for handling complex values (array and object literals) that 888 // Support for handling complex values (array and object literals) that
889 // can be fully handled at compile time. 889 // can be fully handled at compile time.
890 class CompileTimeValue: public AllStatic { 890 class CompileTimeValue: public AllStatic {
891 public: 891 public:
892 enum LiteralType { 892 enum LiteralType {
893 OBJECT_LITERAL_FAST_ELEMENTS, 893 OBJECT_LITERAL_FAST_ELEMENTS,
894 OBJECT_LITERAL_SLOW_ELEMENTS, 894 OBJECT_LITERAL_SLOW_ELEMENTS,
(...skipping 14 matching lines...) Expand all
909 private: 909 private:
910 static const int kLiteralTypeSlot = 0; 910 static const int kLiteralTypeSlot = 0;
911 static const int kElementsSlot = 1; 911 static const int kElementsSlot = 1;
912 912
913 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 913 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
914 }; 914 };
915 915
916 } } // namespace v8::internal 916 } } // namespace v8::internal
917 917
918 #endif // V8_PARSER_H_ 918 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698