| 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 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 intptr_t argument_count, | 1269 intptr_t argument_count, |
| 1270 intptr_t deopt_id, | 1270 intptr_t deopt_id, |
| 1271 intptr_t token_pos, | 1271 intptr_t token_pos, |
| 1272 LocationSummary* locs) { | 1272 LocationSummary* locs) { |
| 1273 const String& name = String::Handle(zone(), ic_data.target_name()); | 1273 const String& name = String::Handle(zone(), ic_data.target_name()); |
| 1274 const Array& arguments_descriptor = | 1274 const Array& arguments_descriptor = |
| 1275 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); | 1275 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
| 1276 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); | 1276 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
| 1277 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), | 1277 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
| 1278 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); | 1278 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
| 1279 __ Comment("MegamorphicInstanceCall"); | |
| 1280 const Register receiverR = T0; | |
| 1281 const Register cacheR = T1; | |
| 1282 const Register targetR = T1; | |
| 1283 __ lw(receiverR, Address(SP, (argument_count - 1) * kWordSize)); | |
| 1284 __ LoadObject(cacheR, cache); | |
| 1285 | 1279 |
| 1280 __ Comment("MegamorphicCall"); |
| 1281 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); |
| 1282 __ LoadObject(S5, cache); |
| 1286 if (FLAG_use_megamorphic_stub) { | 1283 if (FLAG_use_megamorphic_stub) { |
| 1287 __ BranchLink(*StubCode::MegamorphicLookup_entry()); | 1284 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| 1288 } else { | 1285 } else { |
| 1289 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR); | 1286 StubCode::EmitMegamorphicLookup(assembler()); |
| 1290 } | 1287 } |
| 1291 __ LoadObject(S5, ic_data); | 1288 __ jalr(T1); |
| 1292 __ LoadObject(S4, arguments_descriptor); | 1289 |
| 1293 __ jalr(targetR); | |
| 1294 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1290 AddCurrentDescriptor(RawPcDescriptors::kOther, |
| 1295 Thread::kNoDeoptId, token_pos); | 1291 Thread::kNoDeoptId, token_pos); |
| 1296 RecordSafepoint(locs); | 1292 RecordSafepoint(locs); |
| 1293 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1294 if (is_optimizing()) { |
| 1295 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1296 } else { |
| 1297 // Add deoptimization continuation point after the call and before the |
| 1298 // arguments are removed. |
| 1299 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
| 1300 } |
| 1301 __ Drop(argument_count); |
| 1302 } |
| 1303 |
| 1304 |
| 1305 void FlowGraphCompiler::EmitSwitchableInstanceCall( |
| 1306 const ICData& ic_data, |
| 1307 intptr_t argument_count, |
| 1308 intptr_t deopt_id, |
| 1309 intptr_t token_pos, |
| 1310 LocationSummary* locs) { |
| 1311 __ Comment("SwitchableCall"); |
| 1312 __ lw(T0, Address(SP, (argument_count - 1) * kWordSize)); |
| 1313 if (ic_data.NumArgsTested() == 1) { |
| 1314 __ LoadUniqueObject(S5, ic_data); |
| 1315 __ BranchLink(*StubCode::ICLookup_entry()); |
| 1316 } else { |
| 1317 const String& name = String::Handle(zone(), ic_data.target_name()); |
| 1318 const Array& arguments_descriptor = |
| 1319 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
| 1320 ASSERT(!arguments_descriptor.IsNull() && |
| 1321 (arguments_descriptor.Length() > 0)); |
| 1322 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
| 1323 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
| 1324 |
| 1325 __ LoadUniqueObject(S5, cache); |
| 1326 __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| 1327 } |
| 1328 __ jalr(T1); |
| 1329 |
| 1330 AddCurrentDescriptor(RawPcDescriptors::kOther, |
| 1331 Thread::kNoDeoptId, token_pos); |
| 1332 RecordSafepoint(locs); |
| 1297 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1333 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1298 if (is_optimizing()) { | 1334 if (is_optimizing()) { |
| 1299 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1335 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1300 } else { | 1336 } else { |
| 1301 // Add deoptimization continuation point after the call and before the | 1337 // Add deoptimization continuation point after the call and before the |
| 1302 // arguments are removed. | 1338 // arguments are removed. |
| 1303 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | 1339 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
| 1304 } | 1340 } |
| 1305 __ Drop(argument_count); | 1341 __ Drop(argument_count); |
| 1306 } | 1342 } |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 __ AddImmediate(SP, kDoubleSize); | 1879 __ AddImmediate(SP, kDoubleSize); |
| 1844 } | 1880 } |
| 1845 | 1881 |
| 1846 | 1882 |
| 1847 #undef __ | 1883 #undef __ |
| 1848 | 1884 |
| 1849 | 1885 |
| 1850 } // namespace dart | 1886 } // namespace dart |
| 1851 | 1887 |
| 1852 #endif // defined TARGET_ARCH_MIPS | 1888 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |