| 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" // Needed here to get TARGET_ARCH_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 __ Pop(left); | 1121 __ Pop(left); |
| 1122 } else { | 1122 } else { |
| 1123 __ CompareRegisters(left, right); | 1123 __ CompareRegisters(left, right); |
| 1124 } | 1124 } |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 | 1127 |
| 1128 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and | 1128 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and |
| 1129 // FlowGraphCompiler::SlowPathEnvironmentFor. | 1129 // FlowGraphCompiler::SlowPathEnvironmentFor. |
| 1130 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { | 1130 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { |
| 1131 // TODO(zra): Save live FPU Registers. | 1131 // TODO(vegorov): consider saving only caller save (volatile) registers. |
| 1132 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); |
| 1133 if (fpu_regs_count > 0) { |
| 1134 // Store fpu registers with the lowest register number at the lowest |
| 1135 // address. |
| 1136 for (intptr_t reg_idx = kNumberOfVRegisters - 1; |
| 1137 reg_idx >= 0; --reg_idx) { |
| 1138 VRegister fpu_reg = static_cast<VRegister>(reg_idx); |
| 1139 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) { |
| 1140 // TODO(zra): Save the whole V register. |
| 1141 __ PushDouble(fpu_reg); |
| 1142 } |
| 1143 } |
| 1144 } |
| 1132 | 1145 |
| 1133 // Store general purpose registers with the highest register number at the | 1146 // Store general purpose registers with the highest register number at the |
| 1134 // lowest address. | 1147 // lowest address. |
| 1135 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) { | 1148 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) { |
| 1136 Register reg = static_cast<Register>(reg_idx); | 1149 Register reg = static_cast<Register>(reg_idx); |
| 1137 if (locs->live_registers()->ContainsRegister(reg)) { | 1150 if (locs->live_registers()->ContainsRegister(reg)) { |
| 1138 __ Push(reg); | 1151 __ Push(reg); |
| 1139 } | 1152 } |
| 1140 } | 1153 } |
| 1141 } | 1154 } |
| 1142 | 1155 |
| 1143 | 1156 |
| 1144 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { | 1157 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { |
| 1145 // General purpose registers have the highest register number at the | 1158 // General purpose registers have the highest register number at the |
| 1146 // lowest address. | 1159 // lowest address. |
| 1147 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) { | 1160 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) { |
| 1148 Register reg = static_cast<Register>(reg_idx); | 1161 Register reg = static_cast<Register>(reg_idx); |
| 1149 if (locs->live_registers()->ContainsRegister(reg)) { | 1162 if (locs->live_registers()->ContainsRegister(reg)) { |
| 1150 __ Pop(reg); | 1163 __ Pop(reg); |
| 1151 } | 1164 } |
| 1152 } | 1165 } |
| 1153 | 1166 |
| 1154 // TODO(zra): Restore live FPU registers. | 1167 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); |
| 1168 if (fpu_regs_count > 0) { |
| 1169 // Fpu registers have the lowest register number at the lowest address. |
| 1170 for (intptr_t reg_idx = 0; reg_idx < kNumberOfVRegisters; ++reg_idx) { |
| 1171 VRegister fpu_reg = static_cast<VRegister>(reg_idx); |
| 1172 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) { |
| 1173 // TODO(zra): Restore the whole V register. |
| 1174 __ PopDouble(fpu_reg); |
| 1175 } |
| 1176 } |
| 1177 } |
| 1155 } | 1178 } |
| 1156 | 1179 |
| 1157 | 1180 |
| 1158 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, | 1181 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, |
| 1159 Register class_id_reg, | 1182 Register class_id_reg, |
| 1160 intptr_t argument_count, | 1183 intptr_t argument_count, |
| 1161 const Array& argument_names, | 1184 const Array& argument_names, |
| 1162 Label* deopt, | 1185 Label* deopt, |
| 1163 intptr_t deopt_id, | 1186 intptr_t deopt_id, |
| 1164 intptr_t token_index, | 1187 intptr_t token_index, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1296 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1274 UNIMPLEMENTED(); | 1297 UNIMPLEMENTED(); |
| 1275 } | 1298 } |
| 1276 | 1299 |
| 1277 | 1300 |
| 1278 #undef __ | 1301 #undef __ |
| 1279 | 1302 |
| 1280 } // namespace dart | 1303 } // namespace dart |
| 1281 | 1304 |
| 1282 #endif // defined TARGET_ARCH_ARM64 | 1305 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |