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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1563 LoadFromOffset(kWord, PP, PC, -object_pool_pc_dist); | 1563 LoadFromOffset(kWord, PP, PC, -object_pool_pc_dist); |
| 1564 set_constant_pool_allowed(true); | 1564 set_constant_pool_allowed(true); |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 | 1567 |
| 1568 void Assembler::LoadIsolate(Register rd) { | 1568 void Assembler::LoadIsolate(Register rd) { |
| 1569 ldr(rd, Address(THR, Thread::isolate_offset())); | 1569 ldr(rd, Address(THR, Thread::isolate_offset())); |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 | 1572 |
| 1573 bool Assembler::CanLoadFromObjectPool(const Object& object) const { | |
| 1574 ASSERT(!Thread::CanLoadFromThread(object)); | |
| 1575 if (!constant_pool_allowed()) { | |
| 1576 return false; | |
| 1577 } | |
| 1578 | |
| 1579 ASSERT(object.IsNotTemporaryScopedHandle()); | |
| 1580 ASSERT(object.IsOld()); | |
| 1581 return true; | |
| 1582 } | |
| 1583 | |
| 1584 | |
| 1573 void Assembler::LoadObjectHelper(Register rd, | 1585 void Assembler::LoadObjectHelper(Register rd, |
| 1574 const Object& object, | 1586 const Object& object, |
| 1575 Condition cond, | 1587 Condition cond, |
| 1576 bool is_unique) { | 1588 bool is_unique) { |
| 1577 // Load common VM constants from the thread. This works also in places where | |
| 1578 // no constant pool is set up (e.g. intrinsic code). | |
| 1579 if (Thread::CanLoadFromThread(object)) { | 1589 if (Thread::CanLoadFromThread(object)) { |
| 1590 // Load common VM constants from the thread. This works also in places where | |
| 1591 // no constant pool is set up (e.g. intrinsic code). | |
| 1580 ldr(rd, Address(THR, Thread::OffsetFromThread(object)), cond); | 1592 ldr(rd, Address(THR, Thread::OffsetFromThread(object)), cond); |
| 1581 return; | 1593 } else if (object.IsSmi()) { |
| 1582 } | 1594 // Relocation doesn't apply to Smis. |
| 1583 // Smis and VM heap objects are never relocated; do not use object pool. | |
| 1584 if (object.IsSmi()) { | |
| 1585 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw()), cond); | 1595 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw()), cond); |
| 1586 } else if (object.InVMHeap() || !constant_pool_allowed()) { | 1596 } else if (CanLoadFromObjectPool(object)) { |
| 1587 ASSERT(FLAG_allow_absolute_addresses); | |
| 1588 // Make sure that class CallPattern is able to decode this load immediate. | |
| 1589 const int32_t object_raw = reinterpret_cast<int32_t>(object.raw()); | |
| 1590 LoadImmediate(rd, object_raw, cond); | |
| 1591 } else { | |
| 1592 // Make sure that class CallPattern is able to decode this load from the | 1597 // Make sure that class CallPattern is able to decode this load from the |
| 1593 // object pool. | 1598 // object pool. |
| 1594 const int32_t offset = ObjectPool::element_offset( | 1599 const int32_t offset = ObjectPool::element_offset( |
| 1595 is_unique ? object_pool_wrapper_.AddObject(object) | 1600 is_unique ? object_pool_wrapper_.AddObject(object) |
| 1596 : object_pool_wrapper_.FindObject(object)); | 1601 : object_pool_wrapper_.FindObject(object)); |
| 1597 LoadWordFromPoolOffset(rd, offset - kHeapObjectTag, cond); | 1602 LoadWordFromPoolOffset(rd, offset - kHeapObjectTag, cond); |
| 1603 } else { | |
| 1604 ASSERT(FLAG_allow_absolute_addresses); | |
| 1605 ASSERT(object.IsOld()); | |
| 1606 // Make sure that class CallPattern is able to decode this load immediate. | |
|
Florian Schneider
2015/09/16 08:00:05
I don't think the comment applies to this case sin
rmacnak
2015/09/16 17:09:42
Hm, CallPattern expects a constant pool load in it
| |
| 1607 const int32_t object_raw = reinterpret_cast<int32_t>(object.raw()); | |
| 1608 LoadImmediate(rd, object_raw, cond); | |
| 1598 } | 1609 } |
| 1599 } | 1610 } |
| 1600 | 1611 |
| 1601 | 1612 |
| 1602 void Assembler::LoadObject(Register rd, const Object& object, Condition cond) { | 1613 void Assembler::LoadObject(Register rd, const Object& object, Condition cond) { |
| 1603 LoadObjectHelper(rd, object, cond, false); | 1614 LoadObjectHelper(rd, object, cond, false); |
| 1604 } | 1615 } |
| 1605 | 1616 |
| 1606 | 1617 |
| 1607 void Assembler::LoadUniqueObject(Register rd, | 1618 void Assembler::LoadUniqueObject(Register rd, |
| (...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3663 | 3674 |
| 3664 | 3675 |
| 3665 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3676 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3666 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3677 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
| 3667 return fpu_reg_names[reg]; | 3678 return fpu_reg_names[reg]; |
| 3668 } | 3679 } |
| 3669 | 3680 |
| 3670 } // namespace dart | 3681 } // namespace dart |
| 3671 | 3682 |
| 3672 #endif // defined TARGET_ARCH_ARM | 3683 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |