| 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 #ifndef VM_ASSEMBLER_ARM64_H_ | 5 #ifndef VM_ASSEMBLER_ARM64_H_ |
| 6 #define VM_ASSEMBLER_ARM64_H_ | 6 #define VM_ASSEMBLER_ARM64_H_ |
| 7 | 7 |
| 8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
| 9 #error Do not include assembler_arm64.h directly; use assembler.h instead. | 9 #error Do not include assembler_arm64.h directly; use assembler.h instead. |
| 10 #endif | 10 #endif |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 const Register crd = ConcreteRegister(rd); | 518 const Register crd = ConcreteRegister(rd); |
| 519 EmitMoveWideOp(MOVN, crd, imm, hw_idx, kDoubleWord); | 519 EmitMoveWideOp(MOVN, crd, imm, hw_idx, kDoubleWord); |
| 520 } | 520 } |
| 521 void movz(Register rd, uint16_t imm, int hw_idx) { | 521 void movz(Register rd, uint16_t imm, int hw_idx) { |
| 522 ASSERT(rd != SP); | 522 ASSERT(rd != SP); |
| 523 const Register crd = ConcreteRegister(rd); | 523 const Register crd = ConcreteRegister(rd); |
| 524 EmitMoveWideOp(MOVZ, crd, imm, hw_idx, kDoubleWord); | 524 EmitMoveWideOp(MOVZ, crd, imm, hw_idx, kDoubleWord); |
| 525 } | 525 } |
| 526 | 526 |
| 527 // Loads and Stores. | 527 // Loads and Stores. |
| 528 void ldr(Register rt, Address a) { | 528 void ldr(Register rt, Address a, OperandSize sz = kDoubleWord) { |
| 529 if (a.type() == Address::PCOffset) { | 529 if (a.type() == Address::PCOffset) { |
| 530 EmitLoadRegLiteral(LDRpc, rt, a, kDoubleWord); | 530 ASSERT(sz == kDoubleWord); |
| 531 EmitLoadRegLiteral(LDRpc, rt, a, sz); |
| 531 } else { | 532 } else { |
| 532 // If we are doing pre-/post-indexing, and the base and result registers | 533 // If we are doing pre-/post-indexing, and the base and result registers |
| 533 // are the same, then the result of the load will be clobbered by the | 534 // are the same, then the result of the load will be clobbered by the |
| 534 // writeback, which is unlikely to be useful. | 535 // writeback, which is unlikely to be useful. |
| 535 ASSERT(((a.type() != Address::PreIndex) && | 536 ASSERT(((a.type() != Address::PreIndex) && |
| 536 (a.type() != Address::PostIndex)) || | 537 (a.type() != Address::PostIndex)) || |
| 537 (rt != a.base())); | 538 (rt != a.base())); |
| 538 EmitLoadStoreReg(LDR, rt, a, kDoubleWord); | 539 EmitLoadStoreReg(LDR, rt, a, sz); |
| 539 } | 540 } |
| 540 } | 541 } |
| 541 void str(Register rt, Address a) { | 542 void str(Register rt, Address a, OperandSize sz = kDoubleWord) { |
| 542 EmitLoadStoreReg(STR, rt, a, kDoubleWord); | 543 EmitLoadStoreReg(STR, rt, a, sz); |
| 543 } | 544 } |
| 544 | 545 |
| 545 // Comparison. | 546 // Comparison. |
| 546 // rn cmp o. | 547 // rn cmp o. |
| 547 // For add and sub, to use SP for rn, o must be of type Operand::Extend. | 548 // For add and sub, to use SP for rn, o must be of type Operand::Extend. |
| 548 // For an unmodified rm in this case, use Operand(rm, UXTX, 0); | 549 // For an unmodified rm in this case, use Operand(rm, UXTX, 0); |
| 549 void cmp(Register rn, Operand o) { | 550 void cmp(Register rn, Operand o) { |
| 550 subs(ZR, rn, o); | 551 subs(ZR, rn, o); |
| 551 } | 552 } |
| 552 // rn cmp -o. | 553 // rn cmp -o. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 LoadExternalLabel(TMP, label, kPatchable, PP); | 678 LoadExternalLabel(TMP, label, kPatchable, PP); |
| 678 blr(TMP); | 679 blr(TMP); |
| 679 } | 680 } |
| 680 | 681 |
| 681 // Macros accepting a pp Register argument may attempt to load values from | 682 // Macros accepting a pp Register argument may attempt to load values from |
| 682 // the object pool when possible. Unless you are sure that the untagged object | 683 // the object pool when possible. Unless you are sure that the untagged object |
| 683 // pool pointer is in another register, or that it is not available at all, | 684 // pool pointer is in another register, or that it is not available at all, |
| 684 // PP should be passed for pp. | 685 // PP should be passed for pp. |
| 685 void AddImmediate(Register dest, Register rn, int64_t imm, Register pp); | 686 void AddImmediate(Register dest, Register rn, int64_t imm, Register pp); |
| 686 void CompareImmediate(Register rn, int64_t imm, Register pp); | 687 void CompareImmediate(Register rn, int64_t imm, Register pp); |
| 687 void LoadFromOffset(Register dest, Register base, int32_t offset); | 688 |
| 689 void LoadFromOffset(Register dest, Register base, int32_t offset, |
| 690 OperandSize sz = kDoubleWord); |
| 688 void LoadFieldFromOffset(Register dest, Register base, int32_t offset) { | 691 void LoadFieldFromOffset(Register dest, Register base, int32_t offset) { |
| 689 LoadFromOffset(dest, base, offset - kHeapObjectTag); | 692 LoadFromOffset(dest, base, offset - kHeapObjectTag); |
| 690 } | 693 } |
| 691 void StoreToOffset(Register dest, Register base, int32_t offset); | 694 |
| 695 void StoreToOffset(Register dest, Register base, int32_t offset, |
| 696 OperandSize sz = kDoubleWord); |
| 692 void StoreFieldToOffset(Register dest, Register base, int32_t offset) { | 697 void StoreFieldToOffset(Register dest, Register base, int32_t offset) { |
| 693 StoreToOffset(dest, base, offset - kHeapObjectTag); | 698 StoreToOffset(dest, base, offset - kHeapObjectTag); |
| 694 } | 699 } |
| 695 | 700 |
| 696 // Storing into an object. | 701 // Storing into an object. |
| 697 void StoreIntoObject(Register object, | 702 void StoreIntoObject(Register object, |
| 698 const Address& dest, | 703 const Address& dest, |
| 699 Register value, | 704 Register value, |
| 700 bool can_value_be_smi = true); | 705 bool can_value_be_smi = true); |
| 701 void StoreIntoObjectNoBarrier(Register object, | 706 void StoreIntoObjectNoBarrier(Register object, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 void EnterFrame(intptr_t frame_size); | 740 void EnterFrame(intptr_t frame_size); |
| 736 void LeaveFrame(); | 741 void LeaveFrame(); |
| 737 | 742 |
| 738 void EnterDartFrame(intptr_t frame_size); | 743 void EnterDartFrame(intptr_t frame_size); |
| 739 void EnterDartFrameWithInfo(intptr_t frame_size, Register new_pp); | 744 void EnterDartFrameWithInfo(intptr_t frame_size, Register new_pp); |
| 740 void EnterOsrFrame(intptr_t extra_size, Register new_pp); | 745 void EnterOsrFrame(intptr_t extra_size, Register new_pp); |
| 741 void LeaveDartFrame(); | 746 void LeaveDartFrame(); |
| 742 | 747 |
| 743 void EnterCallRuntimeFrame(intptr_t frame_size); | 748 void EnterCallRuntimeFrame(intptr_t frame_size); |
| 744 void LeaveCallRuntimeFrame(); | 749 void LeaveCallRuntimeFrame(); |
| 750 void CallRuntime(const RuntimeEntry& entry, intptr_t argument_count); |
| 745 | 751 |
| 746 void CallRuntime(const RuntimeEntry& entry, intptr_t argument_count); | 752 // Set up a stub frame so that the stack traversal code can easily identify |
| 753 // a stub frame. |
| 754 void EnterStubFrame(bool load_pp = false); |
| 755 void LeaveStubFrame(); |
| 747 | 756 |
| 748 private: | 757 private: |
| 749 AssemblerBuffer buffer_; // Contains position independent code. | 758 AssemblerBuffer buffer_; // Contains position independent code. |
| 750 | 759 |
| 751 // Objects and patchable jump targets. | 760 // Objects and patchable jump targets. |
| 752 GrowableObjectArray& object_pool_; | 761 GrowableObjectArray& object_pool_; |
| 753 | 762 |
| 754 // Patchability of pool entries. | 763 // Patchability of pool entries. |
| 755 GrowableArray<Patchability> patchable_pool_entries_; | 764 GrowableArray<Patchability> patchable_pool_entries_; |
| 756 | 765 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 Register value, | 1065 Register value, |
| 1057 Label* no_update); | 1066 Label* no_update); |
| 1058 | 1067 |
| 1059 DISALLOW_ALLOCATION(); | 1068 DISALLOW_ALLOCATION(); |
| 1060 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1069 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 1061 }; | 1070 }; |
| 1062 | 1071 |
| 1063 } // namespace dart | 1072 } // namespace dart |
| 1064 | 1073 |
| 1065 #endif // VM_ASSEMBLER_ARM64_H_ | 1074 #endif // VM_ASSEMBLER_ARM64_H_ |
| OLD | NEW |