| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 } else { | 1487 } else { |
| 1488 __ movl(field_length_operand, | 1488 __ movl(field_length_operand, |
| 1489 Immediate(Smi::RawValue(Field::kNoFixedLength))); | 1489 Immediate(Smi::RawValue(Field::kNoFixedLength))); |
| 1490 } | 1490 } |
| 1491 } | 1491 } |
| 1492 } | 1492 } |
| 1493 | 1493 |
| 1494 if (!ok_is_fall_through) { | 1494 if (!ok_is_fall_through) { |
| 1495 __ jmp(&ok); | 1495 __ jmp(&ok); |
| 1496 } | 1496 } |
| 1497 |
| 1498 if (deopt == NULL) { |
| 1499 ASSERT(!compiler->is_optimizing()); |
| 1500 __ Bind(fail); |
| 1501 |
| 1502 __ cmpl(FieldAddress(field_reg, Field::guarded_cid_offset()), |
| 1503 Immediate(kDynamicCid)); |
| 1504 __ j(EQUAL, &ok); |
| 1505 |
| 1506 __ pushl(field_reg); |
| 1507 __ pushl(value_reg); |
| 1508 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); |
| 1509 __ Drop(2); // Drop the field and the value. |
| 1510 } |
| 1497 } else { | 1511 } else { |
| 1512 ASSERT(compiler->is_optimizing()); |
| 1513 ASSERT(deopt != NULL); |
| 1514 ASSERT(ok_is_fall_through); |
| 1498 // Field guard class has been initialized and is known. | 1515 // Field guard class has been initialized and is known. |
| 1499 if (field_reg != kNoRegister) { | 1516 if (field_reg != kNoRegister) { |
| 1500 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); | 1517 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); |
| 1501 } | 1518 } |
| 1502 | 1519 |
| 1503 if (value_cid == kDynamicCid) { | 1520 if (value_cid == kDynamicCid) { |
| 1504 // Value's class id is not known. | 1521 // Value's class id is not known. |
| 1505 __ testl(value_reg, Immediate(kSmiTagMask)); | 1522 __ testl(value_reg, Immediate(kSmiTagMask)); |
| 1506 | 1523 |
| 1507 if (field_cid != kSmiCid) { | 1524 if (field_cid != kSmiCid) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1530 } | 1547 } |
| 1531 __ cmpl(value_cid_reg, field_length_operand); | 1548 __ cmpl(value_cid_reg, field_length_operand); |
| 1532 } | 1549 } |
| 1533 | 1550 |
| 1534 if (field().is_nullable() && (field_cid != kNullCid)) { | 1551 if (field().is_nullable() && (field_cid != kNullCid)) { |
| 1535 __ j(EQUAL, &ok); | 1552 __ j(EQUAL, &ok); |
| 1536 const Immediate& raw_null = | 1553 const Immediate& raw_null = |
| 1537 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1554 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1538 __ cmpl(value_reg, raw_null); | 1555 __ cmpl(value_reg, raw_null); |
| 1539 } | 1556 } |
| 1540 | 1557 __ j(NOT_EQUAL, fail); |
| 1541 if (ok_is_fall_through) { | |
| 1542 __ j(NOT_EQUAL, fail); | |
| 1543 } else { | |
| 1544 __ j(EQUAL, &ok); | |
| 1545 } | |
| 1546 } else { | 1558 } else { |
| 1547 // Both value's and field's class id is known. | 1559 // Both value's and field's class id is known. |
| 1548 if ((value_cid != field_cid) && (value_cid != nullability)) { | 1560 if ((value_cid != field_cid) && (value_cid != nullability)) { |
| 1549 if (ok_is_fall_through) { | 1561 __ jmp(fail); |
| 1550 __ jmp(fail); | |
| 1551 } | |
| 1552 } else if (field_has_length && (value_cid == field_cid)) { | 1562 } else if (field_has_length && (value_cid == field_cid)) { |
| 1553 ASSERT(value_cid_reg != kNoRegister); | 1563 ASSERT(value_cid_reg != kNoRegister); |
| 1554 if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) { | 1564 if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) { |
| 1555 // Destroy value_cid_reg (safe because we are finished with it). | 1565 // Destroy value_cid_reg (safe because we are finished with it). |
| 1556 __ movl(value_cid_reg, | 1566 __ movl(value_cid_reg, |
| 1557 FieldAddress(value_reg, Array::length_offset())); | 1567 FieldAddress(value_reg, Array::length_offset())); |
| 1558 } else if (RawObject::IsTypedDataClassId(field_cid)) { | 1568 } else if (RawObject::IsTypedDataClassId(field_cid)) { |
| 1559 // Destroy value_cid_reg (safe because we are finished with it). | 1569 // Destroy value_cid_reg (safe because we are finished with it). |
| 1560 __ movl(value_cid_reg, | 1570 __ movl(value_cid_reg, |
| 1561 FieldAddress(value_reg, TypedData::length_offset())); | 1571 FieldAddress(value_reg, TypedData::length_offset())); |
| 1562 } | 1572 } |
| 1563 __ cmpl(value_cid_reg, Immediate(Smi::RawValue(field_length))); | 1573 __ cmpl(value_cid_reg, Immediate(Smi::RawValue(field_length))); |
| 1564 if (ok_is_fall_through) { | 1574 __ j(NOT_EQUAL, fail); |
| 1565 __ j(NOT_EQUAL, fail); | |
| 1566 } | |
| 1567 } else { | 1575 } else { |
| 1568 // Nothing to emit. | 1576 UNREACHABLE(); |
| 1569 ASSERT(!compiler->is_optimizing()); | |
| 1570 return; | |
| 1571 } | 1577 } |
| 1572 } | 1578 } |
| 1573 } | 1579 } |
| 1574 | |
| 1575 if (deopt == NULL) { | |
| 1576 ASSERT(!compiler->is_optimizing()); | |
| 1577 __ Bind(fail); | |
| 1578 | |
| 1579 __ cmpl(FieldAddress(field_reg, Field::guarded_cid_offset()), | |
| 1580 Immediate(kDynamicCid)); | |
| 1581 __ j(EQUAL, &ok); | |
| 1582 | |
| 1583 __ pushl(field_reg); | |
| 1584 __ pushl(value_reg); | |
| 1585 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); | |
| 1586 __ Drop(2); // Drop the field and the value. | |
| 1587 } | |
| 1588 | |
| 1589 __ Bind(&ok); | 1580 __ Bind(&ok); |
| 1590 } | 1581 } |
| 1591 | 1582 |
| 1592 | 1583 |
| 1593 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { | 1584 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { |
| 1594 const intptr_t kNumInputs = 2; | 1585 const intptr_t kNumInputs = 2; |
| 1595 const intptr_t kNumTemps = 0; | 1586 const intptr_t kNumTemps = 0; |
| 1596 LocationSummary* summary = | 1587 LocationSummary* summary = |
| 1597 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1588 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1598 summary->set_in(0, Location::RequiresRegister()); | 1589 summary->set_in(0, Location::RequiresRegister()); |
| (...skipping 3416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5015 PcDescriptors::kOther, | 5006 PcDescriptors::kOther, |
| 5016 locs()); | 5007 locs()); |
| 5017 __ Drop(2); // Discard type arguments and receiver. | 5008 __ Drop(2); // Discard type arguments and receiver. |
| 5018 } | 5009 } |
| 5019 | 5010 |
| 5020 } // namespace dart | 5011 } // namespace dart |
| 5021 | 5012 |
| 5022 #undef __ | 5013 #undef __ |
| 5023 | 5014 |
| 5024 #endif // defined TARGET_ARCH_IA32 | 5015 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |