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 RUNTIME_VM_STUB_CODE_H_ | 5 #ifndef RUNTIME_VM_STUB_CODE_H_ |
6 #define RUNTIME_VM_STUB_CODE_H_ | 6 #define RUNTIME_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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 static void EntryAtPut(intptr_t index, StubEntry* entry) { | 162 static void EntryAtPut(intptr_t index, StubEntry* entry) { |
163 entries_[index] = entry; | 163 entries_[index] = entry; |
164 } | 164 } |
165 static intptr_t NumEntries() { return kNumStubEntries; } | 165 static intptr_t NumEntries() { return kNumStubEntries; } |
166 | 166 |
167 private: | 167 private: |
168 friend class MegamorphicCacheTable; | 168 friend class MegamorphicCacheTable; |
169 | 169 |
170 static const intptr_t kStubCodeSize = 4 * KB; | 170 static const intptr_t kStubCodeSize = 4 * KB; |
171 | 171 |
172 #define STUB_CODE_GENERATE(name) \ | |
173 static void Generate##name##Stub(Assembler* assembler); | |
174 VM_STUB_CODE_LIST(STUB_CODE_GENERATE) | |
175 #undef STUB_CODE_GENERATE | |
176 | |
177 enum { | 172 enum { |
178 #define STUB_CODE_ENTRY(name) k##name##Index, | 173 #define STUB_CODE_ENTRY(name) k##name##Index, |
179 VM_STUB_CODE_LIST(STUB_CODE_ENTRY) | 174 VM_STUB_CODE_LIST(STUB_CODE_ENTRY) |
180 #undef STUB_CODE_ENTRY | 175 #undef STUB_CODE_ENTRY |
181 kNumStubEntries | 176 kNumStubEntries |
182 }; | 177 }; |
183 | 178 |
184 static StubEntry* entries_[kNumStubEntries]; | 179 static StubEntry* entries_[kNumStubEntries]; |
185 | 180 |
| 181 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 182 #define STUB_CODE_GENERATE(name) \ |
| 183 static void Generate##name##Stub(Assembler* assembler); |
| 184 VM_STUB_CODE_LIST(STUB_CODE_GENERATE) |
| 185 #undef STUB_CODE_GENERATE |
| 186 |
186 // Generate the stub and finalize the generated code into the stub | 187 // Generate the stub and finalize the generated code into the stub |
187 // code executable area. | 188 // code executable area. |
188 static RawCode* Generate(const char* name, | 189 static RawCode* Generate(const char* name, |
189 void (*GenerateStub)(Assembler* assembler)); | 190 void (*GenerateStub)(Assembler* assembler)); |
190 | 191 |
191 static void GenerateMegamorphicMissStub(Assembler* assembler); | 192 static void GenerateMegamorphicMissStub(Assembler* assembler); |
192 static void GenerateAllocationStubForClass(Assembler* assembler, | 193 static void GenerateAllocationStubForClass(Assembler* assembler, |
193 const Class& cls); | 194 const Class& cls); |
194 static void GenerateNArgsCheckInlineCacheStub( | 195 static void GenerateNArgsCheckInlineCacheStub( |
195 Assembler* assembler, | 196 Assembler* assembler, |
196 intptr_t num_args, | 197 intptr_t num_args, |
197 const RuntimeEntry& handle_ic_miss, | 198 const RuntimeEntry& handle_ic_miss, |
198 Token::Kind kind, | 199 Token::Kind kind, |
199 bool optimized = false); | 200 bool optimized = false); |
200 static void GenerateUsageCounterIncrement(Assembler* assembler, | 201 static void GenerateUsageCounterIncrement(Assembler* assembler, |
201 Register temp_reg); | 202 Register temp_reg); |
202 static void GenerateOptimizedUsageCounterIncrement(Assembler* assembler); | 203 static void GenerateOptimizedUsageCounterIncrement(Assembler* assembler); |
| 204 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
203 }; | 205 }; |
204 | 206 |
205 enum DeoptStubKind { kLazyDeoptFromReturn, kLazyDeoptFromThrow, kEagerDeopt }; | 207 enum DeoptStubKind { kLazyDeoptFromReturn, kLazyDeoptFromThrow, kEagerDeopt }; |
206 | 208 |
207 // Zap value used to indicate unused CODE_REG in deopt. | 209 // Zap value used to indicate unused CODE_REG in deopt. |
208 static const uword kZapCodeReg = 0xf1f1f1f1; | 210 static const uword kZapCodeReg = 0xf1f1f1f1; |
209 | 211 |
210 // Zap value used to indicate unused return address in deopt. | 212 // Zap value used to indicate unused return address in deopt. |
211 static const uword kZapReturnAddress = 0xe1e1e1e1; | 213 static const uword kZapReturnAddress = 0xe1e1e1e1; |
212 | 214 |
213 } // namespace dart | 215 } // namespace dart |
214 | 216 |
215 #endif // RUNTIME_VM_STUB_CODE_H_ | 217 #endif // RUNTIME_VM_STUB_CODE_H_ |
OLD | NEW |