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