| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return key->PcOffset(); | 57 return key->PcOffset(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 static inline bool IsKeyEqual(Pair pair, Key key) { | 60 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 61 return pair->Equals(*key); | 61 return pair->Equals(*key); |
| 62 } | 62 } |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 typedef DirectChainedHashMap<StackmapKeyValueTrait> StackmapSet; | 65 typedef DirectChainedHashMap<StackmapKeyValueTrait> StackmapSet; |
| 66 | 66 |
| 67 |
| 68 class ArrayKeyValueTrait { |
| 69 public: |
| 70 // Typedefs needed for the DirectChainedHashMap template. |
| 71 typedef const Array* Key; |
| 72 typedef const Array* Value; |
| 73 typedef const Array* Pair; |
| 74 |
| 75 static Key KeyOf(Pair kv) { return kv; } |
| 76 |
| 77 static Value ValueOf(Pair kv) { return kv; } |
| 78 |
| 79 static inline intptr_t Hashcode(Key key) { |
| 80 return key->Length(); |
| 81 } |
| 82 |
| 83 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 84 if (pair->Length() != key->Length()) { |
| 85 return false; |
| 86 } |
| 87 for (intptr_t i = 0; i < pair->Length(); i++) { |
| 88 if (pair->At(i) != key->At(i)) { |
| 89 return false; |
| 90 } |
| 91 } |
| 92 return true; |
| 93 } |
| 94 }; |
| 95 |
| 96 typedef DirectChainedHashMap<ArrayKeyValueTrait> ArraySet; |
| 97 |
| 98 |
| 67 class FunctionKeyValueTrait { | 99 class FunctionKeyValueTrait { |
| 68 public: | 100 public: |
| 69 // Typedefs needed for the DirectChainedHashMap template. | 101 // Typedefs needed for the DirectChainedHashMap template. |
| 70 typedef const Function* Key; | 102 typedef const Function* Key; |
| 71 typedef const Function* Value; | 103 typedef const Function* Value; |
| 72 typedef const Function* Pair; | 104 typedef const Function* Pair; |
| 73 | 105 |
| 74 static Key KeyOf(Pair kv) { return kv; } | 106 static Key KeyOf(Pair kv) { return kv; } |
| 75 | 107 |
| 76 static Value ValueOf(Pair kv) { return kv; } | 108 static Value ValueOf(Pair kv) { return kv; } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 bool IsSent(const String& selector); | 177 bool IsSent(const String& selector); |
| 146 | 178 |
| 147 void ProcessFunction(const Function& function); | 179 void ProcessFunction(const Function& function); |
| 148 void CheckForNewDynamicFunctions(); | 180 void CheckForNewDynamicFunctions(); |
| 149 | 181 |
| 150 void DropUncompiledFunctions(); | 182 void DropUncompiledFunctions(); |
| 151 void DropFields(); | 183 void DropFields(); |
| 152 void CollectDynamicFunctionNames(); | 184 void CollectDynamicFunctionNames(); |
| 153 void BindStaticCalls(); | 185 void BindStaticCalls(); |
| 154 void DedupStackmaps(); | 186 void DedupStackmaps(); |
| 187 void DedupStackmapLists(); |
| 155 void ResetPrecompilerState(); | 188 void ResetPrecompilerState(); |
| 156 | 189 |
| 157 class FunctionVisitor : public ValueObject { | 190 class FunctionVisitor : public ValueObject { |
| 158 public: | 191 public: |
| 159 virtual ~FunctionVisitor() {} | 192 virtual ~FunctionVisitor() {} |
| 160 virtual void VisitFunction(const Function& function) = 0; | 193 virtual void VisitFunction(const Function& function) = 0; |
| 161 }; | 194 }; |
| 162 | 195 |
| 163 void VisitFunctions(FunctionVisitor* visitor); | 196 void VisitFunctions(FunctionVisitor* visitor); |
| 164 | 197 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 185 const GrowableObjectArray& pending_functions_; | 218 const GrowableObjectArray& pending_functions_; |
| 186 SymbolSet sent_selectors_; | 219 SymbolSet sent_selectors_; |
| 187 FunctionSet enqueued_functions_; | 220 FunctionSet enqueued_functions_; |
| 188 FieldSet fields_to_retain_; | 221 FieldSet fields_to_retain_; |
| 189 Error& error_; | 222 Error& error_; |
| 190 }; | 223 }; |
| 191 | 224 |
| 192 } // namespace dart | 225 } // namespace dart |
| 193 | 226 |
| 194 #endif // VM_PRECOMPILER_H_ | 227 #endif // VM_PRECOMPILER_H_ |
| OLD | NEW |