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