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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 // local variables creates user-controlled constants in the generated code, | 776 // local variables creates user-controlled constants in the generated code, |
771 // and we don't want too much user-controlled memory inside the code (this was | 777 // and we don't want too much user-controlled memory inside the code (this was |
772 // the reason why this limit was introduced in the first place; see | 778 // the reason why this limit was introduced in the first place; see |
773 // https://codereview.chromium.org/7003030/ ). | 779 // https://codereview.chromium.org/7003030/ ). |
774 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 | 780 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 |
775 | 781 |
776 // Returns NULL if parsing failed. | 782 // Returns NULL if parsing failed. |
777 FunctionLiteral* ParseProgram(Isolate* isolate, ParseInfo* info); | 783 FunctionLiteral* ParseProgram(Isolate* isolate, ParseInfo* info); |
778 | 784 |
779 FunctionLiteral* ParseLazy(Isolate* isolate, ParseInfo* info); | 785 FunctionLiteral* ParseLazy(Isolate* isolate, ParseInfo* info); |
780 FunctionLiteral* DoParseLazy(Isolate* isolate, ParseInfo* info, | 786 FunctionLiteral* DoParseLazy(ParseInfo* info, const AstRawString* raw_name, |
781 const AstRawString* raw_name, | |
782 Utf16CharacterStream* source); | 787 Utf16CharacterStream* source); |
783 | 788 |
784 // Called by ParseProgram after setting up the scanner. | 789 // Called by ParseProgram after setting up the scanner. |
785 FunctionLiteral* DoParseProgram(ParseInfo* info); | 790 FunctionLiteral* DoParseProgram(ParseInfo* info); |
786 | 791 |
787 void SetCachedData(ParseInfo* info); | 792 void SetCachedData(ParseInfo* info); |
788 | 793 |
789 ScriptCompiler::CompileOptions compile_options() const { | 794 ScriptCompiler::CompileOptions compile_options() const { |
790 return compile_options_; | 795 return compile_options_; |
791 } | 796 } |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 | 1360 |
1356 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1361 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
1357 return parser_->ParseDoExpression(ok); | 1362 return parser_->ParseDoExpression(ok); |
1358 } | 1363 } |
1359 | 1364 |
1360 | 1365 |
1361 } // namespace internal | 1366 } // namespace internal |
1362 } // namespace v8 | 1367 } // namespace v8 |
1363 | 1368 |
1364 #endif // V8_PARSING_PARSER_H_ | 1369 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |