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