OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC. |
6 #if defined(TARGET_ARCH_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
7 | 7 |
8 #include "vm/instructions.h" | 8 #include "vm/instructions.h" |
9 #include "vm/instructions_dbc.h" | 9 #include "vm/instructions_dbc.h" |
10 | 10 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 void CallPattern::InsertDeoptCallAt(uword pc, uword target_address) { | 184 void CallPattern::InsertDeoptCallAt(uword pc, uword target_address) { |
185 const uint8_t argc = Bytecode::IsCallOpcode(Bytecode::At(pc)) ? | 185 const uint8_t argc = Bytecode::IsCallOpcode(Bytecode::At(pc)) ? |
186 Bytecode::DecodeArgc(Bytecode::At(pc)) : 0; | 186 Bytecode::DecodeArgc(Bytecode::At(pc)) : 0; |
187 *reinterpret_cast<Instr*>(pc) = Bytecode::Encode(Bytecode::kDeopt, argc, 0); | 187 *reinterpret_cast<Instr*>(pc) = Bytecode::Encode(Bytecode::kDeopt, argc, 0); |
188 } | 188 } |
189 | 189 |
190 | 190 |
191 SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) | 191 SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) |
192 : object_pool_(ObjectPool::Handle(code.GetObjectPool())), | 192 : object_pool_(ObjectPool::Handle(code.GetObjectPool())), |
193 cache_pool_index_(-1), | 193 data_pool_index_(-1), |
194 stub_pool_index_(-1) { | 194 target_pool_index_(-1) { |
195 UNIMPLEMENTED(); | 195 UNIMPLEMENTED(); |
196 } | 196 } |
197 | 197 |
198 | 198 |
199 RawObject* SwitchableCallPattern::cache() const { | 199 RawObject* SwitchableCallPattern::data() const { |
200 return reinterpret_cast<RawCode*>( | 200 return object_pool_.ObjectAt(data_pool_index_); |
201 object_pool_.ObjectAt(cache_pool_index_)); | |
202 } | 201 } |
203 | 202 |
204 | 203 |
205 void SwitchableCallPattern::SetCache(const MegamorphicCache& cache) const { | 204 RawCode* SwitchableCallPattern::target() const { |
206 ASSERT(Object::Handle(object_pool_.ObjectAt(cache_pool_index_)).IsICData()); | 205 return reinterpret_cast<RawCode*>( |
207 object_pool_.SetObjectAt(cache_pool_index_, cache); | 206 object_pool_.ObjectAt(target_pool_index_)); |
208 } | 207 } |
209 | 208 |
210 | 209 |
211 void SwitchableCallPattern::SetLookupStub(const Code& lookup_stub) const { | 210 void SwitchableCallPattern::SetData(const Object& data) const { |
212 ASSERT(Object::Handle(object_pool_.ObjectAt(stub_pool_index_)).IsCode()); | 211 ASSERT(!Object::Handle(object_pool_.ObjectAt(data_pool_index_)).IsCode()); |
213 object_pool_.SetObjectAt(stub_pool_index_, lookup_stub); | 212 object_pool_.SetObjectAt(data_pool_index_, data); |
214 } | 213 } |
215 | 214 |
216 | 215 |
| 216 void SwitchableCallPattern::SetTarget(const Code& target) const { |
| 217 ASSERT(Object::Handle(object_pool_.ObjectAt(target_pool_index_)).IsCode()); |
| 218 object_pool_.SetObjectAt(target_pool_index_, target); |
| 219 } |
| 220 |
| 221 |
217 ReturnPattern::ReturnPattern(uword pc) : pc_(pc) { | 222 ReturnPattern::ReturnPattern(uword pc) : pc_(pc) { |
218 USE(pc_); | 223 USE(pc_); |
219 } | 224 } |
220 | 225 |
221 | 226 |
222 bool ReturnPattern::IsValid() const { | 227 bool ReturnPattern::IsValid() const { |
223 UNIMPLEMENTED(); | 228 UNIMPLEMENTED(); |
224 return false; | 229 return false; |
225 } | 230 } |
226 | 231 |
227 } // namespace dart | 232 } // namespace dart |
228 | 233 |
229 #endif // defined TARGET_ARCH_DBC | 234 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |