| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 current = current->outer(); | 122 current = current->outer(); |
| 123 while (current != NULL) { | 123 while (current != NULL) { |
| 124 builder->AddPp(current->function(), slot_ix++); | 124 builder->AddPp(current->function(), slot_ix++); |
| 125 builder->AddPcMarker(previous->function(), slot_ix++); | 125 builder->AddPcMarker(previous->function(), slot_ix++); |
| 126 builder->AddCallerFp(slot_ix++); | 126 builder->AddCallerFp(slot_ix++); |
| 127 | 127 |
| 128 // For any outer environment the deopt id is that of the call instruction | 128 // For any outer environment the deopt id is that of the call instruction |
| 129 // which is recorded in the outer environment. | 129 // which is recorded in the outer environment. |
| 130 builder->AddReturnAddress( | 130 builder->AddReturnAddress( |
| 131 current->function(), | 131 current->function(), |
| 132 Isolate::ToDeoptAfter(current->deopt_id()), | 132 Thread::ToDeoptAfter(current->deopt_id()), |
| 133 slot_ix++); | 133 slot_ix++); |
| 134 | 134 |
| 135 // The values of outgoing arguments can be changed from the inlined call so | 135 // The values of outgoing arguments can be changed from the inlined call so |
| 136 // we must read them from the previous environment. | 136 // we must read them from the previous environment. |
| 137 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 137 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
| 138 builder->AddCopy(previous->ValueAt(i), | 138 builder->AddCopy(previous->ValueAt(i), |
| 139 previous->LocationAt(i), | 139 previous->LocationAt(i), |
| 140 slot_ix++); | 140 slot_ix++); |
| 141 } | 141 } |
| 142 | 142 |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 __ Branch(*StubCode::DeoptimizeLazy_entry()); | 1127 __ Branch(*StubCode::DeoptimizeLazy_entry()); |
| 1128 } | 1128 } |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 | 1131 |
| 1132 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1132 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
| 1133 const StubEntry& stub_entry, | 1133 const StubEntry& stub_entry, |
| 1134 RawPcDescriptors::Kind kind, | 1134 RawPcDescriptors::Kind kind, |
| 1135 LocationSummary* locs) { | 1135 LocationSummary* locs) { |
| 1136 __ BranchLinkPatchable(stub_entry); | 1136 __ BranchLinkPatchable(stub_entry); |
| 1137 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1137 AddCurrentDescriptor(kind, Thread::kNoDeoptId, token_pos); |
| 1138 RecordSafepoint(locs); | 1138 RecordSafepoint(locs); |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 | 1141 |
| 1142 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, | 1142 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
| 1143 intptr_t token_pos, | 1143 intptr_t token_pos, |
| 1144 const StubEntry& stub_entry, | 1144 const StubEntry& stub_entry, |
| 1145 RawPcDescriptors::Kind kind, | 1145 RawPcDescriptors::Kind kind, |
| 1146 LocationSummary* locs) { | 1146 LocationSummary* locs) { |
| 1147 __ BranchLinkPatchable(stub_entry); | 1147 __ BranchLinkPatchable(stub_entry); |
| 1148 AddCurrentDescriptor(kind, deopt_id, token_pos); | 1148 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1149 RecordSafepoint(locs); | 1149 RecordSafepoint(locs); |
| 1150 // Marks either the continuation point in unoptimized code or the | 1150 // Marks either the continuation point in unoptimized code or the |
| 1151 // deoptimization point in optimized code, after call. | 1151 // deoptimization point in optimized code, after call. |
| 1152 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | 1152 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1153 if (is_optimizing()) { | 1153 if (is_optimizing()) { |
| 1154 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1154 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1155 } else { | 1155 } else { |
| 1156 // Add deoptimization continuation point after the call and before the | 1156 // Add deoptimization continuation point after the call and before the |
| 1157 // arguments are removed. | 1157 // arguments are removed. |
| 1158 AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 1158 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 1159 deopt_id_after, token_pos); | 1159 deopt_id_after, token_pos); |
| 1160 } | 1160 } |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 | 1163 |
| 1164 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, | 1164 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, |
| 1165 intptr_t deopt_id, | 1165 intptr_t deopt_id, |
| 1166 const RuntimeEntry& entry, | 1166 const RuntimeEntry& entry, |
| 1167 intptr_t argument_count, | 1167 intptr_t argument_count, |
| 1168 LocationSummary* locs) { | 1168 LocationSummary* locs) { |
| 1169 __ CallRuntime(entry, argument_count); | 1169 __ CallRuntime(entry, argument_count); |
| 1170 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); | 1170 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); |
| 1171 RecordSafepoint(locs); | 1171 RecordSafepoint(locs); |
| 1172 if (deopt_id != Isolate::kNoDeoptId) { | 1172 if (deopt_id != Thread::kNoDeoptId) { |
| 1173 // Marks either the continuation point in unoptimized code or the | 1173 // Marks either the continuation point in unoptimized code or the |
| 1174 // deoptimization point in optimized code, after call. | 1174 // deoptimization point in optimized code, after call. |
| 1175 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | 1175 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1176 if (is_optimizing()) { | 1176 if (is_optimizing()) { |
| 1177 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1177 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1178 } else { | 1178 } else { |
| 1179 // Add deoptimization continuation point after the call and before the | 1179 // Add deoptimization continuation point after the call and before the |
| 1180 // arguments are removed. | 1180 // arguments are removed. |
| 1181 AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 1181 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 1182 deopt_id_after, | 1182 deopt_id_after, |
| 1183 token_pos); | 1183 token_pos); |
| 1184 } | 1184 } |
| 1185 } | 1185 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 __ LoadObject(cacheR, cache); | 1272 __ LoadObject(cacheR, cache); |
| 1273 | 1273 |
| 1274 if (FLAG_use_megamorphic_stub) { | 1274 if (FLAG_use_megamorphic_stub) { |
| 1275 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1275 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| 1276 } else { | 1276 } else { |
| 1277 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR); | 1277 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR); |
| 1278 } | 1278 } |
| 1279 __ LoadObject(R5, ic_data); | 1279 __ LoadObject(R5, ic_data); |
| 1280 __ LoadObject(R4, arguments_descriptor); | 1280 __ LoadObject(R4, arguments_descriptor); |
| 1281 __ blx(targetR); | 1281 __ blx(targetR); |
| 1282 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1282 AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId, token_pos); |
| 1283 Isolate::kNoDeoptId, token_pos); | |
| 1284 RecordSafepoint(locs); | 1283 RecordSafepoint(locs); |
| 1285 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | 1284 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1286 if (is_optimizing()) { | 1285 if (is_optimizing()) { |
| 1287 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1286 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1288 } else { | 1287 } else { |
| 1289 // Add deoptimization continuation point after the call and before the | 1288 // Add deoptimization continuation point after the call and before the |
| 1290 // arguments are removed. | 1289 // arguments are removed. |
| 1291 AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 1290 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 1292 deopt_id_after, token_pos); | 1291 deopt_id_after, token_pos); |
| 1293 } | 1292 } |
| 1294 __ Drop(argument_count); | 1293 __ Drop(argument_count); |
| 1295 } | 1294 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 __ PushObject(obj); | 1343 __ PushObject(obj); |
| 1345 if (is_optimizing()) { | 1344 if (is_optimizing()) { |
| 1346 __ BranchLinkPatchable( | 1345 __ BranchLinkPatchable( |
| 1347 *StubCode::OptimizedIdenticalWithNumberCheck_entry()); | 1346 *StubCode::OptimizedIdenticalWithNumberCheck_entry()); |
| 1348 } else { | 1347 } else { |
| 1349 __ BranchLinkPatchable( | 1348 __ BranchLinkPatchable( |
| 1350 *StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); | 1349 *StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); |
| 1351 } | 1350 } |
| 1352 if (token_pos != Scanner::kNoSourcePos) { | 1351 if (token_pos != Scanner::kNoSourcePos) { |
| 1353 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, | 1352 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, |
| 1354 Isolate::kNoDeoptId, | 1353 Thread::kNoDeoptId, |
| 1355 token_pos); | 1354 token_pos); |
| 1356 } | 1355 } |
| 1357 // Stub returns result in flags (result of a cmp, we need Z computed). | 1356 // Stub returns result in flags (result of a cmp, we need Z computed). |
| 1358 __ Drop(1); // Discard constant. | 1357 __ Drop(1); // Discard constant. |
| 1359 __ Pop(reg); // Restore 'reg'. | 1358 __ Pop(reg); // Restore 'reg'. |
| 1360 } else { | 1359 } else { |
| 1361 __ CompareObject(reg, obj); | 1360 __ CompareObject(reg, obj); |
| 1362 } | 1361 } |
| 1363 return EQ; | 1362 return EQ; |
| 1364 } | 1363 } |
| 1365 | 1364 |
| 1366 | 1365 |
| 1367 Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, | 1366 Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
| 1368 Register right, | 1367 Register right, |
| 1369 bool needs_number_check, | 1368 bool needs_number_check, |
| 1370 intptr_t token_pos) { | 1369 intptr_t token_pos) { |
| 1371 if (needs_number_check) { | 1370 if (needs_number_check) { |
| 1372 __ Push(left); | 1371 __ Push(left); |
| 1373 __ Push(right); | 1372 __ Push(right); |
| 1374 if (is_optimizing()) { | 1373 if (is_optimizing()) { |
| 1375 __ BranchLinkPatchable( | 1374 __ BranchLinkPatchable( |
| 1376 *StubCode::OptimizedIdenticalWithNumberCheck_entry()); | 1375 *StubCode::OptimizedIdenticalWithNumberCheck_entry()); |
| 1377 } else { | 1376 } else { |
| 1378 __ BranchLinkPatchable( | 1377 __ BranchLinkPatchable( |
| 1379 *StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); | 1378 *StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); |
| 1380 } | 1379 } |
| 1381 if (token_pos != Scanner::kNoSourcePos) { | 1380 if (token_pos != Scanner::kNoSourcePos) { |
| 1382 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, | 1381 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, |
| 1383 Isolate::kNoDeoptId, | 1382 Thread::kNoDeoptId, |
| 1384 token_pos); | 1383 token_pos); |
| 1385 } | 1384 } |
| 1386 // Stub returns result in flags (result of a cmp, we need Z computed). | 1385 // Stub returns result in flags (result of a cmp, we need Z computed). |
| 1387 __ Pop(right); | 1386 __ Pop(right); |
| 1388 __ Pop(left); | 1387 __ Pop(left); |
| 1389 } else { | 1388 } else { |
| 1390 __ cmp(left, Operand(right)); | 1389 __ cmp(left, Operand(right)); |
| 1391 } | 1390 } |
| 1392 return EQ; | 1391 return EQ; |
| 1393 } | 1392 } |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 DRegister dreg = EvenDRegisterOf(reg); | 1873 DRegister dreg = EvenDRegisterOf(reg); |
| 1875 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1874 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1876 } | 1875 } |
| 1877 | 1876 |
| 1878 | 1877 |
| 1879 #undef __ | 1878 #undef __ |
| 1880 | 1879 |
| 1881 } // namespace dart | 1880 } // namespace dart |
| 1882 | 1881 |
| 1883 #endif // defined TARGET_ARCH_ARM | 1882 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |