| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 __ Branch(&stub_code->DeoptimizeLazyLabel()); | 1132 __ Branch(&stub_code->DeoptimizeLazyLabel()); |
| 1133 } | 1133 } |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 | 1136 |
| 1137 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1137 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
| 1138 const ExternalLabel* label, | 1138 const ExternalLabel* label, |
| 1139 RawPcDescriptors::Kind kind, | 1139 RawPcDescriptors::Kind kind, |
| 1140 LocationSummary* locs) { | 1140 LocationSummary* locs) { |
| 1141 __ BranchLinkPatchable(label); | 1141 __ BranchLinkPatchable(label); |
| 1142 RecordCallInfo(token_pos, kind, Isolate::kNoDeoptId, locs, 0); | 1142 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); |
| 1143 RecordSafepoint(locs); |
| 1143 } | 1144 } |
| 1144 | 1145 |
| 1145 | 1146 |
| 1146 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, | 1147 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
| 1147 intptr_t token_pos, | 1148 intptr_t token_pos, |
| 1148 const ExternalLabel* label, | 1149 const ExternalLabel* label, |
| 1149 RawPcDescriptors::Kind kind, | 1150 RawPcDescriptors::Kind kind, |
| 1150 LocationSummary* locs) { | 1151 LocationSummary* locs) { |
| 1151 __ BranchLinkPatchable(label); | 1152 __ BranchLinkPatchable(label); |
| 1152 RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count()); | 1153 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1154 RecordSafepoint(locs); |
| 1155 // Marks either the continuation point in unoptimized code or the |
| 1156 // deoptimization point in optimized code, after call. |
| 1157 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); |
| 1158 if (is_optimizing()) { |
| 1159 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1160 } else { |
| 1161 // Add deoptimization continuation point after the call and before the |
| 1162 // arguments are removed. |
| 1163 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 1164 deopt_id_after, |
| 1165 token_pos); |
| 1166 } |
| 1153 } | 1167 } |
| 1154 | 1168 |
| 1155 | 1169 |
| 1156 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, | 1170 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, |
| 1157 intptr_t deopt_id, | 1171 intptr_t deopt_id, |
| 1158 const RuntimeEntry& entry, | 1172 const RuntimeEntry& entry, |
| 1159 intptr_t argument_count, | 1173 intptr_t argument_count, |
| 1160 LocationSummary* locs) { | 1174 LocationSummary* locs) { |
| 1161 __ CallRuntime(entry, argument_count); | 1175 __ CallRuntime(entry, argument_count); |
| 1162 RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0); | 1176 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); |
| 1177 RecordSafepoint(locs); |
| 1178 if (deopt_id != Isolate::kNoDeoptId) { |
| 1179 // Marks either the continuation point in unoptimized code or the |
| 1180 // deoptimization point in optimized code, after call. |
| 1181 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); |
| 1182 if (is_optimizing()) { |
| 1183 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1184 } else { |
| 1185 // Add deoptimization continuation point after the call and before the |
| 1186 // arguments are removed. |
| 1187 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 1188 deopt_id_after, |
| 1189 token_pos); |
| 1190 } |
| 1191 } |
| 1163 } | 1192 } |
| 1164 | 1193 |
| 1165 | 1194 |
| 1166 void FlowGraphCompiler::EmitEdgeCounter() { | 1195 void FlowGraphCompiler::EmitEdgeCounter() { |
| 1167 // We do not check for overflow when incrementing the edge counter. The | 1196 // We do not check for overflow when incrementing the edge counter. The |
| 1168 // function should normally be optimized long before the counter can | 1197 // function should normally be optimized long before the counter can |
| 1169 // overflow; and though we do not reset the counters when we optimize or | 1198 // overflow; and though we do not reset the counters when we optimize or |
| 1170 // deoptimize, there is a bound on the number of | 1199 // deoptimize, there is a bound on the number of |
| 1171 // optimization/deoptimization cycles we will attempt. | 1200 // optimization/deoptimization cycles we will attempt. |
| 1172 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | 1201 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 // be invoked as a normal Dart function. | 1305 // be invoked as a normal Dart function. |
| 1277 __ sll(T1, T3, 2); | 1306 __ sll(T1, T3, 2); |
| 1278 __ addu(T1, T2, T1); | 1307 __ addu(T1, T2, T1); |
| 1279 __ lw(T0, FieldAddress(T1, base + kWordSize)); | 1308 __ lw(T0, FieldAddress(T1, base + kWordSize)); |
| 1280 | 1309 |
| 1281 __ lw(T1, FieldAddress(T0, Function::instructions_offset())); | 1310 __ lw(T1, FieldAddress(T0, Function::instructions_offset())); |
| 1282 __ LoadObject(S5, ic_data); | 1311 __ LoadObject(S5, ic_data); |
| 1283 __ LoadObject(S4, arguments_descriptor); | 1312 __ LoadObject(S4, arguments_descriptor); |
| 1284 __ AddImmediate(T1, Instructions::HeaderSize() - kHeapObjectTag); | 1313 __ AddImmediate(T1, Instructions::HeaderSize() - kHeapObjectTag); |
| 1285 __ jalr(T1); | 1314 __ jalr(T1); |
| 1286 RecordCallInfo( | 1315 AddCurrentDescriptor(RawPcDescriptors::kOther, |
| 1287 token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count()); | 1316 Isolate::kNoDeoptId, token_pos); |
| 1317 RecordSafepoint(locs); |
| 1318 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); |
| 1288 __ Drop(argument_count); | 1319 __ Drop(argument_count); |
| 1289 } | 1320 } |
| 1290 | 1321 |
| 1291 | 1322 |
| 1292 void FlowGraphCompiler::EmitUnoptimizedStaticCall( | 1323 void FlowGraphCompiler::EmitUnoptimizedStaticCall( |
| 1293 intptr_t argument_count, | 1324 intptr_t argument_count, |
| 1294 intptr_t deopt_id, | 1325 intptr_t deopt_id, |
| 1295 intptr_t token_pos, | 1326 intptr_t token_pos, |
| 1296 LocationSummary* locs, | 1327 LocationSummary* locs, |
| 1297 const ICData& ic_data) { | 1328 const ICData& ic_data) { |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1768 __ AddImmediate(SP, kDoubleSize); | 1799 __ AddImmediate(SP, kDoubleSize); |
| 1769 } | 1800 } |
| 1770 | 1801 |
| 1771 | 1802 |
| 1772 #undef __ | 1803 #undef __ |
| 1773 | 1804 |
| 1774 | 1805 |
| 1775 } // namespace dart | 1806 } // namespace dart |
| 1776 | 1807 |
| 1777 #endif // defined TARGET_ARCH_MIPS | 1808 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |