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