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/objects/scope-info.h" | 13 #include "src/objects/scope-info.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(); } |
marja
2017/01/17 15:39:08
Based on this CL, it's not possible to see whether
rmcilroy
2017/01/19 12:48:29
Given that the existing zone which was created alw
| |
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 kAllowLazyParsing = 1 << 7, | 225 kAllowLazyParsing = 1 << 7, |
218 kIsNamedExpression = 1 << 8, | 226 kIsNamedExpression = 1 << 8, |
219 kCallsEval = 1 << 9, | 227 kCallsEval = 1 << 9, |
220 kDebug = 1 << 10, | 228 kDebug = 1 << 10, |
221 kSerializing = 1 << 11, | 229 kSerializing = 1 << 11, |
222 // ---------- Output flags -------------------------- | 230 // ---------- Output flags -------------------------- |
223 kAstValueFactoryOwned = 1 << 12 | 231 kAstValueFactoryOwned = 1 << 12 |
224 }; | 232 }; |
225 | 233 |
226 //------------- Inputs to parsing and scope analysis ----------------------- | 234 //------------- Inputs to parsing and scope analysis ----------------------- |
227 Zone* zone_; | 235 std::shared_ptr<Zone> zone_; |
228 unsigned flags_; | 236 unsigned flags_; |
229 ScriptCompiler::ExternalSourceStream* source_stream_; | 237 ScriptCompiler::ExternalSourceStream* source_stream_; |
230 ScriptCompiler::StreamedSource::Encoding source_stream_encoding_; | 238 ScriptCompiler::StreamedSource::Encoding source_stream_encoding_; |
231 Utf16CharacterStream* character_stream_; | 239 Utf16CharacterStream* character_stream_; |
232 v8::Extension* extension_; | 240 v8::Extension* extension_; |
233 ScriptCompiler::CompileOptions compile_options_; | 241 ScriptCompiler::CompileOptions compile_options_; |
234 DeclarationScope* script_scope_; | 242 DeclarationScope* script_scope_; |
235 DeclarationScope* asm_function_scope_; | 243 DeclarationScope* asm_function_scope_; |
236 UnicodeCache* unicode_cache_; | 244 UnicodeCache* unicode_cache_; |
237 uintptr_t stack_limit_; | 245 uintptr_t stack_limit_; |
(...skipping 20 matching lines...) Expand all Loading... | |
258 | 266 |
259 void SetFlag(Flag f) { flags_ |= f; } | 267 void SetFlag(Flag f) { flags_ |= f; } |
260 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } | 268 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } |
261 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } | 269 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } |
262 }; | 270 }; |
263 | 271 |
264 } // namespace internal | 272 } // namespace internal |
265 } // namespace v8 | 273 } // namespace v8 |
266 | 274 |
267 #endif // V8_PARSING_PARSE_INFO_H_ | 275 #endif // V8_PARSING_PARSE_INFO_H_ |
OLD | NEW |