| 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" | 5 #include "vm/globals.h" |
| 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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 if (frame_space != 0) { | 1140 if (frame_space != 0) { |
| 1141 AddImmediate(SP, SP, -frame_space, kNoPP); | 1141 AddImmediate(SP, SP, -frame_space, kNoPP); |
| 1142 } | 1142 } |
| 1143 if (OS::ActivationFrameAlignment() > 1) { | 1143 if (OS::ActivationFrameAlignment() > 1) { |
| 1144 andi(SP, SP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 1144 andi(SP, SP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 1145 } | 1145 } |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 | 1148 |
| 1149 void Assembler::EnterFrame(intptr_t frame_size) { | 1149 void Assembler::EnterFrame(intptr_t frame_size) { |
| 1150 Push(LR); | 1150 PushPair(LR, FP); |
| 1151 Push(FP); | |
| 1152 mov(FP, SP); | 1151 mov(FP, SP); |
| 1153 | 1152 |
| 1154 if (frame_size > 0) { | 1153 if (frame_size > 0) { |
| 1155 sub(SP, SP, Operand(frame_size)); | 1154 sub(SP, SP, Operand(frame_size)); |
| 1156 } | 1155 } |
| 1157 } | 1156 } |
| 1158 | 1157 |
| 1159 | 1158 |
| 1160 void Assembler::LeaveFrame() { | 1159 void Assembler::LeaveFrame() { |
| 1161 mov(SP, FP); | 1160 mov(SP, FP); |
| 1162 Pop(FP); | 1161 PopPair(LR, FP); |
| 1163 Pop(LR); | |
| 1164 } | 1162 } |
| 1165 | 1163 |
| 1166 | 1164 |
| 1167 void Assembler::EnterDartFrame(intptr_t frame_size) { | 1165 void Assembler::EnterDartFrame(intptr_t frame_size) { |
| 1168 // Setup the frame. | 1166 // Setup the frame. |
| 1169 adr(TMP, Immediate(-CodeSize())); // TMP gets PC marker. | 1167 adr(TMP, Immediate(-CodeSize())); // TMP gets PC marker. |
| 1170 EnterFrame(0); | 1168 EnterFrame(0); |
| 1171 Push(TMP); // Save PC Marker. | 1169 TagAndPushPPAndPcMarker(TMP); // Save PP and PC marker. |
| 1172 TagAndPushPP(); // Save PP. | |
| 1173 | 1170 |
| 1174 // Load the pool pointer. | 1171 // Load the pool pointer. |
| 1175 LoadPoolPointer(PP); | 1172 LoadPoolPointer(PP); |
| 1176 | 1173 |
| 1177 // Reserve space. | 1174 // Reserve space. |
| 1178 if (frame_size > 0) { | 1175 if (frame_size > 0) { |
| 1179 AddImmediate(SP, SP, -frame_size, PP); | 1176 AddImmediate(SP, SP, -frame_size, PP); |
| 1180 } | 1177 } |
| 1181 } | 1178 } |
| 1182 | 1179 |
| 1183 | 1180 |
| 1184 void Assembler::EnterDartFrameWithInfo(intptr_t frame_size, Register new_pp) { | 1181 void Assembler::EnterDartFrameWithInfo(intptr_t frame_size, Register new_pp) { |
| 1185 // Setup the frame. | 1182 // Setup the frame. |
| 1186 adr(TMP, Immediate(-CodeSize())); // TMP gets PC marker. | 1183 adr(TMP, Immediate(-CodeSize())); // TMP gets PC marker. |
| 1187 EnterFrame(0); | 1184 EnterFrame(0); |
| 1188 Push(TMP); // Save PC Marker. | 1185 TagAndPushPPAndPcMarker(TMP); // Save PP and PC marker. |
| 1189 TagAndPushPP(); // Save PP. | |
| 1190 | 1186 |
| 1191 // Load the pool pointer. | 1187 // Load the pool pointer. |
| 1192 if (new_pp == kNoPP) { | 1188 if (new_pp == kNoPP) { |
| 1193 LoadPoolPointer(PP); | 1189 LoadPoolPointer(PP); |
| 1194 } else { | 1190 } else { |
| 1195 mov(PP, new_pp); | 1191 mov(PP, new_pp); |
| 1196 } | 1192 } |
| 1197 | 1193 |
| 1198 // Reserve space. | 1194 // Reserve space. |
| 1199 if (frame_size > 0) { | 1195 if (frame_size > 0) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 if ((i >= kAbiFirstPreservedFpuReg) && (i <= kAbiLastPreservedFpuReg)) { | 1272 if ((i >= kAbiFirstPreservedFpuReg) && (i <= kAbiLastPreservedFpuReg)) { |
| 1277 // TODO(zra): When SIMD is added, we must also restore the top | 1273 // TODO(zra): When SIMD is added, we must also restore the top |
| 1278 // 64-bits of the callee-saved registers. | 1274 // 64-bits of the callee-saved registers. |
| 1279 continue; | 1275 continue; |
| 1280 } | 1276 } |
| 1281 // TODO(zra): Restore the whole V register. | 1277 // TODO(zra): Restore the whole V register. |
| 1282 VRegister reg = static_cast<VRegister>(i); | 1278 VRegister reg = static_cast<VRegister>(i); |
| 1283 PopDouble(reg); | 1279 PopDouble(reg); |
| 1284 } | 1280 } |
| 1285 | 1281 |
| 1286 Pop(FP); | 1282 PopPair(LR, FP); |
| 1287 Pop(LR); | |
| 1288 } | 1283 } |
| 1289 | 1284 |
| 1290 | 1285 |
| 1291 void Assembler::CallRuntime(const RuntimeEntry& entry, | 1286 void Assembler::CallRuntime(const RuntimeEntry& entry, |
| 1292 intptr_t argument_count) { | 1287 intptr_t argument_count) { |
| 1293 entry.Call(this, argument_count); | 1288 entry.Call(this, argument_count); |
| 1294 } | 1289 } |
| 1295 | 1290 |
| 1296 | 1291 |
| 1297 void Assembler::EnterStubFrame(bool load_pp) { | 1292 void Assembler::EnterStubFrame(bool load_pp) { |
| 1298 EnterFrame(0); | 1293 EnterFrame(0); |
| 1299 Push(ZR); // Push 0 in the saved PC area for stub frames. | 1294 // Save caller's pool pointer. Push 0 in the saved PC area for stub frames. |
| 1300 TagAndPushPP(); // Save caller's pool pointer | 1295 TagAndPushPPAndPcMarker(ZR); |
| 1301 if (load_pp) { | 1296 if (load_pp) { |
| 1302 LoadPoolPointer(PP); | 1297 LoadPoolPointer(PP); |
| 1303 } | 1298 } |
| 1304 } | 1299 } |
| 1305 | 1300 |
| 1306 | 1301 |
| 1307 void Assembler::LeaveStubFrame() { | 1302 void Assembler::LeaveStubFrame() { |
| 1308 // Restore and untag PP. | 1303 // Restore and untag PP. |
| 1309 LoadFromOffset(PP, FP, kSavedCallerPpSlotFromFp * kWordSize, kNoPP); | 1304 LoadFromOffset(PP, FP, kSavedCallerPpSlotFromFp * kWordSize, kNoPP); |
| 1310 sub(PP, PP, Operand(kHeapObjectTag)); | 1305 sub(PP, PP, Operand(kHeapObjectTag)); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 add(base, array, Operand(index, LSL, shift)); | 1512 add(base, array, Operand(index, LSL, shift)); |
| 1518 } | 1513 } |
| 1519 const OperandSize size = Address::OperandSizeFor(cid); | 1514 const OperandSize size = Address::OperandSizeFor(cid); |
| 1520 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1515 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
| 1521 return Address(base, offset, Address::Offset, size); | 1516 return Address(base, offset, Address::Offset, size); |
| 1522 } | 1517 } |
| 1523 | 1518 |
| 1524 } // namespace dart | 1519 } // namespace dart |
| 1525 | 1520 |
| 1526 #endif // defined TARGET_ARCH_ARM64 | 1521 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |