| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 ASSERT(is_optimizing()); | 1530 ASSERT(is_optimizing()); |
| 1531 __ Comment("EmitTestAndCall"); | 1531 __ Comment("EmitTestAndCall"); |
| 1532 const Array& arguments_descriptor = Array::ZoneHandle( | 1532 const Array& arguments_descriptor = Array::ZoneHandle( |
| 1533 zone(), ArgumentsDescriptor::New(argument_count, argument_names)); | 1533 zone(), ArgumentsDescriptor::New(argument_count, argument_names)); |
| 1534 | 1534 |
| 1535 // Load receiver into R0. | 1535 // Load receiver into R0. |
| 1536 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize); | 1536 __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize); |
| 1537 __ LoadObject(R4, arguments_descriptor); | 1537 __ LoadObject(R4, arguments_descriptor); |
| 1538 | 1538 |
| 1539 const bool kFirstCheckIsSmi = ic_data.GetReceiverClassIdAt(0) == kSmiCid; | 1539 const bool kFirstCheckIsSmi = ic_data.GetReceiverClassIdAt(0) == kSmiCid; |
| 1540 const intptr_t kNumChecks = ic_data.NumberOfChecks(); | 1540 const intptr_t num_checks = ic_data.NumberOfChecks(); |
| 1541 | 1541 |
| 1542 ASSERT(!ic_data.IsNull() && (kNumChecks > 0)); | 1542 ASSERT(!ic_data.IsNull() && (num_checks > 0)); |
| 1543 | 1543 |
| 1544 Label after_smi_test; | 1544 Label after_smi_test; |
| 1545 if (kFirstCheckIsSmi) { | 1545 if (kFirstCheckIsSmi) { |
| 1546 __ tst(R0, Operand(kSmiTagMask)); | 1546 __ tst(R0, Operand(kSmiTagMask)); |
| 1547 // Jump if receiver is not Smi. | 1547 // Jump if receiver is not Smi. |
| 1548 if (kNumChecks == 1) { | 1548 if (num_checks == 1) { |
| 1549 __ b(failed, NE); | 1549 __ b(failed, NE); |
| 1550 } else { | 1550 } else { |
| 1551 __ b(&after_smi_test, NE); | 1551 __ b(&after_smi_test, NE); |
| 1552 } | 1552 } |
| 1553 // Do not use the code from the function, but let the code be patched so | 1553 // Do not use the code from the function, but let the code be patched so |
| 1554 // that we can record the outgoing edges to other code. | 1554 // that we can record the outgoing edges to other code. |
| 1555 const Function& function = | 1555 const Function& function = |
| 1556 Function::ZoneHandle(zone(), ic_data.GetTargetAt(0)); | 1556 Function::ZoneHandle(zone(), ic_data.GetTargetAt(0)); |
| 1557 GenerateStaticDartCall(deopt_id, token_index, | 1557 GenerateStaticDartCall(deopt_id, token_index, |
| 1558 *StubCode::CallStaticFunction_entry(), | 1558 *StubCode::CallStaticFunction_entry(), |
| 1559 RawPcDescriptors::kOther, locs, function); | 1559 RawPcDescriptors::kOther, locs, function); |
| 1560 __ Drop(argument_count); | 1560 __ Drop(argument_count); |
| 1561 if (kNumChecks > 1) { | 1561 if (num_checks > 1) { |
| 1562 __ b(match_found); | 1562 __ b(match_found); |
| 1563 } | 1563 } |
| 1564 } else { | 1564 } else { |
| 1565 // Receiver is Smi, but Smi is not a valid class therefore fail. | 1565 // Receiver is Smi, but Smi is not a valid class therefore fail. |
| 1566 // (Smi class must be first in the list). | 1566 // (Smi class must be first in the list). |
| 1567 if (!complete) { | 1567 if (!complete) { |
| 1568 __ tst(R0, Operand(kSmiTagMask)); | 1568 __ tst(R0, Operand(kSmiTagMask)); |
| 1569 __ b(failed, EQ); | 1569 __ b(failed, EQ); |
| 1570 } | 1570 } |
| 1571 } | 1571 } |
| 1572 __ Bind(&after_smi_test); | 1572 __ Bind(&after_smi_test); |
| 1573 | 1573 |
| 1574 ASSERT(!ic_data.IsNull() && (kNumChecks > 0)); | 1574 ASSERT(!ic_data.IsNull() && (num_checks > 0)); |
| 1575 GrowableArray<CidTarget> sorted(kNumChecks); | 1575 GrowableArray<CidTarget> sorted(num_checks); |
| 1576 SortICDataByCount(ic_data, &sorted, /* drop_smi = */ true); | 1576 SortICDataByCount(ic_data, &sorted, /* drop_smi = */ true); |
| 1577 | 1577 |
| 1578 // Value is not Smi, | 1578 // Value is not Smi, |
| 1579 const intptr_t kSortedLen = sorted.length(); | 1579 const intptr_t kSortedLen = sorted.length(); |
| 1580 // If kSortedLen is 0 then only a Smi check was needed; the Smi check above | 1580 // If kSortedLen is 0 then only a Smi check was needed; the Smi check above |
| 1581 // will fail if there was only one check and receiver is not Smi. | 1581 // will fail if there was only one check and receiver is not Smi. |
| 1582 if (kSortedLen == 0) return; | 1582 if (kSortedLen == 0) return; |
| 1583 | 1583 |
| 1584 __ LoadClassId(R2, R0); | 1584 __ LoadClassId(R2, R0); |
| 1585 for (intptr_t i = 0; i < kSortedLen; i++) { | 1585 for (intptr_t i = 0; i < kSortedLen; i++) { |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 DRegister dreg = EvenDRegisterOf(reg); | 1906 DRegister dreg = EvenDRegisterOf(reg); |
| 1907 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1907 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1908 } | 1908 } |
| 1909 | 1909 |
| 1910 | 1910 |
| 1911 #undef __ | 1911 #undef __ |
| 1912 | 1912 |
| 1913 } // namespace dart | 1913 } // namespace dart |
| 1914 | 1914 |
| 1915 #endif // defined TARGET_ARCH_ARM | 1915 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |