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 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 Register field_reg = needs_field_temp_reg ? | 1366 Register field_reg = needs_field_temp_reg ? |
1367 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; | 1367 locs()->temp(locs()->temp_count() - 1).reg() : kNoRegister; |
1368 | 1368 |
1369 Label ok, fail_label; | 1369 Label ok, fail_label; |
1370 | 1370 |
1371 Label* deopt = compiler->is_optimizing() ? | 1371 Label* deopt = compiler->is_optimizing() ? |
1372 compiler->AddDeoptStub(deopt_id(), kDeoptGuardField) : NULL; | 1372 compiler->AddDeoptStub(deopt_id(), kDeoptGuardField) : NULL; |
1373 | 1373 |
1374 Label* fail = (deopt != NULL) ? deopt : &fail_label; | 1374 Label* fail = (deopt != NULL) ? deopt : &fail_label; |
1375 | 1375 |
| 1376 const bool ok_is_fall_through = (deopt != NULL); |
| 1377 |
1376 if (!compiler->is_optimizing() || (field_cid == kIllegalCid)) { | 1378 if (!compiler->is_optimizing() || (field_cid == kIllegalCid)) { |
1377 if (!compiler->is_optimizing() && (field_reg == kNoRegister)) { | 1379 if (!compiler->is_optimizing() && (field_reg == kNoRegister)) { |
1378 // Currently we can't have different location summaries for optimized | 1380 // Currently we can't have different location summaries for optimized |
1379 // and non-optimized code. So instead we manually pick up a register | 1381 // and non-optimized code. So instead we manually pick up a register |
1380 // that is known to be free because we know how non-optimizing compiler | 1382 // that is known to be free because we know how non-optimizing compiler |
1381 // allocates registers. | 1383 // allocates registers. |
1382 field_reg = A0; | 1384 field_reg = A0; |
1383 ASSERT((field_reg != value_reg) && (field_reg != value_cid_reg)); | 1385 ASSERT((field_reg != value_reg) && (field_reg != value_cid_reg)); |
1384 } | 1386 } |
1385 | 1387 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 __ lw(value_cid_reg, | 1549 __ lw(value_cid_reg, |
1548 FieldAddress(value_reg, TypedData::length_offset())); | 1550 FieldAddress(value_reg, TypedData::length_offset())); |
1549 __ sw(value_cid_reg, field_length_operand); | 1551 __ sw(value_cid_reg, field_length_operand); |
1550 } else { | 1552 } else { |
1551 // Destroy value_cid_reg (safe because we are finished with it). | 1553 // Destroy value_cid_reg (safe because we are finished with it). |
1552 __ LoadImmediate(value_cid_reg, Smi::RawValue(Field::kNoFixedLength)); | 1554 __ LoadImmediate(value_cid_reg, Smi::RawValue(Field::kNoFixedLength)); |
1553 __ sw(value_cid_reg, field_length_operand); | 1555 __ sw(value_cid_reg, field_length_operand); |
1554 } | 1556 } |
1555 } | 1557 } |
1556 } | 1558 } |
| 1559 if (!ok_is_fall_through) { |
| 1560 __ b(&ok); |
| 1561 } |
1557 | 1562 |
1558 if (deopt == NULL) { | 1563 if (deopt == NULL) { |
1559 ASSERT(!compiler->is_optimizing()); | 1564 ASSERT(!compiler->is_optimizing()); |
1560 __ b(&ok); | |
1561 __ Bind(fail); | 1565 __ Bind(fail); |
1562 | 1566 |
1563 __ lw(CMPRES1, FieldAddress(field_reg, Field::guarded_cid_offset())); | 1567 __ lw(CMPRES1, FieldAddress(field_reg, Field::guarded_cid_offset())); |
1564 __ BranchEqual(CMPRES1, kDynamicCid, &ok); | 1568 __ BranchEqual(CMPRES1, kDynamicCid, &ok); |
1565 | 1569 |
1566 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 1570 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
1567 __ sw(field_reg, Address(SP, 1 * kWordSize)); | 1571 __ sw(field_reg, Address(SP, 1 * kWordSize)); |
1568 __ sw(value_reg, Address(SP, 0 * kWordSize)); | 1572 __ sw(value_reg, Address(SP, 0 * kWordSize)); |
1569 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); | 1573 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); |
1570 __ Drop(2); // Drop the field and the value. | 1574 __ Drop(2); // Drop the field and the value. |
1571 } | 1575 } |
1572 } else { | 1576 } else { |
1573 ASSERT(compiler->is_optimizing()); | 1577 ASSERT(compiler->is_optimizing()); |
1574 ASSERT(deopt != NULL); | 1578 ASSERT(deopt != NULL); |
| 1579 ASSERT(ok_is_fall_through); |
1575 // Field guard class has been initialized and is known. | 1580 // Field guard class has been initialized and is known. |
1576 if (field_reg != kNoRegister) { | 1581 if (field_reg != kNoRegister) { |
1577 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1582 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); |
1578 } | 1583 } |
1579 if (value_cid == kDynamicCid) { | 1584 if (value_cid == kDynamicCid) { |
1580 // Field's guarded class id is fixed by value's class id is not known. | 1585 // Field's guarded class id is fixed by value's class id is not known. |
1581 __ andi(CMPRES1, value_reg, Immediate(kSmiTagMask)); | 1586 __ andi(CMPRES1, value_reg, Immediate(kSmiTagMask)); |
1582 | 1587 |
1583 if (field_cid != kSmiCid) { | 1588 if (field_cid != kSmiCid) { |
1584 __ beq(CMPRES1, ZR, fail); | 1589 __ beq(CMPRES1, ZR, fail); |
(...skipping 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4182 compiler->GenerateCall(token_pos(), | 4187 compiler->GenerateCall(token_pos(), |
4183 &label, | 4188 &label, |
4184 PcDescriptors::kOther, | 4189 PcDescriptors::kOther, |
4185 locs()); | 4190 locs()); |
4186 __ Drop(2); // Discard type arguments and receiver. | 4191 __ Drop(2); // Discard type arguments and receiver. |
4187 } | 4192 } |
4188 | 4193 |
4189 } // namespace dart | 4194 } // namespace dart |
4190 | 4195 |
4191 #endif // defined TARGET_ARCH_MIPS | 4196 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |