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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 ASSERT(Utils::IsAligned(address, 4)); | 1088 ASSERT(Utils::IsAligned(address, 4)); |
1089 // The address is stored in the object array as a RawSmi. | 1089 // The address is stored in the object array as a RawSmi. |
1090 const Smi& smi = Smi::Handle(Smi::New(address >> kSmiTagShift)); | 1090 const Smi& smi = Smi::Handle(Smi::New(address >> kSmiTagShift)); |
1091 // Do not reuse an existing entry, since each reference may be patched | 1091 // Do not reuse an existing entry, since each reference may be patched |
1092 // independently. | 1092 // independently. |
1093 object_pool_.Add(smi, Heap::kOld); | 1093 object_pool_.Add(smi, Heap::kOld); |
1094 return object_pool_.Length() - 1; | 1094 return object_pool_.Length() - 1; |
1095 } | 1095 } |
1096 | 1096 |
1097 | 1097 |
| 1098 Address Assembler::ElementAddressForIntIndex(bool is_external, |
| 1099 intptr_t cid, |
| 1100 intptr_t index_scale, |
| 1101 Register array, |
| 1102 intptr_t index) const { |
| 1103 const int64_t offset = index * index_scale + |
| 1104 (is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag)); |
| 1105 ASSERT(Utils::IsInt(32, offset)); |
| 1106 ASSERT(Address::CanHoldOffset(offset)); |
| 1107 return Address(array, static_cast<int32_t>(offset)); |
| 1108 } |
| 1109 |
| 1110 |
| 1111 Address Assembler::ElementAddressForRegIndex(bool is_load, |
| 1112 bool is_external, |
| 1113 intptr_t cid, |
| 1114 intptr_t index_scale, |
| 1115 Register array, |
| 1116 Register index) { |
| 1117 // Note that index is expected smi-tagged, (i.e, LSL 1) for all arrays. |
| 1118 const intptr_t shift = Utils::ShiftForPowerOfTwo(index_scale) - kSmiTagShift; |
| 1119 const int32_t offset = |
| 1120 is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag); |
| 1121 ASSERT(array != TMP); |
| 1122 ASSERT(index != TMP); |
| 1123 const Register base = is_load ? TMP : index; |
| 1124 if (shift < 0) { |
| 1125 ASSERT(shift == -1); |
| 1126 sra(TMP, index, 1); |
| 1127 addu(base, array, TMP); |
| 1128 } else if (shift == 0) { |
| 1129 addu(base, array, index); |
| 1130 } else { |
| 1131 sll(TMP, index, shift); |
| 1132 addu(base, array, TMP); |
| 1133 } |
| 1134 ASSERT(Address::CanHoldOffset(offset)); |
| 1135 return Address(base, offset); |
| 1136 } |
| 1137 |
| 1138 |
1098 static const char* cpu_reg_names[kNumberOfCpuRegisters] = { | 1139 static const char* cpu_reg_names[kNumberOfCpuRegisters] = { |
1099 "zr", "tmp", "v0", "v1", "a0", "a1", "a2", "a3", | 1140 "zr", "tmp", "v0", "v1", "a0", "a1", "a2", "a3", |
1100 "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", | 1141 "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", |
1101 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", | 1142 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", |
1102 "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra", | 1143 "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra", |
1103 }; | 1144 }; |
1104 | 1145 |
1105 | 1146 |
1106 const char* Assembler::RegisterName(Register reg) { | 1147 const char* Assembler::RegisterName(Register reg) { |
1107 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); | 1148 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 Emit(reinterpret_cast<int32_t>(message)); | 1184 Emit(reinterpret_cast<int32_t>(message)); |
1144 Bind(&msg); | 1185 Bind(&msg); |
1145 break_(Instr::kMsgMessageCode); | 1186 break_(Instr::kMsgMessageCode); |
1146 } | 1187 } |
1147 #endif | 1188 #endif |
1148 } | 1189 } |
1149 | 1190 |
1150 } // namespace dart | 1191 } // namespace dart |
1151 | 1192 |
1152 #endif // defined TARGET_ARCH_MIPS | 1193 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |