| 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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 __ BranchPatchable(&stub_code->DeoptimizeLazyLabel()); | 1106 __ BranchPatchable(&stub_code->DeoptimizeLazyLabel()); |
| 1107 } | 1107 } |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 | 1110 |
| 1111 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1111 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
| 1112 const ExternalLabel* label, | 1112 const ExternalLabel* label, |
| 1113 RawPcDescriptors::Kind kind, | 1113 RawPcDescriptors::Kind kind, |
| 1114 LocationSummary* locs) { | 1114 LocationSummary* locs) { |
| 1115 __ BranchLinkPatchable(label); | 1115 __ BranchLinkPatchable(label); |
| 1116 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1116 RecordCallInfo(token_pos, kind, deopt_id, locs, 0); |
| 1117 RecordSafepoint(locs); | |
| 1118 } | 1117 } |
| 1119 | 1118 |
| 1120 | 1119 |
| 1121 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, | 1120 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
| 1122 intptr_t token_pos, | 1121 intptr_t token_pos, |
| 1123 const ExternalLabel* label, | 1122 const ExternalLabel* label, |
| 1124 RawPcDescriptors::Kind kind, | 1123 RawPcDescriptors::Kind kind, |
| 1125 LocationSummary* locs) { | 1124 LocationSummary* locs) { |
| 1126 __ BranchLinkPatchable(label); | 1125 __ BranchLinkPatchable(label); |
| 1127 AddCurrentDescriptor(kind, deopt_id, token_pos); | 1126 RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count()); |
| 1128 RecordSafepoint(locs); | |
| 1129 // Marks either the continuation point in unoptimized code or the | |
| 1130 // deoptimization point in optimized code, after call. | |
| 1131 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | |
| 1132 if (is_optimizing()) { | |
| 1133 AddDeoptIndexAtCall(deopt_id_after, token_pos); | |
| 1134 } else { | |
| 1135 // Add deoptimization continuation point after the call and before the | |
| 1136 // arguments are removed. | |
| 1137 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | |
| 1138 } | |
| 1139 } | 1127 } |
| 1140 | 1128 |
| 1141 | 1129 |
| 1142 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, | 1130 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, |
| 1143 intptr_t deopt_id, | 1131 intptr_t deopt_id, |
| 1144 const RuntimeEntry& entry, | 1132 const RuntimeEntry& entry, |
| 1145 intptr_t argument_count, | 1133 intptr_t argument_count, |
| 1146 LocationSummary* locs) { | 1134 LocationSummary* locs) { |
| 1147 __ CallRuntime(entry, argument_count); | 1135 __ CallRuntime(entry, argument_count); |
| 1148 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); | 1136 RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0); |
| 1149 RecordSafepoint(locs); | |
| 1150 if (deopt_id != Isolate::kNoDeoptId) { | |
| 1151 // Marks either the continuation point in unoptimized code or the | |
| 1152 // deoptimization point in optimized code, after call. | |
| 1153 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | |
| 1154 if (is_optimizing()) { | |
| 1155 AddDeoptIndexAtCall(deopt_id_after, token_pos); | |
| 1156 } else { | |
| 1157 // Add deoptimization continuation point after the call and before the | |
| 1158 // arguments are removed. | |
| 1159 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | |
| 1160 } | |
| 1161 } | |
| 1162 } | 1137 } |
| 1163 | 1138 |
| 1164 | 1139 |
| 1165 void FlowGraphCompiler::EmitEdgeCounter() { | 1140 void FlowGraphCompiler::EmitEdgeCounter() { |
| 1166 // We do not check for overflow when incrementing the edge counter. The | 1141 // We do not check for overflow when incrementing the edge counter. The |
| 1167 // function should normally be optimized long before the counter can | 1142 // function should normally be optimized long before the counter can |
| 1168 // overflow; and though we do not reset the counters when we optimize or | 1143 // overflow; and though we do not reset the counters when we optimize or |
| 1169 // deoptimize, there is a bound on the number of | 1144 // deoptimize, there is a bound on the number of |
| 1170 // optimization/deoptimization cycles we will attempt. | 1145 // optimization/deoptimization cycles we will attempt. |
| 1171 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | 1146 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 // proper target for the given name and arguments descriptor. If the | 1246 // proper target for the given name and arguments descriptor. If the |
| 1272 // illegal class id was found, the target is a cache miss handler that can | 1247 // illegal class id was found, the target is a cache miss handler that can |
| 1273 // be invoked as a normal Dart function. | 1248 // be invoked as a normal Dart function. |
| 1274 __ add(TMP, R2, Operand(R3, LSL, 3)); | 1249 __ add(TMP, R2, Operand(R3, LSL, 3)); |
| 1275 __ LoadFieldFromOffset(R0, TMP, base + kWordSize, PP); | 1250 __ LoadFieldFromOffset(R0, TMP, base + kWordSize, PP); |
| 1276 __ LoadFieldFromOffset(R1, R0, Function::instructions_offset(), PP); | 1251 __ LoadFieldFromOffset(R1, R0, Function::instructions_offset(), PP); |
| 1277 __ LoadObject(R5, ic_data, PP); | 1252 __ LoadObject(R5, ic_data, PP); |
| 1278 __ LoadObject(R4, arguments_descriptor, PP); | 1253 __ LoadObject(R4, arguments_descriptor, PP); |
| 1279 __ AddImmediate(R1, R1, Instructions::HeaderSize() - kHeapObjectTag, PP); | 1254 __ AddImmediate(R1, R1, Instructions::HeaderSize() - kHeapObjectTag, PP); |
| 1280 __ blr(R1); | 1255 __ blr(R1); |
| 1281 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1256 RecordCallInfo( |
| 1282 Isolate::kNoDeoptId, token_pos); | 1257 token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count()); |
| 1283 RecordSafepoint(locs); | |
| 1284 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); | |
| 1285 __ Drop(argument_count); | 1258 __ Drop(argument_count); |
| 1286 } | 1259 } |
| 1287 | 1260 |
| 1288 | 1261 |
| 1289 void FlowGraphCompiler::EmitUnoptimizedStaticCall( | 1262 void FlowGraphCompiler::EmitUnoptimizedStaticCall( |
| 1290 intptr_t argument_count, | 1263 intptr_t argument_count, |
| 1291 intptr_t deopt_id, | 1264 intptr_t deopt_id, |
| 1292 intptr_t token_pos, | 1265 intptr_t token_pos, |
| 1293 LocationSummary* locs, | 1266 LocationSummary* locs, |
| 1294 const ICData& ic_data) { | 1267 const ICData& ic_data) { |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1740 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1768 __ PopDouble(reg); | 1741 __ PopDouble(reg); |
| 1769 } | 1742 } |
| 1770 | 1743 |
| 1771 | 1744 |
| 1772 #undef __ | 1745 #undef __ |
| 1773 | 1746 |
| 1774 } // namespace dart | 1747 } // namespace dart |
| 1775 | 1748 |
| 1776 #endif // defined TARGET_ARCH_ARM64 | 1749 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |