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 RUNTIME_VM_PRECOMPILER_H_ | 5 #ifndef RUNTIME_VM_PRECOMPILER_H_ |
6 #define RUNTIME_VM_PRECOMPILER_H_ | 6 #define RUNTIME_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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 static inline intptr_t Hashcode(Key key) { return key->Hash(); } | 60 static inline intptr_t Hashcode(Key key) { return key->Hash(); } |
61 | 61 |
62 static inline bool IsKeyEqual(Pair pair, Key key) { | 62 static inline bool IsKeyEqual(Pair pair, Key key) { |
63 return pair->raw() == key->raw(); | 63 return pair->raw() == key->raw(); |
64 } | 64 } |
65 }; | 65 }; |
66 | 66 |
67 typedef DirectChainedHashMap<SymbolKeyValueTrait> SymbolSet; | 67 typedef DirectChainedHashMap<SymbolKeyValueTrait> SymbolSet; |
68 | 68 |
69 class StackMapKeyValueTrait { | |
70 public: | |
71 // Typedefs needed for the DirectChainedHashMap template. | |
72 typedef const StackMap* Key; | |
73 typedef const StackMap* Value; | |
74 typedef const StackMap* Pair; | |
75 | |
76 static Key KeyOf(Pair kv) { return kv; } | |
77 | |
78 static Value ValueOf(Pair kv) { return kv; } | |
79 | |
80 static inline intptr_t Hashcode(Key key) { return key->PcOffset(); } | |
81 | |
82 static inline bool IsKeyEqual(Pair pair, Key key) { | |
83 return pair->Equals(*key); | |
84 } | |
85 }; | |
86 | |
87 typedef DirectChainedHashMap<StackMapKeyValueTrait> StackMapSet; | |
88 | |
89 | |
90 class CodeSourceMapKeyValueTrait { | |
91 public: | |
92 // Typedefs needed for the DirectChainedHashMap template. | |
93 typedef const CodeSourceMap* Key; | |
94 typedef const CodeSourceMap* Value; | |
95 typedef const CodeSourceMap* Pair; | |
96 | |
97 static Key KeyOf(Pair kv) { return kv; } | |
98 | |
99 static Value ValueOf(Pair kv) { return kv; } | |
100 | |
101 static inline intptr_t Hashcode(Key key) { return key->Length(); } | |
102 | |
103 static inline bool IsKeyEqual(Pair pair, Key key) { | |
104 return pair->Equals(*key); | |
105 } | |
106 }; | |
107 | |
108 typedef DirectChainedHashMap<CodeSourceMapKeyValueTrait> CodeSourceMapSet; | |
109 | |
110 | |
111 class ArrayKeyValueTrait { | |
112 public: | |
113 // Typedefs needed for the DirectChainedHashMap template. | |
114 typedef const Array* Key; | |
115 typedef const Array* Value; | |
116 typedef const Array* Pair; | |
117 | |
118 static Key KeyOf(Pair kv) { return kv; } | |
119 | |
120 static Value ValueOf(Pair kv) { return kv; } | |
121 | |
122 static inline intptr_t Hashcode(Key key) { return key->Length(); } | |
123 | |
124 static inline bool IsKeyEqual(Pair pair, Key key) { | |
125 if (pair->Length() != key->Length()) { | |
126 return false; | |
127 } | |
128 for (intptr_t i = 0; i < pair->Length(); i++) { | |
129 if (pair->At(i) != key->At(i)) { | |
130 return false; | |
131 } | |
132 } | |
133 return true; | |
134 } | |
135 }; | |
136 | |
137 typedef DirectChainedHashMap<ArrayKeyValueTrait> ArraySet; | |
138 | |
139 | |
140 class InstructionsKeyValueTrait { | |
141 public: | |
142 // Typedefs needed for the DirectChainedHashMap template. | |
143 typedef const Instructions* Key; | |
144 typedef const Instructions* Value; | |
145 typedef const Instructions* Pair; | |
146 | |
147 static Key KeyOf(Pair kv) { return kv; } | |
148 | |
149 static Value ValueOf(Pair kv) { return kv; } | |
150 | |
151 static inline intptr_t Hashcode(Key key) { return key->Size(); } | |
152 | |
153 static inline bool IsKeyEqual(Pair pair, Key key) { | |
154 return pair->Equals(*key); | |
155 } | |
156 }; | |
157 | |
158 typedef DirectChainedHashMap<InstructionsKeyValueTrait> InstructionsSet; | |
159 | |
160 | 69 |
161 class UnlinkedCallKeyValueTrait { | 70 class UnlinkedCallKeyValueTrait { |
162 public: | 71 public: |
163 // Typedefs needed for the DirectChainedHashMap template. | 72 // Typedefs needed for the DirectChainedHashMap template. |
164 typedef const UnlinkedCall* Key; | 73 typedef const UnlinkedCall* Key; |
165 typedef const UnlinkedCall* Value; | 74 typedef const UnlinkedCall* Value; |
166 typedef const UnlinkedCall* Pair; | 75 typedef const UnlinkedCall* Pair; |
167 | 76 |
168 static Key KeyOf(Pair kv) { return kv; } | 77 static Key KeyOf(Pair kv) { return kv; } |
169 | 78 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 void DropFields(); | 400 void DropFields(); |
492 void TraceTypesFromRetainedClasses(); | 401 void TraceTypesFromRetainedClasses(); |
493 void DropTypes(); | 402 void DropTypes(); |
494 void DropTypeArguments(); | 403 void DropTypeArguments(); |
495 void DropScriptData(); | 404 void DropScriptData(); |
496 void DropClasses(); | 405 void DropClasses(); |
497 void DropLibraries(); | 406 void DropLibraries(); |
498 | 407 |
499 void BindStaticCalls(); | 408 void BindStaticCalls(); |
500 void SwitchICCalls(); | 409 void SwitchICCalls(); |
501 void ShareMegamorphicBuckets(); | |
502 void DedupStackMaps(); | |
503 void DedupCodeSourceMaps(); | |
504 void DedupLists(); | |
505 void DedupInstructions(); | |
506 void ResetPrecompilerState(); | 410 void ResetPrecompilerState(); |
507 | 411 |
508 void CollectDynamicFunctionNames(); | 412 void CollectDynamicFunctionNames(); |
509 | 413 |
510 void PrecompileStaticInitializers(); | 414 void PrecompileStaticInitializers(); |
511 void PrecompileConstructors(); | 415 void PrecompileConstructors(); |
512 | 416 |
513 void FinalizeAllClasses(); | 417 void FinalizeAllClasses(); |
514 void VerifyJITFeedback(); | 418 void VerifyJITFeedback(); |
515 RawScript* LookupScript(const char* uri); | 419 RawScript* LookupScript(const char* uri); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 } | 484 } |
581 static RawObject* NewKey(const Function& function) { return function.raw(); } | 485 static RawObject* NewKey(const Function& function) { return function.raw(); } |
582 }; | 486 }; |
583 | 487 |
584 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 488 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
585 | 489 |
586 | 490 |
587 } // namespace dart | 491 } // namespace dart |
588 | 492 |
589 #endif // RUNTIME_VM_PRECOMPILER_H_ | 493 #endif // RUNTIME_VM_PRECOMPILER_H_ |
OLD | NEW |