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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 if (emit_full_guard) { | 1643 if (emit_full_guard) { |
1644 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1644 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); |
1645 | 1645 |
1646 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); | 1646 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); |
1647 FieldAddress field_nullability_operand( | 1647 FieldAddress field_nullability_operand( |
1648 field_reg, Field::is_nullable_offset()); | 1648 field_reg, Field::is_nullable_offset()); |
1649 | 1649 |
1650 if (value_cid == kDynamicCid) { | 1650 if (value_cid == kDynamicCid) { |
1651 LoadValueCid(compiler, value_cid_reg, value_reg); | 1651 LoadValueCid(compiler, value_cid_reg, value_reg); |
1652 | 1652 |
1653 __ lw(CMPRES1, field_cid_operand); | 1653 __ lhu(CMPRES1, field_cid_operand); |
1654 __ beq(value_cid_reg, CMPRES1, &ok); | 1654 __ beq(value_cid_reg, CMPRES1, &ok); |
1655 __ lw(TMP, field_nullability_operand); | 1655 __ lhu(TMP, field_nullability_operand); |
1656 __ subu(CMPRES1, value_cid_reg, TMP); | 1656 __ subu(CMPRES1, value_cid_reg, TMP); |
1657 } else if (value_cid == kNullCid) { | 1657 } else if (value_cid == kNullCid) { |
1658 __ lw(TMP, field_nullability_operand); | 1658 __ lhu(TMP, field_nullability_operand); |
1659 __ LoadImmediate(CMPRES1, value_cid); | 1659 __ LoadImmediate(CMPRES1, value_cid); |
1660 __ subu(CMPRES1, TMP, CMPRES1); | 1660 __ subu(CMPRES1, TMP, CMPRES1); |
1661 } else { | 1661 } else { |
1662 __ lw(TMP, field_cid_operand); | 1662 __ lhu(TMP, field_cid_operand); |
1663 __ LoadImmediate(CMPRES1, value_cid); | 1663 __ LoadImmediate(CMPRES1, value_cid); |
1664 __ subu(CMPRES1, TMP, CMPRES1); | 1664 __ subu(CMPRES1, TMP, CMPRES1); |
1665 } | 1665 } |
1666 __ beq(CMPRES1, ZR, &ok); | 1666 __ beq(CMPRES1, ZR, &ok); |
1667 | 1667 |
1668 // Check if the tracked state of the guarded field can be initialized | 1668 // Check if the tracked state of the guarded field can be initialized |
1669 // inline. If the field needs length check we fall through to runtime | 1669 // inline. If the field needs length check we fall through to runtime |
1670 // which is responsible for computing offset of the length field | 1670 // which is responsible for computing offset of the length field |
1671 // based on the class id. | 1671 // based on the class id. |
1672 // Length guard will be emitted separately when needed via GuardFieldLength | 1672 // Length guard will be emitted separately when needed via GuardFieldLength |
1673 // instruction after GuardFieldClass. | 1673 // instruction after GuardFieldClass. |
1674 if (!field().needs_length_check()) { | 1674 if (!field().needs_length_check()) { |
1675 // Uninitialized field can be handled inline. Check if the | 1675 // Uninitialized field can be handled inline. Check if the |
1676 // field is still unitialized. | 1676 // field is still unitialized. |
1677 __ lw(CMPRES1, field_cid_operand); | 1677 __ lhu(CMPRES1, field_cid_operand); |
1678 __ BranchNotEqual(CMPRES1, Immediate(kIllegalCid), fail); | 1678 __ BranchNotEqual(CMPRES1, Immediate(kIllegalCid), fail); |
1679 | 1679 |
1680 if (value_cid == kDynamicCid) { | 1680 if (value_cid == kDynamicCid) { |
1681 __ sw(value_cid_reg, field_cid_operand); | 1681 __ sh(value_cid_reg, field_cid_operand); |
1682 __ sw(value_cid_reg, field_nullability_operand); | 1682 __ sh(value_cid_reg, field_nullability_operand); |
1683 } else { | 1683 } else { |
1684 __ LoadImmediate(TMP, value_cid); | 1684 __ LoadImmediate(TMP, value_cid); |
1685 __ sw(TMP, field_cid_operand); | 1685 __ sh(TMP, field_cid_operand); |
1686 __ sw(TMP, field_nullability_operand); | 1686 __ sh(TMP, field_nullability_operand); |
1687 } | 1687 } |
1688 | 1688 |
1689 if (deopt == NULL) { | 1689 if (deopt == NULL) { |
1690 ASSERT(!compiler->is_optimizing()); | 1690 ASSERT(!compiler->is_optimizing()); |
1691 __ b(&ok); | 1691 __ b(&ok); |
1692 } | 1692 } |
1693 } | 1693 } |
1694 | 1694 |
1695 if (deopt == NULL) { | 1695 if (deopt == NULL) { |
1696 ASSERT(!compiler->is_optimizing()); | 1696 ASSERT(!compiler->is_optimizing()); |
1697 __ Bind(fail); | 1697 __ Bind(fail); |
1698 | 1698 |
1699 __ lw(CMPRES1, FieldAddress(field_reg, Field::guarded_cid_offset())); | 1699 __ lhu(CMPRES1, FieldAddress(field_reg, Field::guarded_cid_offset())); |
1700 __ BranchEqual(CMPRES1, Immediate(kDynamicCid), &ok); | 1700 __ BranchEqual(CMPRES1, Immediate(kDynamicCid), &ok); |
1701 | 1701 |
1702 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 1702 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
1703 __ sw(field_reg, Address(SP, 1 * kWordSize)); | 1703 __ sw(field_reg, Address(SP, 1 * kWordSize)); |
1704 __ sw(value_reg, Address(SP, 0 * kWordSize)); | 1704 __ sw(value_reg, Address(SP, 0 * kWordSize)); |
1705 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); | 1705 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); |
1706 __ Drop(2); // Drop the field and the value. | 1706 __ Drop(2); // Drop the field and the value. |
1707 } | 1707 } |
1708 } else { | 1708 } else { |
1709 ASSERT(compiler->is_optimizing()); | 1709 ASSERT(compiler->is_optimizing()); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 // Value input is a writable register and should be manually preserved | 1993 // Value input is a writable register and should be manually preserved |
1994 // across allocation slow-path. | 1994 // across allocation slow-path. |
1995 locs()->live_registers()->Add(locs()->in(1), kTagged); | 1995 locs()->live_registers()->Add(locs()->in(1), kTagged); |
1996 } | 1996 } |
1997 | 1997 |
1998 Label store_pointer; | 1998 Label store_pointer; |
1999 Label store_double; | 1999 Label store_double; |
2000 | 2000 |
2001 __ LoadObject(temp, Field::ZoneHandle(field().raw())); | 2001 __ LoadObject(temp, Field::ZoneHandle(field().raw())); |
2002 | 2002 |
2003 __ lw(temp2, FieldAddress(temp, Field::is_nullable_offset())); | 2003 __ lhu(temp2, FieldAddress(temp, Field::is_nullable_offset())); |
2004 __ BranchEqual(temp2, Immediate(kNullCid), &store_pointer); | 2004 __ BranchEqual(temp2, Immediate(kNullCid), &store_pointer); |
2005 | 2005 |
2006 __ lbu(temp2, FieldAddress(temp, Field::kind_bits_offset())); | 2006 __ lbu(temp2, FieldAddress(temp, Field::kind_bits_offset())); |
2007 __ andi(CMPRES1, temp2, Immediate(1 << Field::kUnboxingCandidateBit)); | 2007 __ andi(CMPRES1, temp2, Immediate(1 << Field::kUnboxingCandidateBit)); |
2008 __ beq(CMPRES1, ZR, &store_pointer); | 2008 __ beq(CMPRES1, ZR, &store_pointer); |
2009 | 2009 |
2010 __ lw(temp2, FieldAddress(temp, Field::guarded_cid_offset())); | 2010 __ lhu(temp2, FieldAddress(temp, Field::guarded_cid_offset())); |
2011 __ BranchEqual(temp2, Immediate(kDoubleCid), &store_double); | 2011 __ BranchEqual(temp2, Immediate(kDoubleCid), &store_double); |
2012 | 2012 |
2013 // Fall through. | 2013 // Fall through. |
2014 __ b(&store_pointer); | 2014 __ b(&store_pointer); |
2015 | 2015 |
2016 if (!compiler->is_optimizing()) { | 2016 if (!compiler->is_optimizing()) { |
2017 locs()->live_registers()->Add(locs()->in(0)); | 2017 locs()->live_registers()->Add(locs()->in(0)); |
2018 locs()->live_registers()->Add(locs()->in(1)); | 2018 locs()->live_registers()->Add(locs()->in(1)); |
2019 } | 2019 } |
2020 | 2020 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 | 2310 |
2311 Label load_pointer; | 2311 Label load_pointer; |
2312 Label load_double; | 2312 Label load_double; |
2313 | 2313 |
2314 __ LoadObject(result_reg, Field::ZoneHandle(field()->raw())); | 2314 __ LoadObject(result_reg, Field::ZoneHandle(field()->raw())); |
2315 | 2315 |
2316 FieldAddress field_cid_operand(result_reg, Field::guarded_cid_offset()); | 2316 FieldAddress field_cid_operand(result_reg, Field::guarded_cid_offset()); |
2317 FieldAddress field_nullability_operand(result_reg, | 2317 FieldAddress field_nullability_operand(result_reg, |
2318 Field::is_nullable_offset()); | 2318 Field::is_nullable_offset()); |
2319 | 2319 |
2320 __ lw(temp, field_nullability_operand); | 2320 __ lhu(temp, field_nullability_operand); |
2321 __ BranchEqual(temp, Immediate(kNullCid), &load_pointer); | 2321 __ BranchEqual(temp, Immediate(kNullCid), &load_pointer); |
2322 | 2322 |
2323 __ lw(temp, field_cid_operand); | 2323 __ lhu(temp, field_cid_operand); |
2324 __ BranchEqual(temp, Immediate(kDoubleCid), &load_double); | 2324 __ BranchEqual(temp, Immediate(kDoubleCid), &load_double); |
2325 | 2325 |
2326 // Fall through. | 2326 // Fall through. |
2327 __ b(&load_pointer); | 2327 __ b(&load_pointer); |
2328 | 2328 |
2329 if (!compiler->is_optimizing()) { | 2329 if (!compiler->is_optimizing()) { |
2330 locs()->live_registers()->Add(locs()->in(0)); | 2330 locs()->live_registers()->Add(locs()->in(0)); |
2331 } | 2331 } |
2332 | 2332 |
2333 { | 2333 { |
(...skipping 3288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5622 1, | 5622 1, |
5623 locs()); | 5623 locs()); |
5624 __ lw(result, Address(SP, 1 * kWordSize)); | 5624 __ lw(result, Address(SP, 1 * kWordSize)); |
5625 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5625 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5626 } | 5626 } |
5627 | 5627 |
5628 | 5628 |
5629 } // namespace dart | 5629 } // namespace dart |
5630 | 5630 |
5631 #endif // defined TARGET_ARCH_MIPS | 5631 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |