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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 intptr_t deopt_id, | 1318 intptr_t deopt_id, |
1319 intptr_t token_pos, | 1319 intptr_t token_pos, |
1320 LocationSummary* locs) { | 1320 LocationSummary* locs) { |
1321 __ Comment("SwitchableCall"); | 1321 __ Comment("SwitchableCall"); |
1322 __ movq(RDI, Address(RSP, (argument_count - 1) * kWordSize)); | 1322 __ movq(RDI, Address(RSP, (argument_count - 1) * kWordSize)); |
1323 if (ic_data.NumArgsTested() == 1) { | 1323 if (ic_data.NumArgsTested() == 1) { |
1324 __ LoadUniqueObject(RBX, ic_data); | 1324 __ LoadUniqueObject(RBX, ic_data); |
1325 __ CallPatchable(*StubCode::ICLookup_entry()); | 1325 __ CallPatchable(*StubCode::ICLookup_entry()); |
1326 } else { | 1326 } else { |
1327 const String& name = String::Handle(zone(), ic_data.target_name()); | 1327 const String& name = String::Handle(zone(), ic_data.target_name()); |
1328 const Array& arguments_descriptor = | |
1329 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); | |
1330 ASSERT(!arguments_descriptor.IsNull() && | |
1331 (arguments_descriptor.Length() > 0)); | |
1332 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), | |
1333 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); | |
1334 | 1328 |
1335 __ LoadUniqueObject(RBX, cache); | 1329 if (name.raw() == Symbols::Plus().raw()) { |
1336 __ CallPatchable(*StubCode::MegamorphicLookup_entry()); | 1330 __ LoadUniqueObject(RBX, ic_data); |
| 1331 __ CallPatchable(*StubCode::ICSmiAddLookup_entry()); |
| 1332 } else if (name.raw() == Symbols::Minus().raw()) { |
| 1333 __ LoadUniqueObject(RBX, ic_data); |
| 1334 __ CallPatchable(*StubCode::ICSmiSubLookup_entry()); |
| 1335 } else if (name.raw() == Symbols::Equals().raw()) { |
| 1336 __ LoadUniqueObject(RBX, ic_data); |
| 1337 __ CallPatchable(*StubCode::ICSmiEqualLookup_entry()); |
| 1338 } else { |
| 1339 const Array& arguments_descriptor = |
| 1340 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
| 1341 ASSERT(!arguments_descriptor.IsNull() && |
| 1342 (arguments_descriptor.Length() > 0)); |
| 1343 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
| 1344 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
| 1345 |
| 1346 __ LoadUniqueObject(RBX, cache); |
| 1347 __ CallPatchable(*StubCode::MegamorphicLookup_entry()); |
| 1348 } |
1337 } | 1349 } |
1338 __ call(RCX); | 1350 __ call(RCX); // A fast Smi operation may return past this call. |
1339 | 1351 |
1340 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1352 AddCurrentDescriptor(RawPcDescriptors::kOther, |
1341 Thread::kNoDeoptId, token_pos); | 1353 Thread::kNoDeoptId, token_pos); |
1342 RecordSafepoint(locs); | 1354 RecordSafepoint(locs); |
1343 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1355 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1344 if (is_optimizing()) { | 1356 if (is_optimizing()) { |
1345 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1357 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
1346 } else { | 1358 } else { |
1347 // Add deoptimization continuation point after the call and before the | 1359 // Add deoptimization continuation point after the call and before the |
1348 // arguments are removed. | 1360 // arguments are removed. |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1795 __ movups(reg, Address(RSP, 0)); | 1807 __ movups(reg, Address(RSP, 0)); |
1796 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1808 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
1797 } | 1809 } |
1798 | 1810 |
1799 | 1811 |
1800 #undef __ | 1812 #undef __ |
1801 | 1813 |
1802 } // namespace dart | 1814 } // namespace dart |
1803 | 1815 |
1804 #endif // defined TARGET_ARCH_X64 | 1816 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |