Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: runtime/vm/instructions_mips.cc

Issue 2226893002: Optimize AOT's switchable calls for the monomorphic case. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/instructions_mips.h ('k') | runtime/vm/instructions_mips_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/constants_mips.h" 8 #include "vm/constants_mips.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/instructions.h" 10 #include "vm/instructions.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 jr->SetSpecialInstrBits(JALR, T9, ZR, RA); 230 jr->SetSpecialInstrBits(JALR, T9, ZR, RA);
231 nop->SetInstructionBits(Instr::kNopInstruction); 231 nop->SetInstructionBits(Instr::kNopInstruction);
232 232
233 ASSERT(kDeoptCallLengthInBytes == 4 * Instr::kInstrSize); 233 ASSERT(kDeoptCallLengthInBytes == 4 * Instr::kInstrSize);
234 CPU::FlushICache(pc, kDeoptCallLengthInBytes); 234 CPU::FlushICache(pc, kDeoptCallLengthInBytes);
235 } 235 }
236 236
237 237
238 SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) 238 SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code)
239 : object_pool_(ObjectPool::Handle(code.GetObjectPool())), 239 : object_pool_(ObjectPool::Handle(code.GetObjectPool())),
240 cache_pool_index_(-1), 240 data_pool_index_(-1),
241 stub_pool_index_(-1) { 241 target_pool_index_(-1) {
242 ASSERT(code.ContainsInstructionAt(pc)); 242 ASSERT(code.ContainsInstructionAt(pc));
243 // Last instruction: jalr t1. 243 // Last instruction: jalr t9.
244 ASSERT(*(reinterpret_cast<uword*>(pc) - 1) == 0); // Delay slot. 244 ASSERT(*(reinterpret_cast<uword*>(pc) - 1) == 0); // Delay slot.
245 ASSERT(*(reinterpret_cast<uword*>(pc) - 2) == 0x0120f809); 245 ASSERT(*(reinterpret_cast<uword*>(pc) - 2) == 0x0320f809);
246 246
247 Register reg; 247 Register reg;
248 uword stub_load_end = 248 uword stub_load_end =
249 InstructionPattern::DecodeLoadWordFromPool(pc - 5 * Instr::kInstrSize, 249 InstructionPattern::DecodeLoadWordFromPool(pc - 3 * Instr::kInstrSize,
250 &reg, 250 &reg,
251 &stub_pool_index_); 251 &target_pool_index_);
252 ASSERT(reg == CODE_REG); 252 ASSERT(reg == CODE_REG);
253 InstructionPattern::DecodeLoadWordFromPool(stub_load_end, 253 InstructionPattern::DecodeLoadWordFromPool(stub_load_end,
254 &reg, 254 &reg,
255 &cache_pool_index_); 255 &data_pool_index_);
256 ASSERT(reg == S5); 256 ASSERT(reg == S5);
257 } 257 }
258 258
259 259
260 RawObject* SwitchableCallPattern::cache() const { 260 RawObject* SwitchableCallPattern::data() const {
261 return reinterpret_cast<RawCode*>( 261 return object_pool_.ObjectAt(data_pool_index_);
262 object_pool_.ObjectAt(cache_pool_index_));
263 } 262 }
264 263
265 264
266 void SwitchableCallPattern::SetCache(const MegamorphicCache& cache) const { 265 RawCode* SwitchableCallPattern::target() const {
267 ASSERT(Object::Handle(object_pool_.ObjectAt(cache_pool_index_)).IsICData()); 266 return reinterpret_cast<RawCode*>(
268 object_pool_.SetObjectAt(cache_pool_index_, cache); 267 object_pool_.ObjectAt(target_pool_index_));
269 } 268 }
270 269
271 270
272 void SwitchableCallPattern::SetLookupStub(const Code& lookup_stub) const { 271 void SwitchableCallPattern::SetData(const Object& data) const {
273 ASSERT(Object::Handle(object_pool_.ObjectAt(stub_pool_index_)).IsCode()); 272 ASSERT(!Object::Handle(object_pool_.ObjectAt(data_pool_index_)).IsCode());
274 object_pool_.SetObjectAt(stub_pool_index_, lookup_stub); 273 object_pool_.SetObjectAt(data_pool_index_, data);
275 } 274 }
276 275
277 276
277 void SwitchableCallPattern::SetTarget(const Code& target) const {
278 ASSERT(Object::Handle(object_pool_.ObjectAt(target_pool_index_)).IsCode());
279 object_pool_.SetObjectAt(target_pool_index_, target);
280 }
281
282
278 ReturnPattern::ReturnPattern(uword pc) 283 ReturnPattern::ReturnPattern(uword pc)
279 : pc_(pc) { 284 : pc_(pc) {
280 } 285 }
281 286
282 287
283 bool ReturnPattern::IsValid() const { 288 bool ReturnPattern::IsValid() const {
284 Instr* jr = Instr::At(pc_); 289 Instr* jr = Instr::At(pc_);
285 return (jr->OpcodeField() == SPECIAL) && 290 return (jr->OpcodeField() == SPECIAL) &&
286 (jr->FunctionField() == JR) && 291 (jr->FunctionField() == JR) &&
287 (jr->RsField() == RA); 292 (jr->RsField() == RA);
288 } 293 }
289 294
290 } // namespace dart 295 } // namespace dart
291 296
292 #endif // defined TARGET_ARCH_MIPS 297 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/instructions_mips.h ('k') | runtime/vm/instructions_mips_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698