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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 Register field_reg = needs_field_temp_reg ? | 1386 Register field_reg = needs_field_temp_reg ? |
1387 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; | 1387 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; |
1388 | 1388 |
1389 Label ok, fail_label; | 1389 Label ok, fail_label; |
1390 | 1390 |
1391 Label* deopt = compiler->is_optimizing() ? | 1391 Label* deopt = compiler->is_optimizing() ? |
1392 compiler->AddDeoptStub(deopt_id(), kDeoptGuardField) : NULL; | 1392 compiler->AddDeoptStub(deopt_id(), kDeoptGuardField) : NULL; |
1393 | 1393 |
1394 Label* fail = (deopt != NULL) ? deopt : &fail_label; | 1394 Label* fail = (deopt != NULL) ? deopt : &fail_label; |
1395 | 1395 |
1396 const bool ok_is_fall_through = (deopt != NULL); | |
1397 | |
1398 if (!compiler->is_optimizing() || (field_cid == kIllegalCid)) { | 1396 if (!compiler->is_optimizing() || (field_cid == kIllegalCid)) { |
1399 if (!compiler->is_optimizing() && (field_reg == kNoRegister)) { | 1397 if (!compiler->is_optimizing() && (field_reg == kNoRegister)) { |
1400 // Currently we can't have different location summaries for optimized | 1398 // Currently we can't have different location summaries for optimized |
1401 // and non-optimized code. So instead we manually pick up a register | 1399 // and non-optimized code. So instead we manually pick up a register |
1402 // that is known to be free because we know how non-optimizing compiler | 1400 // that is known to be free because we know how non-optimizing compiler |
1403 // allocates registers. | 1401 // allocates registers. |
1404 field_reg = A0; | 1402 field_reg = A0; |
1405 ASSERT((field_reg != value_reg) && (field_reg != value_cid_reg)); | 1403 ASSERT((field_reg != value_reg) && (field_reg != value_cid_reg)); |
1406 } | 1404 } |
1407 | 1405 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 __ lw(value_cid_reg, | 1567 __ lw(value_cid_reg, |
1570 FieldAddress(value_reg, TypedData::length_offset())); | 1568 FieldAddress(value_reg, TypedData::length_offset())); |
1571 __ sw(value_cid_reg, field_length_operand); | 1569 __ sw(value_cid_reg, field_length_operand); |
1572 } else { | 1570 } else { |
1573 // Destroy value_cid_reg (safe because we are finished with it). | 1571 // Destroy value_cid_reg (safe because we are finished with it). |
1574 __ LoadImmediate(value_cid_reg, Smi::RawValue(Field::kNoFixedLength)); | 1572 __ LoadImmediate(value_cid_reg, Smi::RawValue(Field::kNoFixedLength)); |
1575 __ sw(value_cid_reg, field_length_operand); | 1573 __ sw(value_cid_reg, field_length_operand); |
1576 } | 1574 } |
1577 } | 1575 } |
1578 } | 1576 } |
1579 if (!ok_is_fall_through) { | |
1580 __ b(&ok); | |
1581 } | |
1582 | 1577 |
1583 if (deopt == NULL) { | 1578 if (deopt == NULL) { |
1584 ASSERT(!compiler->is_optimizing()); | 1579 ASSERT(!compiler->is_optimizing()); |
| 1580 __ b(&ok); |
1585 __ Bind(fail); | 1581 __ Bind(fail); |
1586 | 1582 |
1587 __ lw(CMPRES1, FieldAddress(field_reg, Field::guarded_cid_offset())); | 1583 __ lw(CMPRES1, FieldAddress(field_reg, Field::guarded_cid_offset())); |
1588 __ BranchEqual(CMPRES1, kDynamicCid, &ok); | 1584 __ BranchEqual(CMPRES1, kDynamicCid, &ok); |
1589 | 1585 |
1590 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 1586 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
1591 __ sw(field_reg, Address(SP, 1 * kWordSize)); | 1587 __ sw(field_reg, Address(SP, 1 * kWordSize)); |
1592 __ sw(value_reg, Address(SP, 0 * kWordSize)); | 1588 __ sw(value_reg, Address(SP, 0 * kWordSize)); |
1593 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); | 1589 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); |
1594 __ Drop(2); // Drop the field and the value. | 1590 __ Drop(2); // Drop the field and the value. |
1595 } | 1591 } |
1596 } else { | 1592 } else { |
1597 ASSERT(compiler->is_optimizing()); | 1593 ASSERT(compiler->is_optimizing()); |
1598 ASSERT(deopt != NULL); | 1594 ASSERT(deopt != NULL); |
1599 ASSERT(ok_is_fall_through); | |
1600 // Field guard class has been initialized and is known. | 1595 // Field guard class has been initialized and is known. |
1601 if (field_reg != kNoRegister) { | 1596 if (field_reg != kNoRegister) { |
1602 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1597 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); |
1603 } | 1598 } |
1604 if (value_cid == kDynamicCid) { | 1599 if (value_cid == kDynamicCid) { |
1605 // Field's guarded class id is fixed by value's class id is not known. | 1600 // Field's guarded class id is fixed by value's class id is not known. |
1606 __ andi(CMPRES1, value_reg, Immediate(kSmiTagMask)); | 1601 __ andi(CMPRES1, value_reg, Immediate(kSmiTagMask)); |
1607 | 1602 |
1608 if (field_cid != kSmiCid) { | 1603 if (field_cid != kSmiCid) { |
1609 __ beq(CMPRES1, ZR, fail); | 1604 __ beq(CMPRES1, ZR, fail); |
(...skipping 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4207 compiler->GenerateCall(token_pos(), | 4202 compiler->GenerateCall(token_pos(), |
4208 &label, | 4203 &label, |
4209 PcDescriptors::kOther, | 4204 PcDescriptors::kOther, |
4210 locs()); | 4205 locs()); |
4211 __ Drop(2); // Discard type arguments and receiver. | 4206 __ Drop(2); // Discard type arguments and receiver. |
4212 } | 4207 } |
4213 | 4208 |
4214 } // namespace dart | 4209 } // namespace dart |
4215 | 4210 |
4216 #endif // defined TARGET_ARCH_MIPS | 4211 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |