| 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" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet; | 87 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet; |
| 88 | 88 |
| 89 | 89 |
| 90 class Precompiler : public ValueObject { | 90 class Precompiler : public ValueObject { |
| 91 public: | 91 public: |
| 92 static RawError* CompileAll( | 92 static RawError* CompileAll( |
| 93 Dart_QualifiedFunctionName embedder_entry_points[], | 93 Dart_QualifiedFunctionName embedder_entry_points[], |
| 94 bool reset_fields); | 94 bool reset_fields); |
| 95 | 95 |
| 96 // Returns named function that is a unique dynamic target, i.e., |
| 97 // - the target is identified by its name alone, since it occurs only once. |
| 98 // - target's class has no subclasses, and neither is subclassed, i.e., |
| 99 // the receiver type can be only the function's class. |
| 100 // Returns Function::null() if there is no unique dynamic target for |
| 101 // given 'fname'. 'fname' must be a symbol. |
| 102 static void GetUniqueDynamicTarget(Isolate* isolate, |
| 103 const String& fname, |
| 104 Object* function); |
| 105 |
| 96 private: | 106 private: |
| 97 Precompiler(Thread* thread, bool reset_fields); | 107 Precompiler(Thread* thread, bool reset_fields); |
| 98 | 108 |
| 99 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); | 109 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); |
| 100 void ClearAllCode(); | 110 void ClearAllCode(); |
| 101 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); | 111 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); |
| 102 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); | 112 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); |
| 103 void Iterate(); | 113 void Iterate(); |
| 104 | 114 |
| 105 void AddCalleesOf(const Function& function); | 115 void AddCalleesOf(const Function& function); |
| 106 void AddConstObject(const Instance& instance); | 116 void AddConstObject(const Instance& instance); |
| 107 void AddClosureCall(const ICData& call_site); | 117 void AddClosureCall(const ICData& call_site); |
| 108 void AddField(const Field& field); | 118 void AddField(const Field& field); |
| 109 void AddFunction(const Function& function); | 119 void AddFunction(const Function& function); |
| 110 void AddInstantiatedClass(const Class& cls); | 120 void AddInstantiatedClass(const Class& cls); |
| 111 void AddSelector(const String& selector); | 121 void AddSelector(const String& selector); |
| 112 bool IsSent(const String& selector); | 122 bool IsSent(const String& selector); |
| 113 | 123 |
| 114 void ProcessFunction(const Function& function); | 124 void ProcessFunction(const Function& function); |
| 115 void CheckForNewDynamicFunctions(); | 125 void CheckForNewDynamicFunctions(); |
| 116 | 126 |
| 117 void DropUncompiledFunctions(); | 127 void DropUncompiledFunctions(); |
| 128 void CollectDynamicFunctionNames(); |
| 118 void BindStaticCalls(); | 129 void BindStaticCalls(); |
| 119 void DedupStackmaps(); | 130 void DedupStackmaps(); |
| 120 void ResetPrecompilerState(); | 131 void ResetPrecompilerState(); |
| 121 | 132 |
| 122 class FunctionVisitor : public ValueObject { | 133 class FunctionVisitor : public ValueObject { |
| 123 public: | 134 public: |
| 124 virtual ~FunctionVisitor() {} | 135 virtual ~FunctionVisitor() {} |
| 125 virtual void VisitFunction(const Function& function) = 0; | 136 virtual void VisitFunction(const Function& function) = 0; |
| 126 }; | 137 }; |
| 127 | 138 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 148 const GrowableObjectArray& libraries_; | 159 const GrowableObjectArray& libraries_; |
| 149 const GrowableObjectArray& pending_functions_; | 160 const GrowableObjectArray& pending_functions_; |
| 150 SymbolSet sent_selectors_; | 161 SymbolSet sent_selectors_; |
| 151 FunctionSet enqueued_functions_; | 162 FunctionSet enqueued_functions_; |
| 152 Error& error_; | 163 Error& error_; |
| 153 }; | 164 }; |
| 154 | 165 |
| 155 } // namespace dart | 166 } // namespace dart |
| 156 | 167 |
| 157 #endif // VM_PRECOMPILER_H_ | 168 #endif // VM_PRECOMPILER_H_ |
| OLD | NEW |