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_PARSING_PARSER_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 DeclarationScope* script_scope() const { return script_scope_; } | 109 DeclarationScope* script_scope() const { return script_scope_; } |
110 void set_script_scope(DeclarationScope* script_scope) { | 110 void set_script_scope(DeclarationScope* script_scope) { |
111 script_scope_ = script_scope; | 111 script_scope_ = script_scope; |
112 } | 112 } |
113 | 113 |
114 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } | 114 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } |
115 void set_ast_value_factory(AstValueFactory* ast_value_factory) { | 115 void set_ast_value_factory(AstValueFactory* ast_value_factory) { |
116 ast_value_factory_ = ast_value_factory; | 116 ast_value_factory_ = ast_value_factory; |
117 } | 117 } |
118 | 118 |
| 119 const AstRawString* function_name() const { return function_name_; } |
| 120 void set_function_name(const AstRawString* function_name) { |
| 121 function_name_ = function_name; |
| 122 } |
| 123 |
119 FunctionLiteral* literal() const { return literal_; } | 124 FunctionLiteral* literal() const { return literal_; } |
120 void set_literal(FunctionLiteral* literal) { literal_ = literal; } | 125 void set_literal(FunctionLiteral* literal) { literal_ = literal; } |
121 | 126 |
122 DeclarationScope* scope() const { return literal()->scope(); } | 127 DeclarationScope* scope() const { return literal()->scope(); } |
123 | 128 |
124 UnicodeCache* unicode_cache() const { return unicode_cache_; } | 129 UnicodeCache* unicode_cache() const { return unicode_cache_; } |
125 void set_unicode_cache(UnicodeCache* unicode_cache) { | 130 void set_unicode_cache(UnicodeCache* unicode_cache) { |
126 unicode_cache_ = unicode_cache; | 131 unicode_cache_ = unicode_cache; |
127 } | 132 } |
128 | 133 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 228 |
224 // TODO(titzer): Move handles and isolate out of ParseInfo. | 229 // TODO(titzer): Move handles and isolate out of ParseInfo. |
225 Isolate* isolate_; | 230 Isolate* isolate_; |
226 Handle<SharedFunctionInfo> shared_; | 231 Handle<SharedFunctionInfo> shared_; |
227 Handle<Script> script_; | 232 Handle<Script> script_; |
228 Handle<Context> context_; | 233 Handle<Context> context_; |
229 | 234 |
230 //----------- Inputs+Outputs of parsing and scope analysis ----------------- | 235 //----------- Inputs+Outputs of parsing and scope analysis ----------------- |
231 ScriptData** cached_data_; // used if available, populated if requested. | 236 ScriptData** cached_data_; // used if available, populated if requested. |
232 AstValueFactory* ast_value_factory_; // used if available, otherwise new. | 237 AstValueFactory* ast_value_factory_; // used if available, otherwise new. |
| 238 const AstRawString* function_name_; |
233 | 239 |
234 //----------- Output of parsing and scope analysis ------------------------ | 240 //----------- Output of parsing and scope analysis ------------------------ |
235 FunctionLiteral* literal_; | 241 FunctionLiteral* literal_; |
236 | 242 |
237 void SetFlag(Flag f) { flags_ |= f; } | 243 void SetFlag(Flag f) { flags_ |= f; } |
238 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } | 244 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } |
239 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } | 245 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } |
240 }; | 246 }; |
241 | 247 |
242 class FunctionEntry BASE_EMBEDDED { | 248 class FunctionEntry BASE_EMBEDDED { |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 // local variables creates user-controlled constants in the generated code, | 780 // local variables creates user-controlled constants in the generated code, |
775 // and we don't want too much user-controlled memory inside the code (this was | 781 // and we don't want too much user-controlled memory inside the code (this was |
776 // the reason why this limit was introduced in the first place; see | 782 // the reason why this limit was introduced in the first place; see |
777 // https://codereview.chromium.org/7003030/ ). | 783 // https://codereview.chromium.org/7003030/ ). |
778 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 | 784 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 |
779 | 785 |
780 // Returns NULL if parsing failed. | 786 // Returns NULL if parsing failed. |
781 FunctionLiteral* ParseProgram(Isolate* isolate, ParseInfo* info); | 787 FunctionLiteral* ParseProgram(Isolate* isolate, ParseInfo* info); |
782 | 788 |
783 FunctionLiteral* ParseLazy(Isolate* isolate, ParseInfo* info); | 789 FunctionLiteral* ParseLazy(Isolate* isolate, ParseInfo* info); |
784 FunctionLiteral* DoParseLazy(Isolate* isolate, ParseInfo* info, | 790 FunctionLiteral* DoParseLazy(ParseInfo* info, const AstRawString* raw_name, |
785 const AstRawString* raw_name, | |
786 Utf16CharacterStream* source); | 791 Utf16CharacterStream* source); |
787 | 792 |
788 // Called by ParseProgram after setting up the scanner. | 793 // Called by ParseProgram after setting up the scanner. |
789 FunctionLiteral* DoParseProgram(ParseInfo* info); | 794 FunctionLiteral* DoParseProgram(ParseInfo* info); |
790 | 795 |
791 void SetCachedData(ParseInfo* info); | 796 void SetCachedData(ParseInfo* info); |
792 | 797 |
793 ScriptCompiler::CompileOptions compile_options() const { | 798 ScriptCompiler::CompileOptions compile_options() const { |
794 return compile_options_; | 799 return compile_options_; |
795 } | 800 } |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 | 1363 |
1359 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1364 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
1360 return parser_->ParseDoExpression(ok); | 1365 return parser_->ParseDoExpression(ok); |
1361 } | 1366 } |
1362 | 1367 |
1363 | 1368 |
1364 } // namespace internal | 1369 } // namespace internal |
1365 } // namespace v8 | 1370 } // namespace v8 |
1366 | 1371 |
1367 #endif // V8_PARSING_PARSER_H_ | 1372 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |