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