OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 int pos) { | 827 int pos) { |
828 return new Call(expression, arguments, pos); | 828 return new Call(expression, arguments, pos); |
829 } | 829 } |
830 | 830 |
831 virtual Expression* NewCallEval(Expression* expression, | 831 virtual Expression* NewCallEval(Expression* expression, |
832 ZoneList<Expression*>* arguments, | 832 ZoneList<Expression*>* arguments, |
833 int pos) { | 833 int pos) { |
834 return new CallEval(expression, arguments, pos); | 834 return new CallEval(expression, arguments, pos); |
835 } | 835 } |
836 | 836 |
837 virtual Statement* EmptyStatement() { | 837 virtual Statement* EmptyStatement(); |
838 // Use a statically allocated empty statement singleton to avoid | |
839 // allocating lots and lots of empty statements. | |
840 static v8::internal::EmptyStatement empty; | |
841 return ∅ | |
842 } | |
843 }; | 838 }; |
844 | 839 |
845 | 840 |
846 class ParserRecorder: public ParserLog { | 841 class ParserRecorder: public ParserLog { |
847 public: | 842 public: |
848 ParserRecorder(); | 843 ParserRecorder(); |
849 virtual FunctionEntry LogFunction(int start); | 844 virtual FunctionEntry LogFunction(int start); |
850 virtual void LogError() { } | 845 virtual void LogError() { } |
851 virtual void LogMessage(Scanner::Location loc, | 846 virtual void LogMessage(Scanner::Location loc, |
852 const char* message, | 847 const char* message, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 | 1020 |
1026 | 1021 |
1027 Scope* AstBuildingParserFactory::NewScope(Scope* parent, Scope::Type type, | 1022 Scope* AstBuildingParserFactory::NewScope(Scope* parent, Scope::Type type, |
1028 bool inside_with) { | 1023 bool inside_with) { |
1029 Scope* result = new Scope(parent, type); | 1024 Scope* result = new Scope(parent, type); |
1030 result->Initialize(inside_with); | 1025 result->Initialize(inside_with); |
1031 return result; | 1026 return result; |
1032 } | 1027 } |
1033 | 1028 |
1034 | 1029 |
| 1030 Statement* AstBuildingParserFactory::EmptyStatement() { |
| 1031 // Use a statically allocated empty statement singleton to avoid |
| 1032 // allocating lots and lots of empty statements. |
| 1033 static v8::internal::EmptyStatement empty; |
| 1034 return ∅ |
| 1035 } |
| 1036 |
| 1037 |
1035 Scope* ParserFactory::NewScope(Scope* parent, Scope::Type type, | 1038 Scope* ParserFactory::NewScope(Scope* parent, Scope::Type type, |
1036 bool inside_with) { | 1039 bool inside_with) { |
1037 ASSERT(parent != NULL); | 1040 ASSERT(parent != NULL); |
1038 parent->type_ = type; | 1041 parent->type_ = type; |
1039 return parent; | 1042 return parent; |
1040 } | 1043 } |
1041 | 1044 |
1042 | 1045 |
1043 VariableProxy* PreParser::Declare(Handle<String> name, Variable::Mode mode, | 1046 VariableProxy* PreParser::Declare(Handle<String> name, Variable::Mode mode, |
1044 FunctionLiteral* fun, bool resolve, | 1047 FunctionLiteral* fun, bool resolve, |
(...skipping 3631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4676 start_position, | 4679 start_position, |
4677 is_expression); | 4680 is_expression); |
4678 return result; | 4681 return result; |
4679 } | 4682 } |
4680 | 4683 |
4681 | 4684 |
4682 #undef NEW | 4685 #undef NEW |
4683 | 4686 |
4684 | 4687 |
4685 } } // namespace v8::internal | 4688 } } // namespace v8::internal |
OLD | NEW |