| 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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 __ CompareClassId(RDI, kOneByteStringCid); | 1332 __ CompareClassId(RDI, kOneByteStringCid); |
| 1333 __ j(NOT_EQUAL, &megamorphic_call, Assembler::kNearJump); | 1333 __ j(NOT_EQUAL, &megamorphic_call, Assembler::kNearJump); |
| 1334 __ movq(RAX, FieldAddress(RDI, String::hash_offset())); | 1334 __ movq(RAX, FieldAddress(RDI, String::hash_offset())); |
| 1335 __ cmpq(RAX, Immediate(0)); | 1335 __ cmpq(RAX, Immediate(0)); |
| 1336 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | 1336 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 1337 | 1337 |
| 1338 __ Bind(&megamorphic_call); | 1338 __ Bind(&megamorphic_call); |
| 1339 __ Comment("Slow case: megamorphic call"); | 1339 __ Comment("Slow case: megamorphic call"); |
| 1340 } | 1340 } |
| 1341 __ LoadObject(RBX, cache); | 1341 __ LoadObject(RBX, cache); |
| 1342 __ call(Address(THR, Thread::megamorphic_lookup_entry_point_offset())); | 1342 __ call(Address(THR, Thread::megamorphic_lookup_checked_entry_offset())); |
| 1343 __ call(RCX); | |
| 1344 | 1343 |
| 1345 __ Bind(&done); | 1344 __ Bind(&done); |
| 1346 RecordSafepoint(locs, slow_path_argument_count); | 1345 RecordSafepoint(locs, slow_path_argument_count); |
| 1347 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1346 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1348 if (FLAG_precompiled_mode) { | 1347 if (FLAG_precompiled_mode) { |
| 1349 // Megamorphic calls may occur in slow path stubs. | 1348 // Megamorphic calls may occur in slow path stubs. |
| 1350 // If valid use try_index argument. | 1349 // If valid use try_index argument. |
| 1351 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1350 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 1352 try_index = CurrentTryIndex(); | 1351 try_index = CurrentTryIndex(); |
| 1353 } | 1352 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1370 __ Drop(argument_count, RCX); | 1369 __ Drop(argument_count, RCX); |
| 1371 } | 1370 } |
| 1372 | 1371 |
| 1373 | 1372 |
| 1374 void FlowGraphCompiler::EmitSwitchableInstanceCall( | 1373 void FlowGraphCompiler::EmitSwitchableInstanceCall( |
| 1375 const ICData& ic_data, | 1374 const ICData& ic_data, |
| 1376 intptr_t argument_count, | 1375 intptr_t argument_count, |
| 1377 intptr_t deopt_id, | 1376 intptr_t deopt_id, |
| 1378 TokenPosition token_pos, | 1377 TokenPosition token_pos, |
| 1379 LocationSummary* locs) { | 1378 LocationSummary* locs) { |
| 1379 ASSERT(ic_data.NumArgsTested() == 1); |
| 1380 const Code& initial_stub = Code::ZoneHandle( |
| 1381 StubCode::ICLookupThroughFunction_entry()->code()); |
| 1382 |
| 1380 __ Comment("SwitchableCall"); | 1383 __ Comment("SwitchableCall"); |
| 1381 __ movq(RDI, Address(RSP, (argument_count - 1) * kWordSize)); | 1384 __ movq(RDI, Address(RSP, (argument_count - 1) * kWordSize)); |
| 1382 ASSERT(ic_data.NumArgsTested() == 1); | |
| 1383 __ LoadUniqueObject(RBX, ic_data); | 1385 __ LoadUniqueObject(RBX, ic_data); |
| 1384 __ CallPatchable(*StubCode::ICLookupThroughFunction_entry()); | 1386 __ LoadUniqueObject(CODE_REG, initial_stub); |
| 1387 __ movq(RCX, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); |
| 1385 __ call(RCX); | 1388 __ call(RCX); |
| 1386 | 1389 |
| 1387 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1390 AddCurrentDescriptor(RawPcDescriptors::kOther, |
| 1388 Thread::kNoDeoptId, token_pos); | 1391 Thread::kNoDeoptId, token_pos); |
| 1389 RecordSafepoint(locs); | 1392 RecordSafepoint(locs); |
| 1390 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1393 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1391 if (is_optimizing()) { | 1394 if (is_optimizing()) { |
| 1392 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1395 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1393 } else { | 1396 } else { |
| 1394 // Add deoptimization continuation point after the call and before the | 1397 // Add deoptimization continuation point after the call and before the |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 __ movups(reg, Address(RSP, 0)); | 1862 __ movups(reg, Address(RSP, 0)); |
| 1860 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1863 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
| 1861 } | 1864 } |
| 1862 | 1865 |
| 1863 | 1866 |
| 1864 #undef __ | 1867 #undef __ |
| 1865 | 1868 |
| 1866 } // namespace dart | 1869 } // namespace dart |
| 1867 | 1870 |
| 1868 #endif // defined TARGET_ARCH_X64 | 1871 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |