| 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 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 | 1074 |
| 1075 | 1075 |
| 1076 // Frame entry and exit. | 1076 // Frame entry and exit. |
| 1077 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { | 1077 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { |
| 1078 // Reserve space for arguments and align frame before entering | 1078 // Reserve space for arguments and align frame before entering |
| 1079 // the C++ world. | 1079 // the C++ world. |
| 1080 if (frame_space != 0) { | 1080 if (frame_space != 0) { |
| 1081 AddImmediate(SP, SP, -frame_space, kNoPP); | 1081 AddImmediate(SP, SP, -frame_space, kNoPP); |
| 1082 } | 1082 } |
| 1083 if (OS::ActivationFrameAlignment() > 1) { | 1083 if (OS::ActivationFrameAlignment() > 1) { |
| 1084 mov(TMP, SP); // SP can't be register operand of andi. | 1084 andi(SP, SP, ~(OS::ActivationFrameAlignment() - 1)); |
| 1085 andi(TMP, TMP, ~(OS::ActivationFrameAlignment() - 1)); | |
| 1086 mov(SP, TMP); | |
| 1087 } | 1085 } |
| 1088 } | 1086 } |
| 1089 | 1087 |
| 1090 | 1088 |
| 1091 void Assembler::EnterFrame(intptr_t frame_size) { | 1089 void Assembler::EnterFrame(intptr_t frame_size) { |
| 1092 Push(LR); | 1090 Push(LR); |
| 1093 Push(FP); | 1091 Push(FP); |
| 1094 mov(FP, SP); | 1092 mov(FP, SP); |
| 1095 | 1093 |
| 1096 if (frame_size > 0) { | 1094 if (frame_size > 0) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 // 64-bits of the callee-saved registers. | 1185 // 64-bits of the callee-saved registers. |
| 1188 continue; | 1186 continue; |
| 1189 } | 1187 } |
| 1190 // TODO(zra): Save the whole V register. | 1188 // TODO(zra): Save the whole V register. |
| 1191 VRegister reg = static_cast<VRegister>(i); | 1189 VRegister reg = static_cast<VRegister>(i); |
| 1192 PushDouble(reg); | 1190 PushDouble(reg); |
| 1193 } | 1191 } |
| 1194 | 1192 |
| 1195 for (int i = kDartFirstVolatileCpuReg; i <= kDartLastVolatileCpuReg; i++) { | 1193 for (int i = kDartFirstVolatileCpuReg; i <= kDartLastVolatileCpuReg; i++) { |
| 1196 const Register reg = static_cast<Register>(i); | 1194 const Register reg = static_cast<Register>(i); |
| 1197 if ((reg != TMP) && (reg != TMP2)) { | 1195 Push(reg); |
| 1198 Push(reg); | |
| 1199 } | |
| 1200 } | 1196 } |
| 1201 | 1197 |
| 1202 ReserveAlignedFrameSpace(frame_size); | 1198 ReserveAlignedFrameSpace(frame_size); |
| 1203 } | 1199 } |
| 1204 | 1200 |
| 1205 | 1201 |
| 1206 void Assembler::LeaveCallRuntimeFrame() { | 1202 void Assembler::LeaveCallRuntimeFrame() { |
| 1207 // SP might have been modified to reserve space for arguments | 1203 // SP might have been modified to reserve space for arguments |
| 1208 // and ensure proper alignment of the stack frame. | 1204 // and ensure proper alignment of the stack frame. |
| 1209 // We need to restore it before restoring registers. | 1205 // We need to restore it before restoring registers. |
| 1210 // TODO(zra): Also include FPU regs in this count once they are added. | |
| 1211 const intptr_t kPushedRegistersSize = | 1206 const intptr_t kPushedRegistersSize = |
| 1212 kDartVolatileCpuRegCount * kWordSize + | 1207 kDartVolatileCpuRegCount * kWordSize + |
| 1213 kDartVolatileFpuRegCount * kWordSize; | 1208 kDartVolatileFpuRegCount * kWordSize; |
| 1214 AddImmediate(SP, FP, -kPushedRegistersSize, PP); | 1209 AddImmediate(SP, FP, -kPushedRegistersSize, PP); |
| 1215 for (int i = kDartLastVolatileCpuReg; i >= kDartFirstVolatileCpuReg; i--) { | 1210 for (int i = kDartLastVolatileCpuReg; i >= kDartFirstVolatileCpuReg; i--) { |
| 1216 const Register reg = static_cast<Register>(i); | 1211 const Register reg = static_cast<Register>(i); |
| 1217 if ((reg != TMP) && (reg != TMP2)) { | 1212 Pop(reg); |
| 1218 Pop(reg); | |
| 1219 } | |
| 1220 } | 1213 } |
| 1221 | 1214 |
| 1222 for (int i = 0; i < kNumberOfVRegisters; i++) { | 1215 for (int i = 0; i < kNumberOfVRegisters; i++) { |
| 1223 if ((i >= kAbiFirstPreservedFpuReg) && (i <= kAbiLastPreservedFpuReg)) { | 1216 if ((i >= kAbiFirstPreservedFpuReg) && (i <= kAbiLastPreservedFpuReg)) { |
| 1224 // TODO(zra): When SIMD is added, we must also restore the top | 1217 // TODO(zra): When SIMD is added, we must also restore the top |
| 1225 // 64-bits of the callee-saved registers. | 1218 // 64-bits of the callee-saved registers. |
| 1226 continue; | 1219 continue; |
| 1227 } | 1220 } |
| 1228 // TODO(zra): Restore the whole V register. | 1221 // TODO(zra): Restore the whole V register. |
| 1229 VRegister reg = static_cast<VRegister>(i); | 1222 VRegister reg = static_cast<VRegister>(i); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 LoadImmediate(TMP, tags, pp); | 1368 LoadImmediate(TMP, tags, pp); |
| 1376 StoreFieldToOffset(TMP, instance_reg, Object::tags_offset(), pp); | 1369 StoreFieldToOffset(TMP, instance_reg, Object::tags_offset(), pp); |
| 1377 } else { | 1370 } else { |
| 1378 b(failure); | 1371 b(failure); |
| 1379 } | 1372 } |
| 1380 } | 1373 } |
| 1381 | 1374 |
| 1382 } // namespace dart | 1375 } // namespace dart |
| 1383 | 1376 |
| 1384 #endif // defined TARGET_ARCH_ARM64 | 1377 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |