| 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 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 | 1493 |
| 1494 __ Comment("EmitTestAndCall"); | 1494 __ Comment("EmitTestAndCall"); |
| 1495 const Array& arguments_descriptor = Array::ZoneHandle( | 1495 const Array& arguments_descriptor = Array::ZoneHandle( |
| 1496 zone(), ArgumentsDescriptor::New(argument_count, argument_names)); | 1496 zone(), ArgumentsDescriptor::New(argument_count, argument_names)); |
| 1497 | 1497 |
| 1498 // Load receiver into R0. | 1498 // Load receiver into R0. |
| 1499 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); | 1499 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); |
| 1500 __ LoadObject(R4, arguments_descriptor); | 1500 __ LoadObject(R4, arguments_descriptor); |
| 1501 | 1501 |
| 1502 const bool kFirstCheckIsSmi = ic_data.GetReceiverClassIdAt(0) == kSmiCid; | 1502 const bool kFirstCheckIsSmi = ic_data.GetReceiverClassIdAt(0) == kSmiCid; |
| 1503 const intptr_t kNumChecks = ic_data.NumberOfChecks(); | 1503 const intptr_t num_checks = ic_data.NumberOfChecks(); |
| 1504 | 1504 |
| 1505 ASSERT(!ic_data.IsNull() && (kNumChecks > 0)); | 1505 ASSERT(!ic_data.IsNull() && (num_checks > 0)); |
| 1506 | 1506 |
| 1507 Label after_smi_test; | 1507 Label after_smi_test; |
| 1508 if (kFirstCheckIsSmi) { | 1508 if (kFirstCheckIsSmi) { |
| 1509 __ tsti(R0, Immediate(kSmiTagMask)); | 1509 __ tsti(R0, Immediate(kSmiTagMask)); |
| 1510 // Jump if receiver is not Smi. | 1510 // Jump if receiver is not Smi. |
| 1511 if (kNumChecks == 1) { | 1511 if (num_checks == 1) { |
| 1512 __ b(failed, NE); | 1512 __ b(failed, NE); |
| 1513 } else { | 1513 } else { |
| 1514 __ b(&after_smi_test, NE); | 1514 __ b(&after_smi_test, NE); |
| 1515 } | 1515 } |
| 1516 // Do not use the code from the function, but let the code be patched so | 1516 // Do not use the code from the function, but let the code be patched so |
| 1517 // that we can record the outgoing edges to other code. | 1517 // that we can record the outgoing edges to other code. |
| 1518 const Function& function = | 1518 const Function& function = |
| 1519 Function::ZoneHandle(zone(), ic_data.GetTargetAt(0)); | 1519 Function::ZoneHandle(zone(), ic_data.GetTargetAt(0)); |
| 1520 GenerateStaticDartCall(deopt_id, token_index, | 1520 GenerateStaticDartCall(deopt_id, token_index, |
| 1521 *StubCode::CallStaticFunction_entry(), | 1521 *StubCode::CallStaticFunction_entry(), |
| 1522 RawPcDescriptors::kOther, locs, function); | 1522 RawPcDescriptors::kOther, locs, function); |
| 1523 __ Drop(argument_count); | 1523 __ Drop(argument_count); |
| 1524 if (kNumChecks > 1) { | 1524 if (num_checks > 1) { |
| 1525 __ b(match_found); | 1525 __ b(match_found); |
| 1526 } | 1526 } |
| 1527 } else { | 1527 } else { |
| 1528 // Receiver is Smi, but Smi is not a valid class therefore fail. | 1528 // Receiver is Smi, but Smi is not a valid class therefore fail. |
| 1529 // (Smi class must be first in the list). | 1529 // (Smi class must be first in the list). |
| 1530 if (!complete) { | 1530 if (!complete) { |
| 1531 __ tsti(R0, Immediate(kSmiTagMask)); | 1531 __ tsti(R0, Immediate(kSmiTagMask)); |
| 1532 __ b(failed, EQ); | 1532 __ b(failed, EQ); |
| 1533 } | 1533 } |
| 1534 } | 1534 } |
| 1535 __ Bind(&after_smi_test); | 1535 __ Bind(&after_smi_test); |
| 1536 | 1536 |
| 1537 ASSERT(!ic_data.IsNull() && (kNumChecks > 0)); | 1537 ASSERT(!ic_data.IsNull() && (num_checks > 0)); |
| 1538 GrowableArray<CidTarget> sorted(kNumChecks); | 1538 GrowableArray<CidTarget> sorted(num_checks); |
| 1539 SortICDataByCount(ic_data, &sorted, /* drop_smi = */ true); | 1539 SortICDataByCount(ic_data, &sorted, /* drop_smi = */ true); |
| 1540 | 1540 |
| 1541 // Value is not Smi, | 1541 // Value is not Smi, |
| 1542 const intptr_t kSortedLen = sorted.length(); | 1542 const intptr_t kSortedLen = sorted.length(); |
| 1543 // If kSortedLen is 0 then only a Smi check was needed; the Smi check above | 1543 // If kSortedLen is 0 then only a Smi check was needed; the Smi check above |
| 1544 // will fail if there was only one check and receiver is not Smi. | 1544 // will fail if there was only one check and receiver is not Smi. |
| 1545 if (kSortedLen == 0) return; | 1545 if (kSortedLen == 0) return; |
| 1546 | 1546 |
| 1547 __ LoadClassId(R2, R0); | 1547 __ LoadClassId(R2, R0); |
| 1548 for (intptr_t i = 0; i < kSortedLen; i++) { | 1548 for (intptr_t i = 0; i < kSortedLen; i++) { |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1849 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1850 __ PopDouble(reg); | 1850 __ PopDouble(reg); |
| 1851 } | 1851 } |
| 1852 | 1852 |
| 1853 | 1853 |
| 1854 #undef __ | 1854 #undef __ |
| 1855 | 1855 |
| 1856 } // namespace dart | 1856 } // namespace dart |
| 1857 | 1857 |
| 1858 #endif // defined TARGET_ARCH_ARM64 | 1858 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |