Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 Patchability patchable) { | 499 Patchability patchable) { |
| 500 BranchLink(&stub_entry.label(), patchable); | 500 BranchLink(&stub_entry.label(), patchable); |
| 501 } | 501 } |
| 502 | 502 |
| 503 | 503 |
| 504 void Assembler::BranchLinkPatchable(const StubEntry& stub_entry) { | 504 void Assembler::BranchLinkPatchable(const StubEntry& stub_entry) { |
| 505 BranchLink(&stub_entry.label(), kPatchable); | 505 BranchLink(&stub_entry.label(), kPatchable); |
| 506 } | 506 } |
| 507 | 507 |
| 508 | 508 |
| 509 bool Assembler::CanLoadFromObjectPool(const Object& object) const { | |
| 510 ASSERT(!Thread::CanLoadFromThread(object)); | |
| 511 if (!constant_pool_allowed()) { | |
| 512 return false; | |
| 513 } | |
| 514 | |
| 515 ASSERT(object.IsNotTemporaryScopedHandle()); | |
| 516 ASSERT(object.IsOld()); | |
| 517 return true; | |
| 518 } | |
| 519 | |
| 520 | |
| 509 void Assembler::LoadObjectHelper(Register rd, | 521 void Assembler::LoadObjectHelper(Register rd, |
| 510 const Object& object, | 522 const Object& object, |
| 511 bool is_unique) { | 523 bool is_unique) { |
| 512 // Load common VM constants from the thread. This works also in places where | 524 ASSERT(!in_delay_slot_); |
| 513 // no constant pool is set up (e.g. intrinsic code). | |
| 514 if (Thread::CanLoadFromThread(object)) { | 525 if (Thread::CanLoadFromThread(object)) { |
| 526 // Load common VM constants from the thread. This works also in places where | |
| 527 // no constant pool is set up (e.g. intrinsic code). | |
| 515 lw(rd, Address(THR, Thread::OffsetFromThread(object))); | 528 lw(rd, Address(THR, Thread::OffsetFromThread(object))); |
| 516 return; | 529 } else if (object.IsSmi()) { |
| 517 } | 530 // Relocation doesn't apply to Smis. |
| 518 ASSERT(!in_delay_slot_); | |
| 519 // Smis and VM heap objects are never relocated; do not use object pool. | |
| 520 if (object.IsSmi()) { | |
| 521 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw())); | 531 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw())); |
| 522 } else if (object.InVMHeap() || !constant_pool_allowed()) { | 532 } else if (CanLoadFromObjectPool(object)) { |
| 533 // Make sure that class CallPattern is able to decode this load from the | |
| 534 // object pool. | |
| 535 const int32_t offset = ObjectPool::element_offset( | |
| 536 is_unique ? object_pool_wrapper_.AddObject(object) | |
| 537 : object_pool_wrapper_.FindObject(object)); | |
| 538 LoadWordFromPoolOffset(rd, offset - kHeapObjectTag); | |
| 539 } else { | |
| 523 ASSERT(FLAG_allow_absolute_addresses); | 540 ASSERT(FLAG_allow_absolute_addresses); |
| 541 ASSERT(object.IsOld()); | |
| 524 // Make sure that class CallPattern is able to decode this load immediate. | 542 // Make sure that class CallPattern is able to decode this load immediate. |
|
Florian Schneider
2015/09/16 08:00:05
Comment does not apply here.
| |
| 525 int32_t object_raw = reinterpret_cast<int32_t>(object.raw()); | 543 int32_t object_raw = reinterpret_cast<int32_t>(object.raw()); |
| 526 const uint16_t object_low = Utils::Low16Bits(object_raw); | 544 const uint16_t object_low = Utils::Low16Bits(object_raw); |
| 527 const uint16_t object_high = Utils::High16Bits(object_raw); | 545 const uint16_t object_high = Utils::High16Bits(object_raw); |
| 528 lui(rd, Immediate(object_high)); | 546 lui(rd, Immediate(object_high)); |
| 529 ori(rd, rd, Immediate(object_low)); | 547 ori(rd, rd, Immediate(object_low)); |
| 530 } else { | |
| 531 // Make sure that class CallPattern is able to decode this load from the | |
| 532 // object pool. | |
| 533 const int32_t offset = ObjectPool::element_offset( | |
| 534 is_unique ? object_pool_wrapper_.AddObject(object) | |
| 535 : object_pool_wrapper_.FindObject(object)); | |
| 536 LoadWordFromPoolOffset(rd, offset - kHeapObjectTag); | |
| 537 } | 548 } |
| 538 } | 549 } |
| 539 | 550 |
| 540 | 551 |
| 541 void Assembler::LoadObject(Register rd, const Object& object) { | 552 void Assembler::LoadObject(Register rd, const Object& object) { |
| 542 LoadObjectHelper(rd, object, false); | 553 LoadObjectHelper(rd, object, false); |
| 543 } | 554 } |
| 544 | 555 |
| 545 | 556 |
| 546 void Assembler::LoadUniqueObject(Register rd, const Object& object) { | 557 void Assembler::LoadUniqueObject(Register rd, const Object& object) { |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1334 Label stop; | 1345 Label stop; |
| 1335 b(&stop); | 1346 b(&stop); |
| 1336 Emit(reinterpret_cast<int32_t>(message)); | 1347 Emit(reinterpret_cast<int32_t>(message)); |
| 1337 Bind(&stop); | 1348 Bind(&stop); |
| 1338 break_(Instr::kStopMessageCode); | 1349 break_(Instr::kStopMessageCode); |
| 1339 } | 1350 } |
| 1340 | 1351 |
| 1341 } // namespace dart | 1352 } // namespace dart |
| 1342 | 1353 |
| 1343 #endif // defined TARGET_ARCH_MIPS | 1354 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |