| 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/hash_table.h" | 10 #include "vm/hash_table.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 public: | 263 public: |
| 264 static RawError* CompileAll( | 264 static RawError* CompileAll( |
| 265 Dart_QualifiedFunctionName embedder_entry_points[], | 265 Dart_QualifiedFunctionName embedder_entry_points[], |
| 266 bool reset_fields); | 266 bool reset_fields); |
| 267 | 267 |
| 268 static RawError* CompileFunction(Thread* thread, const Function& function); | 268 static RawError* CompileFunction(Thread* thread, const Function& function); |
| 269 | 269 |
| 270 static RawObject* EvaluateStaticInitializer(const Field& field); | 270 static RawObject* EvaluateStaticInitializer(const Field& field); |
| 271 static RawObject* ExecuteOnce(SequenceNode* fragment); | 271 static RawObject* ExecuteOnce(SequenceNode* fragment); |
| 272 | 272 |
| 273 static RawFunction* CompileStaticInitializer(const Field& field, |
| 274 bool compute_type); |
| 275 |
| 273 private: | 276 private: |
| 274 Precompiler(Thread* thread, bool reset_fields); | 277 Precompiler(Thread* thread, bool reset_fields); |
| 275 | 278 |
| 276 | 279 |
| 277 static RawFunction* CompileStaticInitializer(const Field& field); | |
| 278 | |
| 279 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); | 280 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); |
| 280 void ClearAllCode(); | 281 void ClearAllCode(); |
| 281 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); | 282 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); |
| 282 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); | 283 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); |
| 283 void Iterate(); | 284 void Iterate(); |
| 284 | 285 |
| 285 void AddType(const AbstractType& type); | 286 void AddType(const AbstractType& type); |
| 286 void AddTypesOf(const Class& cls); | 287 void AddTypesOf(const Class& cls); |
| 287 void AddTypesOf(const Function& function); | 288 void AddTypesOf(const Function& function); |
| 288 void AddTypeArguments(const TypeArguments& args); | 289 void AddTypeArguments(const TypeArguments& args); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 310 | 311 |
| 311 void BindStaticCalls(); | 312 void BindStaticCalls(); |
| 312 void SwitchICCalls(); | 313 void SwitchICCalls(); |
| 313 void DedupStackmaps(); | 314 void DedupStackmaps(); |
| 314 void DedupStackmapLists(); | 315 void DedupStackmapLists(); |
| 315 void DedupInstructions(); | 316 void DedupInstructions(); |
| 316 void ResetPrecompilerState(); | 317 void ResetPrecompilerState(); |
| 317 | 318 |
| 318 void CollectDynamicFunctionNames(); | 319 void CollectDynamicFunctionNames(); |
| 319 | 320 |
| 320 class FunctionVisitor : public ValueObject { | 321 void PrecompileStaticInitializers(); |
| 322 |
| 323 template<typename T> |
| 324 class Visitor : public ValueObject { |
| 321 public: | 325 public: |
| 322 virtual ~FunctionVisitor() {} | 326 virtual ~Visitor() {} |
| 323 virtual void VisitFunction(const Function& function) = 0; | 327 virtual void Visit(const T& obj) = 0; |
| 324 }; | 328 }; |
| 329 typedef Visitor<Function> FunctionVisitor; |
| 330 typedef Visitor<Class> ClassVisitor; |
| 325 | 331 |
| 326 void VisitFunctions(FunctionVisitor* visitor); | 332 void VisitFunctions(FunctionVisitor* visitor); |
| 333 void VisitClasses(ClassVisitor* visitor); |
| 327 | 334 |
| 328 void FinalizeAllClasses(); | 335 void FinalizeAllClasses(); |
| 329 | 336 |
| 330 Thread* thread() const { return thread_; } | 337 Thread* thread() const { return thread_; } |
| 331 Zone* zone() const { return zone_; } | 338 Zone* zone() const { return zone_; } |
| 332 Isolate* isolate() const { return isolate_; } | 339 Isolate* isolate() const { return isolate_; } |
| 333 | 340 |
| 334 Thread* thread_; | 341 Thread* thread_; |
| 335 Zone* zone_; | 342 Zone* zone_; |
| 336 Isolate* isolate_; | 343 Isolate* isolate_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 return function.raw(); | 395 return function.raw(); |
| 389 } | 396 } |
| 390 }; | 397 }; |
| 391 | 398 |
| 392 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 399 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
| 393 | 400 |
| 394 | 401 |
| 395 } // namespace dart | 402 } // namespace dart |
| 396 | 403 |
| 397 #endif // VM_PRECOMPILER_H_ | 404 #endif // VM_PRECOMPILER_H_ |
| OLD | NEW |