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 #ifndef VM_ASSEMBLER_MIPS_H_ | 5 #ifndef VM_ASSEMBLER_MIPS_H_ |
6 #define VM_ASSEMBLER_MIPS_H_ | 6 #define VM_ASSEMBLER_MIPS_H_ |
7 | 7 |
8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
9 #error Do not include assembler_mips.h directly; use assembler.h instead. | 9 #error Do not include assembler_mips.h directly; use assembler.h instead. |
10 #endif | 10 #endif |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 905 |
906 // ro must be different from rd and rs. | 906 // ro must be different from rd and rs. |
907 // None of rd, rs, rt, or ro may be TMP. | 907 // None of rd, rs, rt, or ro may be TMP. |
908 void SubImmediateDetectOverflow(Register rd, Register rs, int32_t imm, | 908 void SubImmediateDetectOverflow(Register rd, Register rs, int32_t imm, |
909 Register ro) { | 909 Register ro) { |
910 ASSERT(!in_delay_slot_); | 910 ASSERT(!in_delay_slot_); |
911 LoadImmediate(rd, imm); | 911 LoadImmediate(rd, imm); |
912 SubuDetectOverflow(rd, rs, rd, ro); | 912 SubuDetectOverflow(rd, rs, rd, ro); |
913 } | 913 } |
914 | 914 |
915 void Branch(const ExternalLabel* label) { | |
916 ASSERT(!in_delay_slot_); | |
917 LoadImmediate(TMP, label->address()); | |
918 jr(TMP); | |
919 } | |
920 | |
921 void Branch(const StubEntry& stub_entry); | 915 void Branch(const StubEntry& stub_entry); |
922 | 916 |
923 void BranchPatchable(const ExternalLabel* label) { | |
924 ASSERT(!in_delay_slot_); | |
925 const uint16_t low = Utils::Low16Bits(label->address()); | |
926 const uint16_t high = Utils::High16Bits(label->address()); | |
927 lui(T9, Immediate(high)); | |
928 ori(T9, T9, Immediate(low)); | |
929 jr(T9); | |
930 delay_slot_available_ = false; // CodePatcher expects a nop. | |
931 } | |
932 | |
933 void BranchPatchable(const StubEntry& stub_entry); | 917 void BranchPatchable(const StubEntry& stub_entry); |
934 | 918 |
935 void BranchLink(const ExternalLabel* label) { | 919 void BranchLink(const ExternalLabel* label, Patchability patchable); |
936 ASSERT(!in_delay_slot_); | 920 void BranchLink(const StubEntry& stub_entry, |
937 LoadImmediate(T9, label->address()); | 921 Patchability patchable = kNotPatchable); |
938 jalr(T9); | |
939 } | |
940 | |
941 void BranchLink(const StubEntry& stub_entry); | |
942 | |
943 void BranchLink(const ExternalLabel* label, Patchability patchable) { | |
944 ASSERT(!in_delay_slot_); | |
945 const int32_t offset = ObjectPool::element_offset( | |
946 object_pool_wrapper_.FindExternalLabel(label, patchable)); | |
947 LoadWordFromPoolOffset(T9, offset - kHeapObjectTag); | |
948 jalr(T9); | |
949 if (patchable == kPatchable) { | |
950 delay_slot_available_ = false; // CodePatcher expects a nop. | |
951 } | |
952 } | |
953 | |
954 void BranchLink(const StubEntry& stub_entry, Patchability patchable); | |
955 | |
956 void BranchLinkPatchable(const ExternalLabel* label) { | |
957 BranchLink(label, kPatchable); | |
958 } | |
959 | 922 |
960 void BranchLinkPatchable(const StubEntry& stub_entry); | 923 void BranchLinkPatchable(const StubEntry& stub_entry); |
961 | 924 |
962 void Drop(intptr_t stack_elements) { | 925 void Drop(intptr_t stack_elements) { |
963 ASSERT(stack_elements >= 0); | 926 ASSERT(stack_elements >= 0); |
964 if (stack_elements > 0) { | 927 if (stack_elements > 0) { |
965 addiu(SP, SP, Immediate(stack_elements * kWordSize)); | 928 addiu(SP, SP, Immediate(stack_elements * kWordSize)); |
966 } | 929 } |
967 } | 930 } |
968 | 931 |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 intptr_t pc_offset_; | 1626 intptr_t pc_offset_; |
1664 const String& comment_; | 1627 const String& comment_; |
1665 | 1628 |
1666 DISALLOW_COPY_AND_ASSIGN(CodeComment); | 1629 DISALLOW_COPY_AND_ASSIGN(CodeComment); |
1667 }; | 1630 }; |
1668 | 1631 |
1669 GrowableArray<CodeComment*> comments_; | 1632 GrowableArray<CodeComment*> comments_; |
1670 | 1633 |
1671 bool constant_pool_allowed_; | 1634 bool constant_pool_allowed_; |
1672 | 1635 |
| 1636 void BranchLink(const ExternalLabel* label); |
| 1637 |
1673 void LoadObjectHelper(Register rd, const Object& object, bool is_unique); | 1638 void LoadObjectHelper(Register rd, const Object& object, bool is_unique); |
1674 | 1639 |
1675 void Emit(int32_t value) { | 1640 void Emit(int32_t value) { |
1676 // Emitting an instruction clears the delay slot state. | 1641 // Emitting an instruction clears the delay slot state. |
1677 in_delay_slot_ = false; | 1642 in_delay_slot_ = false; |
1678 delay_slot_available_ = false; | 1643 delay_slot_available_ = false; |
1679 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1644 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1680 buffer_.Emit<int32_t>(value); | 1645 buffer_.Emit<int32_t>(value); |
1681 } | 1646 } |
1682 | 1647 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 Register value, | 1736 Register value, |
1772 Label* no_update); | 1737 Label* no_update); |
1773 | 1738 |
1774 DISALLOW_ALLOCATION(); | 1739 DISALLOW_ALLOCATION(); |
1775 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1740 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1776 }; | 1741 }; |
1777 | 1742 |
1778 } // namespace dart | 1743 } // namespace dart |
1779 | 1744 |
1780 #endif // VM_ASSEMBLER_MIPS_H_ | 1745 #endif // VM_ASSEMBLER_MIPS_H_ |
OLD | NEW |