| 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 Label skip_length_check; | 1602 Label skip_length_check; |
| 1603 __ ldr(IP, field_cid_operand); | 1603 __ ldr(IP, field_cid_operand); |
| 1604 __ cmp(value_cid_reg, ShifterOperand(IP)); | 1604 __ cmp(value_cid_reg, ShifterOperand(IP)); |
| 1605 __ b(&skip_length_check, NE); | 1605 __ b(&skip_length_check, NE); |
| 1606 if (field_has_length) { | 1606 if (field_has_length) { |
| 1607 ASSERT(temp_reg != kNoRegister); | 1607 ASSERT(temp_reg != kNoRegister); |
| 1608 // Field guard may have remembered list length, check it. | 1608 // Field guard may have remembered list length, check it. |
| 1609 if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) { | 1609 if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) { |
| 1610 __ ldr(temp_reg, | 1610 __ ldr(temp_reg, |
| 1611 FieldAddress(value_reg, Array::length_offset())); | 1611 FieldAddress(value_reg, Array::length_offset())); |
| 1612 __ CompareImmediate(temp_reg, field_length); | 1612 __ CompareImmediate(temp_reg, Smi::RawValue(field_length)); |
| 1613 } else if (RawObject::IsTypedDataClassId(field_cid)) { | 1613 } else if (RawObject::IsTypedDataClassId(field_cid)) { |
| 1614 __ ldr(temp_reg, | 1614 __ ldr(temp_reg, |
| 1615 FieldAddress(value_reg, TypedData::length_offset())); | 1615 FieldAddress(value_reg, TypedData::length_offset())); |
| 1616 __ CompareImmediate(temp_reg, field_length); | 1616 __ CompareImmediate(temp_reg, Smi::RawValue(field_length)); |
| 1617 } else { | 1617 } else { |
| 1618 ASSERT(field_cid == kIllegalCid); | 1618 ASSERT(field_cid == kIllegalCid); |
| 1619 Label check_array, local_exit, local_fail; |
| 1620 __ CompareImmediate(value_cid_reg, kNullCid); |
| 1621 __ b(&local_fail, EQ); |
| 1622 // Check for typed data array. |
| 1623 __ CompareImmediate(value_cid_reg, kTypedDataFloat32x4ArrayCid); |
| 1624 __ b(&local_fail, GT); |
| 1625 __ CompareImmediate(value_cid_reg, kTypedDataInt8ArrayCid); |
| 1626 __ b(&check_array, LT); // Could still be a regular array. |
| 1627 __ ldr(temp_reg, |
| 1628 FieldAddress(value_reg, TypedData::length_offset())); |
| 1629 __ ldr(IP, field_length_operand); |
| 1630 __ cmp(temp_reg, ShifterOperand(IP)); |
| 1631 __ b(&local_exit); // Updated field length typed data array. |
| 1632 // Check for regular array. |
| 1633 __ Bind(&check_array); |
| 1634 __ CompareImmediate(value_cid_reg, kImmutableArrayCid); |
| 1635 __ b(&local_fail, GT); |
| 1636 __ CompareImmediate(value_cid_reg, kArrayCid); |
| 1637 __ b(&local_fail, LT); |
| 1638 __ ldr(temp_reg, |
| 1639 FieldAddress(value_reg, Array::length_offset())); |
| 1640 __ ldr(IP, field_length_operand); |
| 1641 __ cmp(temp_reg, ShifterOperand(IP)); |
| 1642 __ b(&local_exit); // Updated field length from regular array. |
| 1643 |
| 1644 __ Bind(&local_fail); |
| 1645 __ LoadImmediate(IP, Smi::RawValue(Field::kNoFixedLength)); |
| 1646 __ str(IP, field_length_operand); |
| 1647 |
| 1648 __ Bind(&local_exit); |
| 1619 // Following branch cannot not occur, fall through. | 1649 // Following branch cannot not occur, fall through. |
| 1620 } | 1650 } |
| 1621 __ b(fail, NE); | 1651 __ b(fail, NE); |
| 1622 } | 1652 } |
| 1623 __ Bind(&skip_length_check); | 1653 __ Bind(&skip_length_check); |
| 1624 __ ldr(IP, field_nullability_operand); | 1654 __ ldr(IP, field_nullability_operand); |
| 1625 __ cmp(value_cid_reg, ShifterOperand(IP)); | 1655 __ cmp(value_cid_reg, ShifterOperand(IP)); |
| 1626 } else if (value_cid == kNullCid) { | 1656 } else if (value_cid == kNullCid) { |
| 1627 __ ldr(value_cid_reg, field_nullability_operand); | 1657 __ ldr(value_cid_reg, field_nullability_operand); |
| 1628 __ CompareImmediate(value_cid_reg, value_cid); | 1658 __ CompareImmediate(value_cid_reg, value_cid); |
| 1629 } else { | 1659 } else { |
| 1630 Label skip_length_check; | 1660 Label skip_length_check; |
| 1631 __ ldr(value_cid_reg, field_cid_operand); | 1661 __ ldr(value_cid_reg, field_cid_operand); |
| 1632 __ CompareImmediate(value_cid_reg, value_cid); | 1662 __ CompareImmediate(value_cid_reg, value_cid); |
| 1633 __ b(&skip_length_check, NE); | 1663 __ b(&skip_length_check, NE); |
| 1634 if (field_has_length) { | 1664 if (field_has_length) { |
| 1635 ASSERT(value_cid_reg != kNoRegister); | 1665 ASSERT(value_cid_reg != kNoRegister); |
| 1636 ASSERT(temp_reg != kNoRegister); | 1666 ASSERT(temp_reg != kNoRegister); |
| 1637 if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) { | 1667 if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) { |
| 1638 __ ldr(temp_reg, | 1668 __ ldr(temp_reg, |
| 1639 FieldAddress(value_reg, Array::length_offset())); | 1669 FieldAddress(value_reg, Array::length_offset())); |
| 1640 __ CompareImmediate(temp_reg, field_length); | 1670 __ CompareImmediate(temp_reg, Smi::RawValue(field_length)); |
| 1641 } else if (RawObject::IsTypedDataClassId(field_cid)) { | 1671 } else if (RawObject::IsTypedDataClassId(field_cid)) { |
| 1642 __ ldr(temp_reg, | 1672 __ ldr(temp_reg, |
| 1643 FieldAddress(value_reg, TypedData::length_offset())); | 1673 FieldAddress(value_reg, TypedData::length_offset())); |
| 1644 __ CompareImmediate(temp_reg, field_length); | 1674 __ CompareImmediate(temp_reg, Smi::RawValue(field_length)); |
| 1645 } else { | 1675 } else { |
| 1646 ASSERT(field_cid == kIllegalCid); | 1676 ASSERT(field_cid == kIllegalCid); |
| 1647 // Following jump cannot not occur, fall through. | 1677 // Following jump cannot not occur, fall through. |
| 1648 } | 1678 } |
| 1679 __ b(fail, NE); |
| 1649 } | 1680 } |
| 1650 // Not identical, possibly null. | 1681 // Not identical, possibly null. |
| 1651 __ Bind(&skip_length_check); | 1682 __ Bind(&skip_length_check); |
| 1652 } | 1683 } |
| 1653 __ b(&ok, EQ); | 1684 __ b(&ok, EQ); |
| 1654 | 1685 |
| 1655 __ ldr(IP, field_cid_operand); | 1686 __ ldr(IP, field_cid_operand); |
| 1656 __ CompareImmediate(IP, kIllegalCid); | 1687 __ CompareImmediate(IP, kIllegalCid); |
| 1657 __ b(fail, NE); | 1688 __ b(fail, NE); |
| 1658 | 1689 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1679 __ b(&local_fail, GT); | 1710 __ b(&local_fail, GT); |
| 1680 __ CompareImmediate(value_cid_reg, kArrayCid); | 1711 __ CompareImmediate(value_cid_reg, kArrayCid); |
| 1681 __ b(&local_fail, LT); | 1712 __ b(&local_fail, LT); |
| 1682 // Destroy value_cid_reg (safe because we are finished with it). | 1713 // Destroy value_cid_reg (safe because we are finished with it). |
| 1683 __ ldr(value_cid_reg, | 1714 __ ldr(value_cid_reg, |
| 1684 FieldAddress(value_reg, Array::length_offset())); | 1715 FieldAddress(value_reg, Array::length_offset())); |
| 1685 __ str(value_cid_reg, field_length_operand); | 1716 __ str(value_cid_reg, field_length_operand); |
| 1686 __ b(&local_exit); // Updated field length from regular array. | 1717 __ b(&local_exit); // Updated field length from regular array. |
| 1687 | 1718 |
| 1688 __ Bind(&local_fail); | 1719 __ Bind(&local_fail); |
| 1689 __ LoadImmediate(IP, Field::kNoFixedLength); | 1720 __ LoadImmediate(IP, Smi::RawValue(Field::kNoFixedLength)); |
| 1690 __ str(IP, field_length_operand); | 1721 __ str(IP, field_length_operand); |
| 1691 | 1722 |
| 1692 __ Bind(&local_exit); | 1723 __ Bind(&local_exit); |
| 1693 } | 1724 } |
| 1694 } else { | 1725 } else { |
| 1695 __ LoadImmediate(IP, value_cid); | 1726 __ LoadImmediate(IP, value_cid); |
| 1696 __ str(IP, field_cid_operand); | 1727 __ str(IP, field_cid_operand); |
| 1697 __ str(IP, field_nullability_operand); | 1728 __ str(IP, field_nullability_operand); |
| 1698 if ((value_cid == kArrayCid) || (value_cid == kImmutableArrayCid)) { | 1729 if (field_has_length) { |
| 1699 // Destroy value_cid_reg (safe because we are finished with it). | 1730 if ((value_cid == kArrayCid) || (value_cid == kImmutableArrayCid)) { |
| 1700 __ ldr(value_cid_reg, | 1731 // Destroy value_cid_reg (safe because we are finished with it). |
| 1701 FieldAddress(value_reg, Array::length_offset())); | 1732 __ ldr(value_cid_reg, |
| 1702 __ str(value_cid_reg, field_length_operand); | 1733 FieldAddress(value_reg, Array::length_offset())); |
| 1703 } else if (RawObject::IsTypedDataClassId(value_cid)) { | 1734 __ str(value_cid_reg, field_length_operand); |
| 1704 // Destroy value_cid_reg (safe because we are finished with it). | 1735 } else if (RawObject::IsTypedDataClassId(value_cid)) { |
| 1705 __ ldr(value_cid_reg, | 1736 // Destroy value_cid_reg (safe because we are finished with it). |
| 1706 FieldAddress(value_reg, TypedData::length_offset())); | 1737 __ ldr(value_cid_reg, |
| 1707 __ str(value_cid_reg, field_length_operand); | 1738 FieldAddress(value_reg, TypedData::length_offset())); |
| 1708 } else { | 1739 __ str(value_cid_reg, field_length_operand); |
| 1709 __ LoadImmediate(IP, Field::kNoFixedLength); | 1740 } else { |
| 1710 __ str(IP, field_length_operand); | 1741 __ LoadImmediate(IP, Smi::RawValue(Field::kNoFixedLength)); |
| 1742 __ str(IP, field_length_operand); |
| 1743 } |
| 1711 } | 1744 } |
| 1712 } | 1745 } |
| 1713 | |
| 1714 if (!ok_is_fall_through) { | 1746 if (!ok_is_fall_through) { |
| 1715 __ b(&ok); | 1747 __ b(&ok); |
| 1716 } | 1748 } |
| 1717 } else { | 1749 } else { |
| 1718 if (field_reg != kNoRegister) { | 1750 if (field_reg != kNoRegister) { |
| 1719 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1751 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); |
| 1720 } | 1752 } |
| 1721 if (value_cid == kDynamicCid) { | 1753 if (value_cid == kDynamicCid) { |
| 1722 // Field's guarded class id is fixed by value's class id is not known. | 1754 // Field's guarded class id is fixed by value's class id is not known. |
| 1723 __ tst(value_reg, ShifterOperand(kSmiTagMask)); | 1755 __ tst(value_reg, ShifterOperand(kSmiTagMask)); |
| (...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4690 compiler->GenerateCall(token_pos(), | 4722 compiler->GenerateCall(token_pos(), |
| 4691 &label, | 4723 &label, |
| 4692 PcDescriptors::kOther, | 4724 PcDescriptors::kOther, |
| 4693 locs()); | 4725 locs()); |
| 4694 __ Drop(2); // Discard type arguments and receiver. | 4726 __ Drop(2); // Discard type arguments and receiver. |
| 4695 } | 4727 } |
| 4696 | 4728 |
| 4697 } // namespace dart | 4729 } // namespace dart |
| 4698 | 4730 |
| 4699 #endif // defined TARGET_ARCH_ARM | 4731 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |