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 "include/v8.h" | 8 #include "include/v8.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/handles.h" | 10 #include "src/handles.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // Convenience accessor methods for flags. | 41 // Convenience accessor methods for flags. |
42 #define FLAG_ACCESSOR(flag, getter, setter) \ | 42 #define FLAG_ACCESSOR(flag, getter, setter) \ |
43 bool getter() const { return GetFlag(flag); } \ | 43 bool getter() const { return GetFlag(flag); } \ |
44 void setter() { SetFlag(flag); } \ | 44 void setter() { SetFlag(flag); } \ |
45 void setter(bool val) { SetFlag(flag, val); } | 45 void setter(bool val) { SetFlag(flag, val); } |
46 | 46 |
47 FLAG_ACCESSOR(kToplevel, is_toplevel, set_toplevel) | 47 FLAG_ACCESSOR(kToplevel, is_toplevel, set_toplevel) |
48 FLAG_ACCESSOR(kLazy, is_lazy, set_lazy) | 48 FLAG_ACCESSOR(kLazy, is_lazy, set_lazy) |
49 FLAG_ACCESSOR(kEval, is_eval, set_eval) | 49 FLAG_ACCESSOR(kEval, is_eval, set_eval) |
50 FLAG_ACCESSOR(kGlobal, is_global, set_global) | |
51 FLAG_ACCESSOR(kStrictMode, is_strict_mode, set_strict_mode) | 50 FLAG_ACCESSOR(kStrictMode, is_strict_mode, set_strict_mode) |
52 FLAG_ACCESSOR(kNative, is_native, set_native) | 51 FLAG_ACCESSOR(kNative, is_native, set_native) |
53 FLAG_ACCESSOR(kModule, is_module, set_module) | 52 FLAG_ACCESSOR(kModule, is_module, set_module) |
54 FLAG_ACCESSOR(kAllowLazyParsing, allow_lazy_parsing, set_allow_lazy_parsing) | 53 FLAG_ACCESSOR(kAllowLazyParsing, allow_lazy_parsing, set_allow_lazy_parsing) |
55 FLAG_ACCESSOR(kAstValueFactoryOwned, ast_value_factory_owned, | 54 FLAG_ACCESSOR(kAstValueFactoryOwned, ast_value_factory_owned, |
56 set_ast_value_factory_owned) | 55 set_ast_value_factory_owned) |
57 FLAG_ACCESSOR(kIsNamedExpression, is_named_expression, | 56 FLAG_ACCESSOR(kIsNamedExpression, is_named_expression, |
58 set_is_named_expression) | 57 set_is_named_expression) |
59 FLAG_ACCESSOR(kCallsEval, calls_eval, set_calls_eval) | 58 FLAG_ACCESSOR(kCallsEval, calls_eval, set_calls_eval) |
60 | 59 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 bool script_is_native() const; | 190 bool script_is_native() const; |
192 #endif // DEBUG | 191 #endif // DEBUG |
193 | 192 |
194 private: | 193 private: |
195 // Various configuration flags for parsing. | 194 // Various configuration flags for parsing. |
196 enum Flag { | 195 enum Flag { |
197 // ---------- Input flags --------------------------- | 196 // ---------- Input flags --------------------------- |
198 kToplevel = 1 << 0, | 197 kToplevel = 1 << 0, |
199 kLazy = 1 << 1, | 198 kLazy = 1 << 1, |
200 kEval = 1 << 2, | 199 kEval = 1 << 2, |
201 kGlobal = 1 << 3, | 200 kStrictMode = 1 << 3, |
202 kStrictMode = 1 << 4, | 201 kNative = 1 << 4, |
203 kNative = 1 << 5, | 202 kParseRestriction = 1 << 5, |
204 kParseRestriction = 1 << 6, | 203 kModule = 1 << 6, |
205 kModule = 1 << 7, | 204 kAllowLazyParsing = 1 << 7, |
206 kAllowLazyParsing = 1 << 8, | 205 kIsNamedExpression = 1 << 8, |
207 kIsNamedExpression = 1 << 9, | 206 kCallsEval = 1 << 9, |
208 kCallsEval = 1 << 10, | |
209 // ---------- Output flags -------------------------- | 207 // ---------- Output flags -------------------------- |
210 kAstValueFactoryOwned = 1 << 11 | 208 kAstValueFactoryOwned = 1 << 10 |
211 }; | 209 }; |
212 | 210 |
213 //------------- Inputs to parsing and scope analysis ----------------------- | 211 //------------- Inputs to parsing and scope analysis ----------------------- |
214 Zone* zone_; | 212 Zone* zone_; |
215 unsigned flags_; | 213 unsigned flags_; |
216 ScriptCompiler::ExternalSourceStream* source_stream_; | 214 ScriptCompiler::ExternalSourceStream* source_stream_; |
217 ScriptCompiler::StreamedSource::Encoding source_stream_encoding_; | 215 ScriptCompiler::StreamedSource::Encoding source_stream_encoding_; |
218 Utf16CharacterStream* character_stream_; | 216 Utf16CharacterStream* character_stream_; |
219 v8::Extension* extension_; | 217 v8::Extension* extension_; |
220 ScriptCompiler::CompileOptions compile_options_; | 218 ScriptCompiler::CompileOptions compile_options_; |
(...skipping 21 matching lines...) Expand all Loading... |
242 | 240 |
243 void SetFlag(Flag f) { flags_ |= f; } | 241 void SetFlag(Flag f) { flags_ |= f; } |
244 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } | 242 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } |
245 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } | 243 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } |
246 }; | 244 }; |
247 | 245 |
248 } // namespace internal | 246 } // namespace internal |
249 } // namespace v8 | 247 } // namespace v8 |
250 | 248 |
251 #endif // V8_PARSING_PARSE_INFO_H_ | 249 #endif // V8_PARSING_PARSE_INFO_H_ |
OLD | NEW |