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 |
11 | 11 |
12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
13 #include "platform/utils.h" | 13 #include "platform/utils.h" |
14 #include "vm/constants_mips.h" | 14 #include "vm/constants_mips.h" |
15 #include "vm/hash_map.h" | 15 #include "vm/hash_map.h" |
16 #include "vm/object.h" | 16 #include "vm/object.h" |
17 #include "vm/simulator.h" | 17 #include "vm/simulator.h" |
18 | 18 |
19 // References to documentation in this file refer to: | 19 // References to documentation in this file refer to: |
20 // "MIPS® Architecture For Programmers Volume I-A: | 20 // "MIPS® Architecture For Programmers Volume I-A: |
21 // Introduction to the MIPS32® Architecture" in short "VolI-A" | 21 // Introduction to the MIPS32® Architecture" in short "VolI-A" |
22 // and | 22 // and |
23 // "MIPS® Architecture For Programmers Volume II-A: | 23 // "MIPS® Architecture For Programmers Volume II-A: |
24 // The MIPS32® Instruction Set" in short "VolII-A" | 24 // The MIPS32® Instruction Set" in short "VolII-A" |
25 namespace dart { | 25 namespace dart { |
26 | 26 |
27 // Forward declarations. | 27 // Forward declarations. |
28 class RuntimeEntry; | 28 class RuntimeEntry; |
| 29 class StubEntry; |
29 | 30 |
30 class Immediate : public ValueObject { | 31 class Immediate : public ValueObject { |
31 public: | 32 public: |
32 explicit Immediate(int32_t value) : value_(value) { } | 33 explicit Immediate(int32_t value) : value_(value) { } |
33 | 34 |
34 Immediate(const Immediate& other) : ValueObject(), value_(other.value_) { } | 35 Immediate(const Immediate& other) : ValueObject(), value_(other.value_) { } |
35 Immediate& operator=(const Immediate& other) { | 36 Immediate& operator=(const Immediate& other) { |
36 value_ = other.value_; | 37 value_ = other.value_; |
37 return *this; | 38 return *this; |
38 } | 39 } |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 LoadImmediate(rd, imm); | 911 LoadImmediate(rd, imm); |
911 SubuDetectOverflow(rd, rs, rd, ro); | 912 SubuDetectOverflow(rd, rs, rd, ro); |
912 } | 913 } |
913 | 914 |
914 void Branch(const ExternalLabel* label) { | 915 void Branch(const ExternalLabel* label) { |
915 ASSERT(!in_delay_slot_); | 916 ASSERT(!in_delay_slot_); |
916 LoadImmediate(TMP, label->address()); | 917 LoadImmediate(TMP, label->address()); |
917 jr(TMP); | 918 jr(TMP); |
918 } | 919 } |
919 | 920 |
| 921 void Branch(const StubEntry& stub_entry); |
| 922 |
920 void BranchPatchable(const ExternalLabel* label) { | 923 void BranchPatchable(const ExternalLabel* label) { |
921 ASSERT(!in_delay_slot_); | 924 ASSERT(!in_delay_slot_); |
922 const uint16_t low = Utils::Low16Bits(label->address()); | 925 const uint16_t low = Utils::Low16Bits(label->address()); |
923 const uint16_t high = Utils::High16Bits(label->address()); | 926 const uint16_t high = Utils::High16Bits(label->address()); |
924 lui(T9, Immediate(high)); | 927 lui(T9, Immediate(high)); |
925 ori(T9, T9, Immediate(low)); | 928 ori(T9, T9, Immediate(low)); |
926 jr(T9); | 929 jr(T9); |
927 delay_slot_available_ = false; // CodePatcher expects a nop. | 930 delay_slot_available_ = false; // CodePatcher expects a nop. |
928 } | 931 } |
929 | 932 |
| 933 void BranchPatchable(const StubEntry& stub_entry); |
| 934 |
930 void BranchLink(const ExternalLabel* label) { | 935 void BranchLink(const ExternalLabel* label) { |
931 ASSERT(!in_delay_slot_); | 936 ASSERT(!in_delay_slot_); |
932 LoadImmediate(T9, label->address()); | 937 LoadImmediate(T9, label->address()); |
933 jalr(T9); | 938 jalr(T9); |
934 } | 939 } |
935 | 940 |
| 941 void BranchLink(const StubEntry& stub_entry); |
| 942 |
936 void BranchLink(const ExternalLabel* label, Patchability patchable) { | 943 void BranchLink(const ExternalLabel* label, Patchability patchable) { |
937 ASSERT(!in_delay_slot_); | 944 ASSERT(!in_delay_slot_); |
938 const int32_t offset = ObjectPool::element_offset( | 945 const int32_t offset = ObjectPool::element_offset( |
939 object_pool_wrapper_.FindExternalLabel(label, patchable)); | 946 object_pool_wrapper_.FindExternalLabel(label, patchable)); |
940 LoadWordFromPoolOffset(T9, offset - kHeapObjectTag); | 947 LoadWordFromPoolOffset(T9, offset - kHeapObjectTag); |
941 jalr(T9); | 948 jalr(T9); |
942 if (patchable == kPatchable) { | 949 if (patchable == kPatchable) { |
943 delay_slot_available_ = false; // CodePatcher expects a nop. | 950 delay_slot_available_ = false; // CodePatcher expects a nop. |
944 } | 951 } |
945 } | 952 } |
946 | 953 |
| 954 void BranchLink(const StubEntry& stub_entry, Patchability patchable); |
| 955 |
947 void BranchLinkPatchable(const ExternalLabel* label) { | 956 void BranchLinkPatchable(const ExternalLabel* label) { |
948 BranchLink(label, kPatchable); | 957 BranchLink(label, kPatchable); |
949 } | 958 } |
950 | 959 |
| 960 void BranchLinkPatchable(const StubEntry& stub_entry); |
| 961 |
951 void Drop(intptr_t stack_elements) { | 962 void Drop(intptr_t stack_elements) { |
952 ASSERT(stack_elements >= 0); | 963 ASSERT(stack_elements >= 0); |
953 if (stack_elements > 0) { | 964 if (stack_elements > 0) { |
954 addiu(SP, SP, Immediate(stack_elements * kWordSize)); | 965 addiu(SP, SP, Immediate(stack_elements * kWordSize)); |
955 } | 966 } |
956 } | 967 } |
957 | 968 |
958 void LoadPoolPointer() { | 969 void LoadPoolPointer() { |
959 ASSERT(!in_delay_slot_); | 970 ASSERT(!in_delay_slot_); |
960 GetNextPC(TMP); // TMP gets the address of the next instruction. | 971 GetNextPC(TMP); // TMP gets the address of the next instruction. |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 Register value, | 1771 Register value, |
1761 Label* no_update); | 1772 Label* no_update); |
1762 | 1773 |
1763 DISALLOW_ALLOCATION(); | 1774 DISALLOW_ALLOCATION(); |
1764 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1775 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1765 }; | 1776 }; |
1766 | 1777 |
1767 } // namespace dart | 1778 } // namespace dart |
1768 | 1779 |
1769 #endif // VM_ASSEMBLER_MIPS_H_ | 1780 #endif // VM_ASSEMBLER_MIPS_H_ |
OLD | NEW |