| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 movz(reg, Immediate(h0), 0); | 486 movz(reg, Immediate(h0), 0); |
| 487 movk(reg, Immediate(h1), 1); | 487 movk(reg, Immediate(h1), 1); |
| 488 movk(reg, Immediate(h2), 2); | 488 movk(reg, Immediate(h2), 2); |
| 489 movk(reg, Immediate(h3), 3); | 489 movk(reg, Immediate(h3), 3); |
| 490 } | 490 } |
| 491 | 491 |
| 492 | 492 |
| 493 void Assembler::LoadImmediate(Register reg, int64_t imm, Register pp) { | 493 void Assembler::LoadImmediate(Register reg, int64_t imm, Register pp) { |
| 494 Comment("LoadImmediate"); | 494 Comment("LoadImmediate"); |
| 495 if (CanLoadImmediateFromPool(imm, pp)) { | 495 if (CanLoadImmediateFromPool(imm, pp)) { |
| 496 // It's a 64-bit constant and we're not in the VM isolate, so load from | |
| 497 // object pool. | |
| 498 // Save the bits that must be masked-off for the SmiTag | |
| 499 int64_t val_smi_tag = imm & kSmiTagMask; | |
| 500 imm &= ~kSmiTagMask; // Mask off the tag bits. | |
| 501 const int32_t offset = ObjectPool::element_offset(FindImmediate(imm)); | 496 const int32_t offset = ObjectPool::element_offset(FindImmediate(imm)); |
| 502 LoadWordFromPoolOffset(reg, pp, offset); | 497 LoadWordFromPoolOffset(reg, pp, offset); |
| 503 if (val_smi_tag != 0) { | |
| 504 // Add back the tag bits. | |
| 505 orri(reg, reg, Immediate(val_smi_tag)); | |
| 506 } | |
| 507 } else { | 498 } else { |
| 508 // 0. Is it 0? | 499 // 0. Is it 0? |
| 509 if (imm == 0) { | 500 if (imm == 0) { |
| 510 movz(reg, Immediate(0), 0); | 501 movz(reg, Immediate(0), 0); |
| 511 return; | 502 return; |
| 512 } | 503 } |
| 513 | 504 |
| 514 // 1. Can we use one orri operation? | 505 // 1. Can we use one orri operation? |
| 515 Operand op; | 506 Operand op; |
| 516 Operand::OperandType ot; | 507 Operand::OperandType ot; |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 add(base, array, Operand(index, LSL, shift)); | 1448 add(base, array, Operand(index, LSL, shift)); |
| 1458 } | 1449 } |
| 1459 const OperandSize size = Address::OperandSizeFor(cid); | 1450 const OperandSize size = Address::OperandSizeFor(cid); |
| 1460 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1451 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| 1461 return Address(base, offset, Address::Offset, size); | 1452 return Address(base, offset, Address::Offset, size); |
| 1462 } | 1453 } |
| 1463 | 1454 |
| 1464 } // namespace dart | 1455 } // namespace dart |
| 1465 | 1456 |
| 1466 #endif // defined TARGET_ARCH_ARM64 | 1457 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |