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