| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 imm_s_fixed >>= 1; | 295 imm_s_fixed >>= 1; |
| 296 continue; | 296 continue; |
| 297 } | 297 } |
| 298 | 298 |
| 299 // 6. Otherwise, the value can't be encoded. | 299 // 6. Otherwise, the value can't be encoded. |
| 300 return false; | 300 return false; |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 | 304 |
| 305 void Assembler::LoadPoolPointer() { | 305 void Assembler::LoadPoolPointer(Register pp) { |
| 306 const intptr_t object_pool_pc_dist = | 306 const intptr_t object_pool_pc_dist = |
| 307 Instructions::HeaderSize() - Instructions::object_pool_offset() + | 307 Instructions::HeaderSize() - Instructions::object_pool_offset() + |
| 308 CodeSize(); | 308 CodeSize(); |
| 309 // PP <- Read(PC - object_pool_pc_dist). | 309 // PP <- Read(PC - object_pool_pc_dist). |
| 310 ldr(PP, Address::PC(-object_pool_pc_dist)); | 310 ldr(pp, Address::PC(-object_pool_pc_dist)); |
| 311 | 311 |
| 312 // When in the PP register, the pool pointer is untagged. When we | 312 // When in the PP register, the pool pointer is untagged. When we |
| 313 // push it on the stack with TagAndPushPP it is tagged again. PopAndUntagPP | 313 // push it on the stack with TagAndPushPP it is tagged again. PopAndUntagPP |
| 314 // then untags when restoring from the stack. This will make loading from the | 314 // then untags when restoring from the stack. This will make loading from the |
| 315 // object pool only one instruction for the first 4096 entries. Otherwise, | 315 // object pool only one instruction for the first 4096 entries. Otherwise, |
| 316 // because the offset wouldn't be aligned, it would be only one instruction | 316 // because the offset wouldn't be aligned, it would be only one instruction |
| 317 // for the first 64 entries. | 317 // for the first 64 entries. |
| 318 sub(PP, PP, Operand(kHeapObjectTag)); | 318 sub(pp, pp, Operand(kHeapObjectTag)); |
| 319 set_constant_pool_allowed(true); | 319 set_constant_pool_allowed(pp == PP); |
| 320 } | 320 } |
| 321 | 321 |
| 322 | 322 |
| 323 void Assembler::LoadWordFromPoolOffset(Register dst, uint32_t offset) { | 323 void Assembler::LoadWordFromPoolOffset(Register dst, uint32_t offset) { |
| 324 ASSERT(constant_pool_allowed()); | 324 ASSERT(constant_pool_allowed()); |
| 325 ASSERT(dst != PP); | 325 ASSERT(dst != PP); |
| 326 Operand op; | 326 Operand op; |
| 327 const uint32_t upper20 = offset & 0xfffff000; | 327 const uint32_t upper20 = offset & 0xfffff000; |
| 328 if (Address::CanHoldOffset(offset)) { | 328 if (Address::CanHoldOffset(offset)) { |
| 329 ldr(dst, Address(PP, offset)); | 329 ldr(dst, Address(PP, offset)); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 is_unique ? object_pool_wrapper_.AddObject(object) | 420 is_unique ? object_pool_wrapper_.AddObject(object) |
| 421 : object_pool_wrapper_.FindObject(object)); | 421 : object_pool_wrapper_.FindObject(object)); |
| 422 LoadWordFromPoolOffset(dst, offset); | 422 LoadWordFromPoolOffset(dst, offset); |
| 423 } else { | 423 } else { |
| 424 ASSERT(object.IsSmi() || object.InVMHeap()); | 424 ASSERT(object.IsSmi() || object.InVMHeap()); |
| 425 LoadDecodableImmediate(dst, reinterpret_cast<int64_t>(object.raw())); | 425 LoadDecodableImmediate(dst, reinterpret_cast<int64_t>(object.raw())); |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 | 428 |
| 429 | 429 |
| 430 void Assembler::LoadFunctionFromNewPool(Register dst, |
| 431 const Function& function, |
| 432 Register new_pp) { |
| 433 ASSERT(!constant_pool_allowed()); |
| 434 ASSERT(new_pp != PP); |
| 435 const int32_t offset = |
| 436 ObjectPool::element_offset(object_pool_wrapper_.FindObject(function)); |
| 437 ASSERT(Address::CanHoldOffset(offset)); |
| 438 ldr(dst, Address(new_pp, offset)); |
| 439 } |
| 440 |
| 441 |
| 430 void Assembler::LoadObject(Register dst, const Object& object) { | 442 void Assembler::LoadObject(Register dst, const Object& object) { |
| 431 LoadObjectHelper(dst, object, false); | 443 LoadObjectHelper(dst, object, false); |
| 432 } | 444 } |
| 433 | 445 |
| 434 | 446 |
| 435 void Assembler::LoadUniqueObject(Register dst, const Object& object) { | 447 void Assembler::LoadUniqueObject(Register dst, const Object& object) { |
| 436 LoadObjectHelper(dst, object, true); | 448 LoadObjectHelper(dst, object, true); |
| 437 } | 449 } |
| 438 | 450 |
| 439 | 451 |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 add(base, array, Operand(index, LSL, shift)); | 1448 add(base, array, Operand(index, LSL, shift)); |
| 1437 } | 1449 } |
| 1438 const OperandSize size = Address::OperandSizeFor(cid); | 1450 const OperandSize size = Address::OperandSizeFor(cid); |
| 1439 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1451 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| 1440 return Address(base, offset, Address::Offset, size); | 1452 return Address(base, offset, Address::Offset, size); |
| 1441 } | 1453 } |
| 1442 | 1454 |
| 1443 } // namespace dart | 1455 } // namespace dart |
| 1444 | 1456 |
| 1445 #endif // defined TARGET_ARCH_ARM64 | 1457 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |