| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Returns named function that is a unique dynamic target, i.e., | 152 // Returns named function that is a unique dynamic target, i.e., |
| 152 // - the target is identified by its name alone, since it occurs only once. | 153 // - the target is identified by its name alone, since it occurs only once. |
| 153 // - target's class has no subclasses, and neither is subclassed, i.e., | 154 // - target's class has no subclasses, and neither is subclassed, i.e., |
| 154 // the receiver type can be only the function's class. | 155 // the receiver type can be only the function's class. |
| 155 // Returns Function::null() if there is no unique dynamic target for | 156 // Returns Function::null() if there is no unique dynamic target for |
| 156 // given 'fname'. 'fname' must be a symbol. | 157 // given 'fname'. 'fname' must be a symbol. |
| 157 static void GetUniqueDynamicTarget(Isolate* isolate, | 158 static void GetUniqueDynamicTarget(Isolate* isolate, |
| 158 const String& fname, | 159 const String& fname, |
| 159 Object* function); | 160 Object* function); |
| 160 | 161 |
| 162 static RawError* CompileFunction(Thread* thread, const Function& function); |
| 163 |
| 164 static RawObject* EvaluateStaticInitializer(const Field& field); |
| 165 static RawObject* ExecuteOnce(SequenceNode* fragment); |
| 166 |
| 161 private: | 167 private: |
| 162 Precompiler(Thread* thread, bool reset_fields); | 168 Precompiler(Thread* thread, bool reset_fields); |
| 163 | 169 |
| 170 |
| 171 static RawFunction* CompileStaticInitializer(const Field& field); |
| 172 |
| 164 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); | 173 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); |
| 165 void ClearAllCode(); | 174 void ClearAllCode(); |
| 166 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); | 175 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); |
| 167 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); | 176 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); |
| 168 void Iterate(); | 177 void Iterate(); |
| 169 | 178 |
| 170 void AddCalleesOf(const Function& function); | 179 void AddCalleesOf(const Function& function); |
| 171 void AddConstObject(const Instance& instance); | 180 void AddConstObject(const Instance& instance); |
| 172 void AddClosureCall(const ICData& call_site); | 181 void AddClosureCall(const ICData& call_site); |
| 173 void AddField(const Field& field); | 182 void AddField(const Field& field); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 const GrowableObjectArray& pending_functions_; | 227 const GrowableObjectArray& pending_functions_; |
| 219 SymbolSet sent_selectors_; | 228 SymbolSet sent_selectors_; |
| 220 FunctionSet enqueued_functions_; | 229 FunctionSet enqueued_functions_; |
| 221 FieldSet fields_to_retain_; | 230 FieldSet fields_to_retain_; |
| 222 Error& error_; | 231 Error& error_; |
| 223 }; | 232 }; |
| 224 | 233 |
| 225 } // namespace dart | 234 } // namespace dart |
| 226 | 235 |
| 227 #endif // VM_PRECOMPILER_H_ | 236 #endif // VM_PRECOMPILER_H_ |
| OLD | NEW |