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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 | 1605 |
1606 if (emit_full_guard) { | 1606 if (emit_full_guard) { |
1607 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1607 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); |
1608 | 1608 |
1609 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); | 1609 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); |
1610 FieldAddress field_nullability_operand( | 1610 FieldAddress field_nullability_operand( |
1611 field_reg, Field::is_nullable_offset()); | 1611 field_reg, Field::is_nullable_offset()); |
1612 | 1612 |
1613 if (value_cid == kDynamicCid) { | 1613 if (value_cid == kDynamicCid) { |
1614 LoadValueCid(compiler, value_cid_reg, value_reg); | 1614 LoadValueCid(compiler, value_cid_reg, value_reg); |
1615 __ ldr(IP, field_cid_operand); | 1615 __ ldrh(IP, field_cid_operand); |
1616 __ cmp(value_cid_reg, Operand(IP)); | 1616 __ cmp(value_cid_reg, Operand(IP)); |
1617 __ b(&ok, EQ); | 1617 __ b(&ok, EQ); |
1618 __ ldr(IP, field_nullability_operand); | 1618 __ ldrh(IP, field_nullability_operand); |
1619 __ cmp(value_cid_reg, Operand(IP)); | 1619 __ cmp(value_cid_reg, Operand(IP)); |
1620 } else if (value_cid == kNullCid) { | 1620 } else if (value_cid == kNullCid) { |
1621 __ ldr(value_cid_reg, field_nullability_operand); | 1621 __ ldrh(value_cid_reg, field_nullability_operand); |
1622 __ CompareImmediate(value_cid_reg, value_cid); | 1622 __ CompareImmediate(value_cid_reg, value_cid); |
1623 } else { | 1623 } else { |
1624 __ ldr(value_cid_reg, field_cid_operand); | 1624 __ ldrh(value_cid_reg, field_cid_operand); |
1625 __ CompareImmediate(value_cid_reg, value_cid); | 1625 __ CompareImmediate(value_cid_reg, value_cid); |
1626 } | 1626 } |
1627 __ b(&ok, EQ); | 1627 __ b(&ok, EQ); |
1628 | 1628 |
1629 // Check if the tracked state of the guarded field can be initialized | 1629 // Check if the tracked state of the guarded field can be initialized |
1630 // inline. If the field needs length check we fall through to runtime | 1630 // inline. If the field needs length check we fall through to runtime |
1631 // which is responsible for computing offset of the length field | 1631 // which is responsible for computing offset of the length field |
1632 // based on the class id. | 1632 // based on the class id. |
1633 // Length guard will be emitted separately when needed via GuardFieldLength | 1633 // Length guard will be emitted separately when needed via GuardFieldLength |
1634 // instruction after GuardFieldClass. | 1634 // instruction after GuardFieldClass. |
1635 if (!field().needs_length_check()) { | 1635 if (!field().needs_length_check()) { |
1636 // Uninitialized field can be handled inline. Check if the | 1636 // Uninitialized field can be handled inline. Check if the |
1637 // field is still unitialized. | 1637 // field is still unitialized. |
1638 __ ldr(IP, field_cid_operand); | 1638 __ ldrh(IP, field_cid_operand); |
1639 __ CompareImmediate(IP, kIllegalCid); | 1639 __ CompareImmediate(IP, kIllegalCid); |
1640 __ b(fail, NE); | 1640 __ b(fail, NE); |
1641 | 1641 |
1642 if (value_cid == kDynamicCid) { | 1642 if (value_cid == kDynamicCid) { |
1643 __ str(value_cid_reg, field_cid_operand); | 1643 __ strh(value_cid_reg, field_cid_operand); |
1644 __ str(value_cid_reg, field_nullability_operand); | 1644 __ strh(value_cid_reg, field_nullability_operand); |
1645 } else { | 1645 } else { |
1646 __ LoadImmediate(IP, value_cid); | 1646 __ LoadImmediate(IP, value_cid); |
1647 __ str(IP, field_cid_operand); | 1647 __ strh(IP, field_cid_operand); |
1648 __ str(IP, field_nullability_operand); | 1648 __ strh(IP, field_nullability_operand); |
1649 } | 1649 } |
1650 | 1650 |
1651 if (deopt == NULL) { | 1651 if (deopt == NULL) { |
1652 ASSERT(!compiler->is_optimizing()); | 1652 ASSERT(!compiler->is_optimizing()); |
1653 __ b(&ok); | 1653 __ b(&ok); |
1654 } | 1654 } |
1655 } | 1655 } |
1656 | 1656 |
1657 if (deopt == NULL) { | 1657 if (deopt == NULL) { |
1658 ASSERT(!compiler->is_optimizing()); | 1658 ASSERT(!compiler->is_optimizing()); |
1659 __ Bind(fail); | 1659 __ Bind(fail); |
1660 | 1660 |
1661 __ ldr(IP, FieldAddress(field_reg, Field::guarded_cid_offset())); | 1661 __ ldrh(IP, FieldAddress(field_reg, Field::guarded_cid_offset())); |
1662 __ CompareImmediate(IP, kDynamicCid); | 1662 __ CompareImmediate(IP, kDynamicCid); |
1663 __ b(&ok, EQ); | 1663 __ b(&ok, EQ); |
1664 | 1664 |
1665 __ Push(field_reg); | 1665 __ Push(field_reg); |
1666 __ Push(value_reg); | 1666 __ Push(value_reg); |
1667 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); | 1667 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); |
1668 __ Drop(2); // Drop the field and the value. | 1668 __ Drop(2); // Drop the field and the value. |
1669 } | 1669 } |
1670 } else { | 1670 } else { |
1671 ASSERT(compiler->is_optimizing()); | 1671 ASSERT(compiler->is_optimizing()); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 locs()->live_registers()->Add(locs()->in(1), kTagged); | 2101 locs()->live_registers()->Add(locs()->in(1), kTagged); |
2102 } | 2102 } |
2103 | 2103 |
2104 Label store_pointer; | 2104 Label store_pointer; |
2105 Label store_double; | 2105 Label store_double; |
2106 Label store_float32x4; | 2106 Label store_float32x4; |
2107 Label store_float64x2; | 2107 Label store_float64x2; |
2108 | 2108 |
2109 __ LoadObject(temp, Field::ZoneHandle(field().raw())); | 2109 __ LoadObject(temp, Field::ZoneHandle(field().raw())); |
2110 | 2110 |
2111 __ ldr(temp2, FieldAddress(temp, Field::is_nullable_offset())); | 2111 __ ldrh(temp2, FieldAddress(temp, Field::is_nullable_offset())); |
2112 __ CompareImmediate(temp2, kNullCid); | 2112 __ CompareImmediate(temp2, kNullCid); |
2113 __ b(&store_pointer, EQ); | 2113 __ b(&store_pointer, EQ); |
2114 | 2114 |
2115 __ ldrb(temp2, FieldAddress(temp, Field::kind_bits_offset())); | 2115 __ ldrb(temp2, FieldAddress(temp, Field::kind_bits_offset())); |
2116 __ tst(temp2, Operand(1 << Field::kUnboxingCandidateBit)); | 2116 __ tst(temp2, Operand(1 << Field::kUnboxingCandidateBit)); |
2117 __ b(&store_pointer, EQ); | 2117 __ b(&store_pointer, EQ); |
2118 | 2118 |
2119 __ ldr(temp2, FieldAddress(temp, Field::guarded_cid_offset())); | 2119 __ ldrh(temp2, FieldAddress(temp, Field::guarded_cid_offset())); |
2120 __ CompareImmediate(temp2, kDoubleCid); | 2120 __ CompareImmediate(temp2, kDoubleCid); |
2121 __ b(&store_double, EQ); | 2121 __ b(&store_double, EQ); |
2122 | 2122 |
2123 __ ldr(temp2, FieldAddress(temp, Field::guarded_cid_offset())); | 2123 __ ldrh(temp2, FieldAddress(temp, Field::guarded_cid_offset())); |
2124 __ CompareImmediate(temp2, kFloat32x4Cid); | 2124 __ CompareImmediate(temp2, kFloat32x4Cid); |
2125 __ b(&store_float32x4, EQ); | 2125 __ b(&store_float32x4, EQ); |
2126 | 2126 |
2127 __ ldr(temp2, FieldAddress(temp, Field::guarded_cid_offset())); | 2127 __ ldrh(temp2, FieldAddress(temp, Field::guarded_cid_offset())); |
2128 __ CompareImmediate(temp2, kFloat64x2Cid); | 2128 __ CompareImmediate(temp2, kFloat64x2Cid); |
2129 __ b(&store_float64x2, EQ); | 2129 __ b(&store_float64x2, EQ); |
2130 | 2130 |
2131 // Fall through. | 2131 // Fall through. |
2132 __ b(&store_pointer); | 2132 __ b(&store_pointer); |
2133 | 2133 |
2134 if (!compiler->is_optimizing()) { | 2134 if (!compiler->is_optimizing()) { |
2135 locs()->live_registers()->Add(locs()->in(0)); | 2135 locs()->live_registers()->Add(locs()->in(0)); |
2136 locs()->live_registers()->Add(locs()->in(1)); | 2136 locs()->live_registers()->Add(locs()->in(1)); |
2137 } | 2137 } |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 Label load_double; | 2466 Label load_double; |
2467 Label load_float32x4; | 2467 Label load_float32x4; |
2468 Label load_float64x2; | 2468 Label load_float64x2; |
2469 | 2469 |
2470 __ LoadObject(result_reg, Field::ZoneHandle(field()->raw())); | 2470 __ LoadObject(result_reg, Field::ZoneHandle(field()->raw())); |
2471 | 2471 |
2472 FieldAddress field_cid_operand(result_reg, Field::guarded_cid_offset()); | 2472 FieldAddress field_cid_operand(result_reg, Field::guarded_cid_offset()); |
2473 FieldAddress field_nullability_operand(result_reg, | 2473 FieldAddress field_nullability_operand(result_reg, |
2474 Field::is_nullable_offset()); | 2474 Field::is_nullable_offset()); |
2475 | 2475 |
2476 __ ldr(temp, field_nullability_operand); | 2476 __ ldrh(temp, field_nullability_operand); |
2477 __ CompareImmediate(temp, kNullCid); | 2477 __ CompareImmediate(temp, kNullCid); |
2478 __ b(&load_pointer, EQ); | 2478 __ b(&load_pointer, EQ); |
2479 | 2479 |
2480 __ ldr(temp, field_cid_operand); | 2480 __ ldrh(temp, field_cid_operand); |
2481 __ CompareImmediate(temp, kDoubleCid); | 2481 __ CompareImmediate(temp, kDoubleCid); |
2482 __ b(&load_double, EQ); | 2482 __ b(&load_double, EQ); |
2483 | 2483 |
2484 __ ldr(temp, field_cid_operand); | 2484 __ ldrh(temp, field_cid_operand); |
2485 __ CompareImmediate(temp, kFloat32x4Cid); | 2485 __ CompareImmediate(temp, kFloat32x4Cid); |
2486 __ b(&load_float32x4, EQ); | 2486 __ b(&load_float32x4, EQ); |
2487 | 2487 |
2488 __ ldr(temp, field_cid_operand); | 2488 __ ldrh(temp, field_cid_operand); |
2489 __ CompareImmediate(temp, kFloat64x2Cid); | 2489 __ CompareImmediate(temp, kFloat64x2Cid); |
2490 __ b(&load_float64x2, EQ); | 2490 __ b(&load_float64x2, EQ); |
2491 | 2491 |
2492 // Fall through. | 2492 // Fall through. |
2493 __ b(&load_pointer); | 2493 __ b(&load_pointer); |
2494 | 2494 |
2495 if (!compiler->is_optimizing()) { | 2495 if (!compiler->is_optimizing()) { |
2496 locs()->live_registers()->Add(locs()->in(0)); | 2496 locs()->live_registers()->Add(locs()->in(0)); |
2497 } | 2497 } |
2498 | 2498 |
(...skipping 4380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6879 1, | 6879 1, |
6880 locs()); | 6880 locs()); |
6881 __ Drop(1); | 6881 __ Drop(1); |
6882 __ Pop(result); | 6882 __ Pop(result); |
6883 } | 6883 } |
6884 | 6884 |
6885 | 6885 |
6886 } // namespace dart | 6886 } // namespace dart |
6887 | 6887 |
6888 #endif // defined TARGET_ARCH_ARM | 6888 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |