OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_PRECOMPILER_H_ | 5 #ifndef VM_PRECOMPILER_H_ |
6 #define VM_PRECOMPILER_H_ | 6 #define VM_PRECOMPILER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 // Forward declarations. | 14 // Forward declarations. |
15 class Class; | 15 class Class; |
16 class Error; | 16 class Error; |
17 class Field; | 17 class Field; |
18 class Function; | 18 class Function; |
19 class GrowableObjectArray; | 19 class GrowableObjectArray; |
20 class RawError; | 20 class RawError; |
| 21 class SequenceNode; |
21 class String; | 22 class String; |
22 | 23 |
23 class SymbolKeyValueTrait { | 24 class SymbolKeyValueTrait { |
24 public: | 25 public: |
25 // Typedefs needed for the DirectChainedHashMap template. | 26 // Typedefs needed for the DirectChainedHashMap template. |
26 typedef const String* Key; | 27 typedef const String* Key; |
27 typedef const String* Value; | 28 typedef const String* Value; |
28 typedef const String* Pair; | 29 typedef const String* Pair; |
29 | 30 |
30 static Key KeyOf(Pair kv) { return kv; } | 31 static Key KeyOf(Pair kv) { return kv; } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Returns named function that is a unique dynamic target, i.e., | 175 // Returns named function that is a unique dynamic target, i.e., |
175 // - the target is identified by its name alone, since it occurs only once. | 176 // - the target is identified by its name alone, since it occurs only once. |
176 // - target's class has no subclasses, and neither is subclassed, i.e., | 177 // - target's class has no subclasses, and neither is subclassed, i.e., |
177 // the receiver type can be only the function's class. | 178 // the receiver type can be only the function's class. |
178 // Returns Function::null() if there is no unique dynamic target for | 179 // Returns Function::null() if there is no unique dynamic target for |
179 // given 'fname'. 'fname' must be a symbol. | 180 // given 'fname'. 'fname' must be a symbol. |
180 static void GetUniqueDynamicTarget(Isolate* isolate, | 181 static void GetUniqueDynamicTarget(Isolate* isolate, |
181 const String& fname, | 182 const String& fname, |
182 Object* function); | 183 Object* function); |
183 | 184 |
| 185 static RawError* CompileFunction(Thread* thread, const Function& function); |
| 186 |
| 187 static RawObject* EvaluateStaticInitializer(const Field& field); |
| 188 static RawObject* ExecuteOnce(SequenceNode* fragment); |
| 189 |
184 private: | 190 private: |
185 Precompiler(Thread* thread, bool reset_fields); | 191 Precompiler(Thread* thread, bool reset_fields); |
186 | 192 |
| 193 |
| 194 static RawFunction* CompileStaticInitializer(const Field& field); |
| 195 |
187 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); | 196 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); |
188 void ClearAllCode(); | 197 void ClearAllCode(); |
189 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); | 198 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); |
190 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); | 199 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); |
191 void Iterate(); | 200 void Iterate(); |
192 | 201 |
193 void AddCalleesOf(const Function& function); | 202 void AddCalleesOf(const Function& function); |
194 void AddConstObject(const Instance& instance); | 203 void AddConstObject(const Instance& instance); |
195 void AddClosureCall(const ICData& call_site); | 204 void AddClosureCall(const ICData& call_site); |
196 void AddField(const Field& field); | 205 void AddField(const Field& field); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 const GrowableObjectArray& pending_functions_; | 252 const GrowableObjectArray& pending_functions_; |
244 SymbolSet sent_selectors_; | 253 SymbolSet sent_selectors_; |
245 FunctionSet enqueued_functions_; | 254 FunctionSet enqueued_functions_; |
246 FieldSet fields_to_retain_; | 255 FieldSet fields_to_retain_; |
247 Error& error_; | 256 Error& error_; |
248 }; | 257 }; |
249 | 258 |
250 } // namespace dart | 259 } // namespace dart |
251 | 260 |
252 #endif // VM_PRECOMPILER_H_ | 261 #endif // VM_PRECOMPILER_H_ |
OLD | NEW |