OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_STUB_CODE_H_ | 5 #ifndef VM_STUB_CODE_H_ |
6 #define VM_STUB_CODE_H_ | 6 #define VM_STUB_CODE_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 152 } |
153 STUB_CODE_LIST(STUB_CODE_ACCESSOR); | 153 STUB_CODE_LIST(STUB_CODE_ACCESSOR); |
154 #undef STUB_CODE_ACCESSOR | 154 #undef STUB_CODE_ACCESSOR |
155 | 155 |
156 static RawCode* GetAllocationStubForClass(const Class& cls); | 156 static RawCode* GetAllocationStubForClass(const Class& cls); |
157 static RawCode* GetAllocationStubForClosure(const Function& func); | 157 static RawCode* GetAllocationStubForClosure(const Function& func); |
158 | 158 |
159 static const intptr_t kNoInstantiator = 0; | 159 static const intptr_t kNoInstantiator = 0; |
160 | 160 |
161 private: | 161 private: |
| 162 friend class MegamorphicCacheTable; |
| 163 |
162 static const intptr_t kStubCodeSize = 4 * KB; | 164 static const intptr_t kStubCodeSize = 4 * KB; |
163 | 165 |
164 #define STUB_CODE_GENERATE(name) \ | 166 #define STUB_CODE_GENERATE(name) \ |
165 static void Generate##name##Stub(Assembler* assembler); | 167 static void Generate##name##Stub(Assembler* assembler); |
166 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); | 168 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); |
167 STUB_CODE_LIST(STUB_CODE_GENERATE); | 169 STUB_CODE_LIST(STUB_CODE_GENERATE); |
168 #undef STUB_CODE_GENERATE | 170 #undef STUB_CODE_GENERATE |
169 | 171 |
170 #define STUB_CODE_ENTRY(name) \ | 172 #define STUB_CODE_ENTRY(name) \ |
171 static StubEntry* name##_entry_; | 173 static StubEntry* name##_entry_; |
172 VM_STUB_CODE_LIST(STUB_CODE_ENTRY); | 174 VM_STUB_CODE_LIST(STUB_CODE_ENTRY); |
173 #undef STUB_CODE_ENTRY | 175 #undef STUB_CODE_ENTRY |
174 | 176 |
175 #define STUB_CODE_ENTRY(name) \ | 177 #define STUB_CODE_ENTRY(name) \ |
176 StubEntry* name##_entry_; | 178 StubEntry* name##_entry_; |
177 STUB_CODE_LIST(STUB_CODE_ENTRY); | 179 STUB_CODE_LIST(STUB_CODE_ENTRY); |
178 #undef STUB_CODE_ENTRY | 180 #undef STUB_CODE_ENTRY |
179 // This dummy field is needed so that we can intialize the stubs from a macro. | 181 // This dummy field is needed so that we can intialize the stubs from a macro. |
180 void* dummy_; | 182 void* dummy_; |
181 | 183 |
182 // Generate the stub and finalize the generated code into the stub | 184 // Generate the stub and finalize the generated code into the stub |
183 // code executable area. | 185 // code executable area. |
184 static RawCode* Generate(const char* name, | 186 static RawCode* Generate(const char* name, |
185 void (*GenerateStub)(Assembler* assembler)); | 187 void (*GenerateStub)(Assembler* assembler)); |
186 | 188 |
| 189 static void GenerateMegamorphicMissStub(Assembler* assembler); |
187 static void GenerateAllocationStubForClass(Assembler* assembler, | 190 static void GenerateAllocationStubForClass(Assembler* assembler, |
188 const Class& cls); | 191 const Class& cls); |
189 static void GenerateAllocationStubForClosure(Assembler* assembler, | 192 static void GenerateAllocationStubForClosure(Assembler* assembler, |
190 const Function& func); | 193 const Function& func); |
191 static void GenerateNArgsCheckInlineCacheStub(Assembler* assembler, | 194 static void GenerateNArgsCheckInlineCacheStub(Assembler* assembler, |
192 intptr_t num_args); | 195 intptr_t num_args); |
193 static void GenerateUsageCounterIncrement(Assembler* assembler, | 196 static void GenerateUsageCounterIncrement(Assembler* assembler, |
194 Register temp_reg); | 197 Register temp_reg); |
195 static void GenerateOptimizedUsageCounterIncrement(Assembler* assembler); | 198 static void GenerateOptimizedUsageCounterIncrement(Assembler* assembler); |
196 }; | 199 }; |
197 | 200 |
198 } // namespace dart | 201 } // namespace dart |
199 | 202 |
200 #endif // VM_STUB_CODE_H_ | 203 #endif // VM_STUB_CODE_H_ |
OLD | NEW |