| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_PARSE_INFO_H_ | 5 #ifndef V8_PARSING_PARSE_INFO_H_ |
| 6 #define V8_PARSING_PARSE_INFO_H_ | 6 #define V8_PARSING_PARSE_INFO_H_ |
| 7 | 7 |
| 8 #include <memory> | |
| 9 | |
| 10 #include "include/v8.h" | 8 #include "include/v8.h" |
| 11 #include "src/globals.h" | 9 #include "src/globals.h" |
| 12 #include "src/handles.h" | 10 #include "src/handles.h" |
| 13 | 11 |
| 14 namespace v8 { | 12 namespace v8 { |
| 15 | 13 |
| 16 class Extension; | 14 class Extension; |
| 17 | 15 |
| 18 namespace internal { | 16 namespace internal { |
| 19 | 17 |
| 20 class AccountingAllocator; | |
| 21 class AstRawString; | 18 class AstRawString; |
| 22 class AstValueFactory; | 19 class AstValueFactory; |
| 23 class DeclarationScope; | 20 class DeclarationScope; |
| 24 class FunctionLiteral; | 21 class FunctionLiteral; |
| 25 class ScriptData; | 22 class ScriptData; |
| 26 class SharedFunctionInfo; | 23 class SharedFunctionInfo; |
| 27 class UnicodeCache; | 24 class UnicodeCache; |
| 28 class Utf16CharacterStream; | 25 class Utf16CharacterStream; |
| 29 class Zone; | 26 class Zone; |
| 30 | 27 |
| 31 // A container for the inputs, configuration options, and outputs of parsing. | 28 // A container for the inputs, configuration options, and outputs of parsing. |
| 32 class V8_EXPORT_PRIVATE ParseInfo { | 29 class V8_EXPORT_PRIVATE ParseInfo { |
| 33 public: | 30 public: |
| 34 explicit ParseInfo(AccountingAllocator* zone_allocator); | 31 explicit ParseInfo(Zone* zone); |
| 35 ParseInfo(Handle<Script> script); | 32 ParseInfo(Zone* zone, Handle<Script> script); |
| 36 ParseInfo(Handle<SharedFunctionInfo> shared); | 33 ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared); |
| 37 | |
| 38 // TODO(rmcilroy): Remove once Hydrogen no longer needs this. | |
| 39 ParseInfo(Handle<SharedFunctionInfo> shared, std::shared_ptr<Zone> zone); | |
| 40 | 34 |
| 41 ~ParseInfo(); | 35 ~ParseInfo(); |
| 42 | 36 |
| 43 Zone* zone() const { return zone_.get(); } | 37 Zone* zone() const { return zone_; } |
| 44 | |
| 45 std::shared_ptr<Zone> zone_shared() const { return zone_; } | |
| 46 | 38 |
| 47 // Convenience accessor methods for flags. | 39 // Convenience accessor methods for flags. |
| 48 #define FLAG_ACCESSOR(flag, getter, setter) \ | 40 #define FLAG_ACCESSOR(flag, getter, setter) \ |
| 49 bool getter() const { return GetFlag(flag); } \ | 41 bool getter() const { return GetFlag(flag); } \ |
| 50 void setter() { SetFlag(flag); } \ | 42 void setter() { SetFlag(flag); } \ |
| 51 void setter(bool val) { SetFlag(flag, val); } | 43 void setter(bool val) { SetFlag(flag, val); } |
| 52 | 44 |
| 53 FLAG_ACCESSOR(kToplevel, is_toplevel, set_toplevel) | 45 FLAG_ACCESSOR(kToplevel, is_toplevel, set_toplevel) |
| 54 FLAG_ACCESSOR(kEval, is_eval, set_eval) | 46 FLAG_ACCESSOR(kEval, is_eval, set_eval) |
| 55 FLAG_ACCESSOR(kStrictMode, is_strict_mode, set_strict_mode) | 47 FLAG_ACCESSOR(kStrictMode, is_strict_mode, set_strict_mode) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 kAllowLazyParsing = 1 << 7, | 216 kAllowLazyParsing = 1 << 7, |
| 225 kIsNamedExpression = 1 << 8, | 217 kIsNamedExpression = 1 << 8, |
| 226 kCallsEval = 1 << 9, | 218 kCallsEval = 1 << 9, |
| 227 kDebug = 1 << 10, | 219 kDebug = 1 << 10, |
| 228 kSerializing = 1 << 11, | 220 kSerializing = 1 << 11, |
| 229 // ---------- Output flags -------------------------- | 221 // ---------- Output flags -------------------------- |
| 230 kAstValueFactoryOwned = 1 << 12 | 222 kAstValueFactoryOwned = 1 << 12 |
| 231 }; | 223 }; |
| 232 | 224 |
| 233 //------------- Inputs to parsing and scope analysis ----------------------- | 225 //------------- Inputs to parsing and scope analysis ----------------------- |
| 234 std::shared_ptr<Zone> zone_; | 226 Zone* zone_; |
| 235 unsigned flags_; | 227 unsigned flags_; |
| 236 ScriptCompiler::ExternalSourceStream* source_stream_; | 228 ScriptCompiler::ExternalSourceStream* source_stream_; |
| 237 ScriptCompiler::StreamedSource::Encoding source_stream_encoding_; | 229 ScriptCompiler::StreamedSource::Encoding source_stream_encoding_; |
| 238 Utf16CharacterStream* character_stream_; | 230 Utf16CharacterStream* character_stream_; |
| 239 v8::Extension* extension_; | 231 v8::Extension* extension_; |
| 240 ScriptCompiler::CompileOptions compile_options_; | 232 ScriptCompiler::CompileOptions compile_options_; |
| 241 DeclarationScope* script_scope_; | 233 DeclarationScope* script_scope_; |
| 242 DeclarationScope* asm_function_scope_; | 234 DeclarationScope* asm_function_scope_; |
| 243 UnicodeCache* unicode_cache_; | 235 UnicodeCache* unicode_cache_; |
| 244 uintptr_t stack_limit_; | 236 uintptr_t stack_limit_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 265 | 257 |
| 266 void SetFlag(Flag f) { flags_ |= f; } | 258 void SetFlag(Flag f) { flags_ |= f; } |
| 267 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } | 259 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } |
| 268 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } | 260 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } |
| 269 }; | 261 }; |
| 270 | 262 |
| 271 } // namespace internal | 263 } // namespace internal |
| 272 } // namespace v8 | 264 } // namespace v8 |
| 273 | 265 |
| 274 #endif // V8_PARSING_PARSE_INFO_H_ | 266 #endif // V8_PARSING_PARSE_INFO_H_ |
| OLD | NEW |