OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // TODO(titzer): remove this include dependency | 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency |
11 #include "src/pending-compilation-error-handler.h" | 11 #include "src/pending-compilation-error-handler.h" |
12 #include "src/preparse-data.h" | 12 #include "src/preparse-data.h" |
13 #include "src/preparse-data-format.h" | 13 #include "src/preparse-data-format.h" |
14 #include "src/preparser.h" | 14 #include "src/preparser.h" |
15 #include "src/scopes.h" | 15 #include "src/scopes.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 | 18 |
19 class ScriptCompiler; | 19 class ScriptCompiler; |
20 | 20 |
21 namespace internal { | 21 namespace internal { |
22 | 22 |
23 class Target; | 23 class Target; |
24 | 24 |
25 // A container for the inputs, configuration options, and outputs of parsing. | 25 // A container for the inputs, configuration options, and outputs of parsing. |
26 class ParseInfo { | 26 class ParseInfo { |
27 public: | 27 public: |
28 explicit ParseInfo(Zone* zone) { | 28 // TODO(titzer) Make this private, see BackgroundParsingTask constructor. |
titzer
2015/03/12 11:33:40
So the solution to that would be a (Zone*,Isolate*
| |
29 memset(this, 0, sizeof(ParseInfo)); | 29 explicit ParseInfo(Zone* zone); |
30 zone_ = zone; | 30 |
31 } | 31 ParseInfo(Zone* zone, Handle<JSFunction> function); |
32 ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared); | |
33 ParseInfo(Zone* zone, Handle<Script> script); | |
32 | 34 |
33 ~ParseInfo() { | 35 ~ParseInfo() { |
34 if (ast_value_factory_owned()) { | 36 if (ast_value_factory_owned()) { |
35 delete ast_value_factory_; | 37 delete ast_value_factory_; |
36 set_ast_value_factory_owned(false); | 38 set_ast_value_factory_owned(false); |
37 } | 39 } |
38 ast_value_factory_ = nullptr; | 40 ast_value_factory_ = nullptr; |
39 } | 41 } |
40 | 42 |
41 ParseInfo* InitializeFromJSFunction(Handle<JSFunction> function); | |
42 ParseInfo* InitializeFromSharedFunctionInfo( | |
43 Handle<SharedFunctionInfo> shared); | |
44 ParseInfo* InitializeFromScript(Handle<Script> script); | |
45 | |
46 Zone* zone() { return zone_; } | 43 Zone* zone() { return zone_; } |
47 | 44 |
48 // Convenience accessor methods for flags. | 45 // Convenience accessor methods for flags. |
49 #define FLAG_ACCESSOR(flag, getter, setter) \ | 46 #define FLAG_ACCESSOR(flag, getter, setter) \ |
50 bool getter() const { return GetFlag(flag); } \ | 47 bool getter() const { return GetFlag(flag); } \ |
51 void setter() { SetFlag(flag); } \ | 48 void setter() { SetFlag(flag); } \ |
52 void setter(bool val) { SetFlag(flag, val); } | 49 void setter(bool val) { SetFlag(flag, val); } |
53 | 50 |
54 FLAG_ACCESSOR(kToplevel, is_toplevel, set_toplevel) | 51 FLAG_ACCESSOR(kToplevel, is_toplevel, set_toplevel) |
55 FLAG_ACCESSOR(kLazy, is_lazy, set_lazy) | 52 FLAG_ACCESSOR(kLazy, is_lazy, set_lazy) |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1128 } | 1125 } |
1129 | 1126 |
1130 | 1127 |
1131 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 1128 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
1132 int start, Expression* tag) { | 1129 int start, Expression* tag) { |
1133 return parser_->CloseTemplateLiteral(state, start, tag); | 1130 return parser_->CloseTemplateLiteral(state, start, tag); |
1134 } | 1131 } |
1135 } } // namespace v8::internal | 1132 } } // namespace v8::internal |
1136 | 1133 |
1137 #endif // V8_PARSER_H_ | 1134 #endif // V8_PARSER_H_ |
OLD | NEW |