| 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/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 __ str(value_cid_reg, field_length_operand); | 1481 __ str(value_cid_reg, field_length_operand); |
| 1482 } else { | 1482 } else { |
| 1483 __ LoadImmediate(IP, Smi::RawValue(Field::kNoFixedLength)); | 1483 __ LoadImmediate(IP, Smi::RawValue(Field::kNoFixedLength)); |
| 1484 __ str(IP, field_length_operand); | 1484 __ str(IP, field_length_operand); |
| 1485 } | 1485 } |
| 1486 } | 1486 } |
| 1487 } | 1487 } |
| 1488 if (!ok_is_fall_through) { | 1488 if (!ok_is_fall_through) { |
| 1489 __ b(&ok); | 1489 __ b(&ok); |
| 1490 } | 1490 } |
| 1491 |
| 1492 if (deopt == NULL) { |
| 1493 ASSERT(!compiler->is_optimizing()); |
| 1494 __ Bind(fail); |
| 1495 |
| 1496 __ ldr(IP, FieldAddress(field_reg, Field::guarded_cid_offset())); |
| 1497 __ CompareImmediate(IP, kDynamicCid); |
| 1498 __ b(&ok, EQ); |
| 1499 |
| 1500 __ Push(field_reg); |
| 1501 __ Push(value_reg); |
| 1502 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); |
| 1503 __ Drop(2); // Drop the field and the value. |
| 1504 } |
| 1491 } else { | 1505 } else { |
| 1506 ASSERT(compiler->is_optimizing()); |
| 1507 ASSERT(deopt != NULL); |
| 1508 ASSERT(ok_is_fall_through); |
| 1509 // Field guard class has been initialized and is known. |
| 1492 if (field_reg != kNoRegister) { | 1510 if (field_reg != kNoRegister) { |
| 1493 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1511 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); |
| 1494 } | 1512 } |
| 1495 if (value_cid == kDynamicCid) { | 1513 if (value_cid == kDynamicCid) { |
| 1496 // Field's guarded class id is fixed by value's class id is not known. | 1514 // Field's guarded class id is fixed by value's class id is not known. |
| 1497 __ tst(value_reg, ShifterOperand(kSmiTagMask)); | 1515 __ tst(value_reg, ShifterOperand(kSmiTagMask)); |
| 1498 | 1516 |
| 1499 if (field_cid != kSmiCid) { | 1517 if (field_cid != kSmiCid) { |
| 1500 __ b(fail, EQ); | 1518 __ b(fail, EQ); |
| 1501 __ LoadClassId(value_cid_reg, value_reg); | 1519 __ LoadClassId(value_cid_reg, value_reg); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1520 } | 1538 } |
| 1521 __ ldr(IP, field_length_operand); | 1539 __ ldr(IP, field_length_operand); |
| 1522 __ cmp(value_cid_reg, ShifterOperand(IP)); | 1540 __ cmp(value_cid_reg, ShifterOperand(IP)); |
| 1523 } | 1541 } |
| 1524 | 1542 |
| 1525 if (field().is_nullable() && (field_cid != kNullCid)) { | 1543 if (field().is_nullable() && (field_cid != kNullCid)) { |
| 1526 __ b(&ok, EQ); | 1544 __ b(&ok, EQ); |
| 1527 __ CompareImmediate(value_reg, | 1545 __ CompareImmediate(value_reg, |
| 1528 reinterpret_cast<intptr_t>(Object::null())); | 1546 reinterpret_cast<intptr_t>(Object::null())); |
| 1529 } | 1547 } |
| 1530 | 1548 __ b(fail, NE); |
| 1531 if (ok_is_fall_through) { | |
| 1532 __ b(fail, NE); | |
| 1533 } else { | |
| 1534 __ b(&ok, EQ); | |
| 1535 } | |
| 1536 } else { | 1549 } else { |
| 1537 // Both value's and field's class id is known. | 1550 // Both value's and field's class id is known. |
| 1538 if ((value_cid != field_cid) && (value_cid != nullability)) { | 1551 if ((value_cid != field_cid) && (value_cid != nullability)) { |
| 1539 if (ok_is_fall_through) { | 1552 __ b(fail); |
| 1540 __ b(fail); | |
| 1541 } | |
| 1542 } else if (field_has_length && (value_cid == field_cid)) { | 1553 } else if (field_has_length && (value_cid == field_cid)) { |
| 1543 ASSERT(value_cid_reg != kNoRegister); | 1554 ASSERT(value_cid_reg != kNoRegister); |
| 1544 if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) { | 1555 if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) { |
| 1545 // Destroy value_cid_reg (safe because we are finished with it). | 1556 // Destroy value_cid_reg (safe because we are finished with it). |
| 1546 __ ldr(value_cid_reg, | 1557 __ ldr(value_cid_reg, |
| 1547 FieldAddress(value_reg, Array::length_offset())); | 1558 FieldAddress(value_reg, Array::length_offset())); |
| 1548 } else if (RawObject::IsTypedDataClassId(field_cid)) { | 1559 } else if (RawObject::IsTypedDataClassId(field_cid)) { |
| 1549 // Destroy value_cid_reg (safe because we are finished with it). | 1560 // Destroy value_cid_reg (safe because we are finished with it). |
| 1550 __ ldr(value_cid_reg, | 1561 __ ldr(value_cid_reg, |
| 1551 FieldAddress(value_reg, TypedData::length_offset())); | 1562 FieldAddress(value_reg, TypedData::length_offset())); |
| 1552 } | 1563 } |
| 1553 __ CompareImmediate(value_cid_reg, field_length); | 1564 __ CompareImmediate(value_cid_reg, field_length); |
| 1554 if (ok_is_fall_through) { | 1565 __ b(fail, NE); |
| 1555 __ b(fail, NE); | |
| 1556 } | |
| 1557 } else { | 1566 } else { |
| 1558 // Nothing to emit. | 1567 UNREACHABLE(); |
| 1559 ASSERT(!compiler->is_optimizing()); | |
| 1560 return; | |
| 1561 } | 1568 } |
| 1562 } | 1569 } |
| 1563 } | 1570 } |
| 1564 | |
| 1565 if (deopt == NULL) { | |
| 1566 ASSERT(!compiler->is_optimizing()); | |
| 1567 __ Bind(fail); | |
| 1568 | |
| 1569 __ ldr(IP, FieldAddress(field_reg, Field::guarded_cid_offset())); | |
| 1570 __ CompareImmediate(IP, kDynamicCid); | |
| 1571 __ b(&ok, EQ); | |
| 1572 | |
| 1573 __ Push(field_reg); | |
| 1574 __ Push(value_reg); | |
| 1575 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); | |
| 1576 __ Drop(2); // Drop the field and the value. | |
| 1577 } | |
| 1578 | |
| 1579 __ Bind(&ok); | 1571 __ Bind(&ok); |
| 1580 } | 1572 } |
| 1581 | 1573 |
| 1582 | 1574 |
| 1583 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { | 1575 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { |
| 1584 const intptr_t kNumInputs = 2; | 1576 const intptr_t kNumInputs = 2; |
| 1585 const intptr_t kNumTemps = 0; | 1577 const intptr_t kNumTemps = 0; |
| 1586 LocationSummary* summary = | 1578 LocationSummary* summary = |
| 1587 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1579 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1588 summary->set_in(0, Location::RequiresRegister()); | 1580 summary->set_in(0, Location::RequiresRegister()); |
| (...skipping 3041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4630 compiler->GenerateCall(token_pos(), | 4622 compiler->GenerateCall(token_pos(), |
| 4631 &label, | 4623 &label, |
| 4632 PcDescriptors::kOther, | 4624 PcDescriptors::kOther, |
| 4633 locs()); | 4625 locs()); |
| 4634 __ Drop(2); // Discard type arguments and receiver. | 4626 __ Drop(2); // Discard type arguments and receiver. |
| 4635 } | 4627 } |
| 4636 | 4628 |
| 4637 } // namespace dart | 4629 } // namespace dart |
| 4638 | 4630 |
| 4639 #endif // defined TARGET_ARCH_ARM | 4631 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |