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 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 __ Drop(argument_count, RCX); | 1313 __ Drop(argument_count, RCX); |
1314 } | 1314 } |
1315 | 1315 |
1316 | 1316 |
1317 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1317 void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
1318 const ICData& ic_data, | 1318 const ICData& ic_data, |
1319 intptr_t argument_count, | 1319 intptr_t argument_count, |
1320 intptr_t deopt_id, | 1320 intptr_t deopt_id, |
1321 TokenPosition token_pos, | 1321 TokenPosition token_pos, |
1322 LocationSummary* locs, | 1322 LocationSummary* locs, |
1323 intptr_t try_index) { | 1323 intptr_t try_index, |
| 1324 intptr_t slow_path_argument_count) { |
1324 const String& name = String::Handle(zone(), ic_data.target_name()); | 1325 const String& name = String::Handle(zone(), ic_data.target_name()); |
1325 const Array& arguments_descriptor = | 1326 const Array& arguments_descriptor = |
1326 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); | 1327 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
1327 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); | 1328 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
1328 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), | 1329 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), |
1329 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); | 1330 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
1330 | 1331 |
1331 __ Comment("MegamorphicCall"); | 1332 __ Comment("MegamorphicCall"); |
1332 __ movq(RDI, Address(RSP, (argument_count - 1) * kWordSize)); | 1333 __ movq(RDI, Address(RSP, (argument_count - 1) * kWordSize)); |
1333 __ LoadObject(RBX, cache); | 1334 __ LoadObject(RBX, cache); |
1334 if (FLAG_use_megamorphic_stub) { | 1335 if (FLAG_use_megamorphic_stub) { |
1335 __ Call(*StubCode::MegamorphicLookup_entry()); | 1336 __ Call(*StubCode::MegamorphicLookup_entry()); |
1336 } else { | 1337 } else { |
1337 StubCode::EmitMegamorphicLookup(assembler()); | 1338 StubCode::EmitMegamorphicLookup(assembler()); |
1338 } | 1339 } |
1339 __ call(RCX); | 1340 __ call(RCX); |
1340 | 1341 |
1341 RecordSafepoint(locs); | 1342 RecordSafepoint(locs, slow_path_argument_count); |
1342 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1343 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
1343 if (FLAG_precompiled_mode) { | 1344 if (FLAG_precompiled_mode) { |
1344 // Megamorphic calls may occur in slow path stubs. | 1345 // Megamorphic calls may occur in slow path stubs. |
1345 // If valid use try_index argument. | 1346 // If valid use try_index argument. |
1346 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1347 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
1347 try_index = CurrentTryIndex(); | 1348 try_index = CurrentTryIndex(); |
1348 } | 1349 } |
1349 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, | 1350 pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
1350 assembler()->CodeSize(), | 1351 assembler()->CodeSize(), |
1351 Thread::kNoDeoptId, | 1352 Thread::kNoDeoptId, |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 __ movups(reg, Address(RSP, 0)); | 1851 __ movups(reg, Address(RSP, 0)); |
1851 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1852 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
1852 } | 1853 } |
1853 | 1854 |
1854 | 1855 |
1855 #undef __ | 1856 #undef __ |
1856 | 1857 |
1857 } // namespace dart | 1858 } // namespace dart |
1858 | 1859 |
1859 #endif // defined TARGET_ARCH_X64 | 1860 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |