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 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 intptr_t argument_count, | 1248 intptr_t argument_count, |
1249 intptr_t deopt_id, | 1249 intptr_t deopt_id, |
1250 intptr_t token_pos, | 1250 intptr_t token_pos, |
1251 LocationSummary* locs) { | 1251 LocationSummary* locs) { |
1252 const String& name = String::Handle(zone(), ic_data.target_name()); | 1252 const String& name = String::Handle(zone(), ic_data.target_name()); |
1253 const Array& arguments_descriptor = | 1253 const Array& arguments_descriptor = |
1254 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); | 1254 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
1255 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); | 1255 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
1256 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), | 1256 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
1257 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); | 1257 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
1258 const Register receiverR = R0; | |
1259 const Register cacheR = R1; | |
1260 const Register targetR = R1; | |
1261 __ LoadFromOffset(receiverR, SP, (argument_count - 1) * kWordSize); | |
1262 __ LoadObject(cacheR, cache); | |
1263 | 1258 |
| 1259 __ Comment("MegamorphicCall"); |
| 1260 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); |
| 1261 __ LoadObject(R5, cache); |
1264 if (FLAG_use_megamorphic_stub) { | 1262 if (FLAG_use_megamorphic_stub) { |
1265 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1263 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
1266 } else { | 1264 } else { |
1267 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR); | 1265 StubCode::EmitMegamorphicLookup(assembler()); |
1268 } | 1266 } |
1269 __ LoadObject(R5, ic_data); | 1267 __ blr(R1); |
1270 __ LoadObject(R4, arguments_descriptor); | 1268 |
1271 __ blr(targetR); | |
1272 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1269 AddCurrentDescriptor(RawPcDescriptors::kOther, |
1273 Thread::kNoDeoptId, token_pos); | 1270 Thread::kNoDeoptId, token_pos); |
1274 RecordSafepoint(locs); | 1271 RecordSafepoint(locs); |
| 1272 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1273 if (is_optimizing()) { |
| 1274 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1275 } else { |
| 1276 // Add deoptimization continuation point after the call and before the |
| 1277 // arguments are removed. |
| 1278 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
| 1279 } |
| 1280 __ Drop(argument_count); |
| 1281 } |
| 1282 |
| 1283 |
| 1284 void FlowGraphCompiler::EmitSwitchableInstanceCall( |
| 1285 const ICData& ic_data, |
| 1286 intptr_t argument_count, |
| 1287 intptr_t deopt_id, |
| 1288 intptr_t token_pos, |
| 1289 LocationSummary* locs) { |
| 1290 __ Comment("SwitchableCall"); |
| 1291 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); |
| 1292 if (ic_data.NumArgsTested() == 1) { |
| 1293 __ LoadUniqueObject(R5, ic_data); |
| 1294 __ BranchLinkPatchable(*StubCode::ICLookup_entry()); |
| 1295 } else { |
| 1296 const String& name = String::Handle(zone(), ic_data.target_name()); |
| 1297 const Array& arguments_descriptor = |
| 1298 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
| 1299 ASSERT(!arguments_descriptor.IsNull() && |
| 1300 (arguments_descriptor.Length() > 0)); |
| 1301 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
| 1302 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
| 1303 |
| 1304 __ LoadUniqueObject(R5, cache); |
| 1305 __ BranchLinkPatchable(*StubCode::MegamorphicLookup_entry()); |
| 1306 } |
| 1307 __ blr(R1); |
| 1308 |
| 1309 AddCurrentDescriptor(RawPcDescriptors::kOther, |
| 1310 Thread::kNoDeoptId, token_pos); |
| 1311 RecordSafepoint(locs); |
1275 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1312 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1276 if (is_optimizing()) { | 1313 if (is_optimizing()) { |
1277 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1314 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
1278 } else { | 1315 } else { |
1279 // Add deoptimization continuation point after the call and before the | 1316 // Add deoptimization continuation point after the call and before the |
1280 // arguments are removed. | 1317 // arguments are removed. |
1281 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1318 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
1282 } | 1319 } |
1283 __ Drop(argument_count); | 1320 __ Drop(argument_count); |
1284 } | 1321 } |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1857 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
1821 __ PopDouble(reg); | 1858 __ PopDouble(reg); |
1822 } | 1859 } |
1823 | 1860 |
1824 | 1861 |
1825 #undef __ | 1862 #undef __ |
1826 | 1863 |
1827 } // namespace dart | 1864 } // namespace dart |
1828 | 1865 |
1829 #endif // defined TARGET_ARCH_ARM64 | 1866 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |