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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 Scope* script_scope() { return script_scope_; } | 107 Scope* script_scope() { return script_scope_; } |
108 void set_script_scope(Scope* script_scope) { script_scope_ = script_scope; } | 108 void set_script_scope(Scope* script_scope) { script_scope_ = script_scope; } |
109 | 109 |
110 AstValueFactory* ast_value_factory() { return ast_value_factory_; } | 110 AstValueFactory* ast_value_factory() { return ast_value_factory_; } |
111 void set_ast_value_factory(AstValueFactory* ast_value_factory) { | 111 void set_ast_value_factory(AstValueFactory* ast_value_factory) { |
112 ast_value_factory_ = ast_value_factory; | 112 ast_value_factory_ = ast_value_factory; |
113 } | 113 } |
114 | 114 |
| 115 const AstRawString* function_name() const { return function_name_; } |
| 116 void set_function_name(const AstRawString* function_name) { |
| 117 function_name_ = function_name; |
| 118 } |
| 119 |
115 FunctionLiteral* literal() { return literal_; } | 120 FunctionLiteral* literal() { return literal_; } |
116 void set_literal(FunctionLiteral* literal) { literal_ = literal; } | 121 void set_literal(FunctionLiteral* literal) { literal_ = literal; } |
117 | 122 |
118 Scope* scope() { return scope_; } | 123 Scope* scope() { return scope_; } |
119 void set_scope(Scope* scope) { scope_ = scope; } | 124 void set_scope(Scope* scope) { scope_ = scope; } |
120 | 125 |
121 UnicodeCache* unicode_cache() { return unicode_cache_; } | 126 UnicodeCache* unicode_cache() { return unicode_cache_; } |
122 void set_unicode_cache(UnicodeCache* unicode_cache) { | 127 void set_unicode_cache(UnicodeCache* unicode_cache) { |
123 unicode_cache_ = unicode_cache; | 128 unicode_cache_ = unicode_cache; |
124 } | 129 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 223 |
219 // TODO(titzer): Move handles and isolate out of ParseInfo. | 224 // TODO(titzer): Move handles and isolate out of ParseInfo. |
220 Isolate* isolate_; | 225 Isolate* isolate_; |
221 Handle<SharedFunctionInfo> shared_; | 226 Handle<SharedFunctionInfo> shared_; |
222 Handle<Script> script_; | 227 Handle<Script> script_; |
223 Handle<Context> context_; | 228 Handle<Context> context_; |
224 | 229 |
225 //----------- Inputs+Outputs of parsing and scope analysis ----------------- | 230 //----------- Inputs+Outputs of parsing and scope analysis ----------------- |
226 ScriptData** cached_data_; // used if available, populated if requested. | 231 ScriptData** cached_data_; // used if available, populated if requested. |
227 AstValueFactory* ast_value_factory_; // used if available, otherwise new. | 232 AstValueFactory* ast_value_factory_; // used if available, otherwise new. |
| 233 const AstRawString* function_name_; |
228 | 234 |
229 //----------- Outputs of parsing and scope analysis ------------------------ | 235 //----------- Outputs of parsing and scope analysis ------------------------ |
230 FunctionLiteral* literal_; // produced by full parser. | 236 FunctionLiteral* literal_; // produced by full parser. |
231 Scope* scope_; // produced by scope analysis. | 237 Scope* scope_; // produced by scope analysis. |
232 | 238 |
233 void SetFlag(Flag f) { flags_ |= f; } | 239 void SetFlag(Flag f) { flags_ |= f; } |
234 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } | 240 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } |
235 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } | 241 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } |
236 }; | 242 }; |
237 | 243 |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 // local variables creates user-controlled constants in the generated code, | 775 // local variables creates user-controlled constants in the generated code, |
770 // and we don't want too much user-controlled memory inside the code (this was | 776 // and we don't want too much user-controlled memory inside the code (this was |
771 // the reason why this limit was introduced in the first place; see | 777 // the reason why this limit was introduced in the first place; see |
772 // https://codereview.chromium.org/7003030/ ). | 778 // https://codereview.chromium.org/7003030/ ). |
773 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 | 779 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 |
774 | 780 |
775 // Returns NULL if parsing failed. | 781 // Returns NULL if parsing failed. |
776 FunctionLiteral* ParseProgram(Isolate* isolate, ParseInfo* info); | 782 FunctionLiteral* ParseProgram(Isolate* isolate, ParseInfo* info); |
777 | 783 |
778 FunctionLiteral* ParseLazy(Isolate* isolate, ParseInfo* info); | 784 FunctionLiteral* ParseLazy(Isolate* isolate, ParseInfo* info); |
779 FunctionLiteral* DoParseLazy(Isolate* isolate, ParseInfo* info, | 785 FunctionLiteral* DoParseLazy(ParseInfo* info, const AstRawString* raw_name, |
780 const AstRawString* raw_name, | |
781 Utf16CharacterStream* source); | 786 Utf16CharacterStream* source); |
782 | 787 |
783 // Called by ParseProgram after setting up the scanner. | 788 // Called by ParseProgram after setting up the scanner. |
784 FunctionLiteral* DoParseProgram(ParseInfo* info); | 789 FunctionLiteral* DoParseProgram(ParseInfo* info); |
785 | 790 |
786 void SetCachedData(ParseInfo* info); | 791 void SetCachedData(ParseInfo* info); |
787 | 792 |
788 ScriptCompiler::CompileOptions compile_options() const { | 793 ScriptCompiler::CompileOptions compile_options() const { |
789 return compile_options_; | 794 return compile_options_; |
790 } | 795 } |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 | 1359 |
1355 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1360 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
1356 return parser_->ParseDoExpression(ok); | 1361 return parser_->ParseDoExpression(ok); |
1357 } | 1362 } |
1358 | 1363 |
1359 | 1364 |
1360 } // namespace internal | 1365 } // namespace internal |
1361 } // namespace v8 | 1366 } // namespace v8 |
1362 | 1367 |
1363 #endif // V8_PARSING_PARSER_H_ | 1368 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |