| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 if (emit_full_guard) { | 1473 if (emit_full_guard) { |
| 1474 __ LoadObject(field_reg, Field::ZoneHandle(field().raw()), PP); | 1474 __ LoadObject(field_reg, Field::ZoneHandle(field().raw()), PP); |
| 1475 | 1475 |
| 1476 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); | 1476 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); |
| 1477 FieldAddress field_nullability_operand( | 1477 FieldAddress field_nullability_operand( |
| 1478 field_reg, Field::is_nullable_offset()); | 1478 field_reg, Field::is_nullable_offset()); |
| 1479 | 1479 |
| 1480 if (value_cid == kDynamicCid) { | 1480 if (value_cid == kDynamicCid) { |
| 1481 LoadValueCid(compiler, value_cid_reg, value_reg); | 1481 LoadValueCid(compiler, value_cid_reg, value_reg); |
| 1482 | 1482 |
| 1483 __ cmpl(value_cid_reg, field_cid_operand); | 1483 __ cmpw(value_cid_reg, field_cid_operand); |
| 1484 __ j(EQUAL, &ok); | 1484 __ j(EQUAL, &ok); |
| 1485 __ cmpl(value_cid_reg, field_nullability_operand); | 1485 __ cmpw(value_cid_reg, field_nullability_operand); |
| 1486 } else if (value_cid == kNullCid) { | 1486 } else if (value_cid == kNullCid) { |
| 1487 __ cmpl(field_nullability_operand, Immediate(value_cid)); | 1487 __ cmpw(field_nullability_operand, Immediate(value_cid)); |
| 1488 } else { | 1488 } else { |
| 1489 __ cmpl(field_cid_operand, Immediate(value_cid)); | 1489 __ cmpw(field_cid_operand, Immediate(value_cid)); |
| 1490 } | 1490 } |
| 1491 __ j(EQUAL, &ok); | 1491 __ j(EQUAL, &ok); |
| 1492 | 1492 |
| 1493 // Check if the tracked state of the guarded field can be initialized | 1493 // Check if the tracked state of the guarded field can be initialized |
| 1494 // inline. If the field needs length check we fall through to runtime | 1494 // inline. If the field needs length check we fall through to runtime |
| 1495 // which is responsible for computing offset of the length field | 1495 // which is responsible for computing offset of the length field |
| 1496 // based on the class id. | 1496 // based on the class id. |
| 1497 if (!field().needs_length_check()) { | 1497 if (!field().needs_length_check()) { |
| 1498 // Uninitialized field can be handled inline. Check if the | 1498 // Uninitialized field can be handled inline. Check if the |
| 1499 // field is still unitialized. | 1499 // field is still unitialized. |
| 1500 __ cmpl(field_cid_operand, Immediate(kIllegalCid)); | 1500 __ cmpw(field_cid_operand, Immediate(kIllegalCid)); |
| 1501 __ j(NOT_EQUAL, fail); | 1501 __ j(NOT_EQUAL, fail); |
| 1502 | 1502 |
| 1503 if (value_cid == kDynamicCid) { | 1503 if (value_cid == kDynamicCid) { |
| 1504 __ movl(field_cid_operand, value_cid_reg); | 1504 __ movw(field_cid_operand, value_cid_reg); |
| 1505 __ movl(field_nullability_operand, value_cid_reg); | 1505 __ movw(field_nullability_operand, value_cid_reg); |
| 1506 } else { | 1506 } else { |
| 1507 ASSERT(field_reg != kNoRegister); | 1507 ASSERT(field_reg != kNoRegister); |
| 1508 __ movl(field_cid_operand, Immediate(value_cid)); | 1508 __ movw(field_cid_operand, Immediate(value_cid)); |
| 1509 __ movl(field_nullability_operand, Immediate(value_cid)); | 1509 __ movw(field_nullability_operand, Immediate(value_cid)); |
| 1510 } | 1510 } |
| 1511 | 1511 |
| 1512 if (deopt == NULL) { | 1512 if (deopt == NULL) { |
| 1513 ASSERT(!compiler->is_optimizing()); | 1513 ASSERT(!compiler->is_optimizing()); |
| 1514 __ jmp(&ok); | 1514 __ jmp(&ok); |
| 1515 } | 1515 } |
| 1516 } | 1516 } |
| 1517 | 1517 |
| 1518 if (deopt == NULL) { | 1518 if (deopt == NULL) { |
| 1519 ASSERT(!compiler->is_optimizing()); | 1519 ASSERT(!compiler->is_optimizing()); |
| 1520 __ Bind(fail); | 1520 __ Bind(fail); |
| 1521 | 1521 |
| 1522 __ cmpl(FieldAddress(field_reg, Field::guarded_cid_offset()), | 1522 __ cmpw(FieldAddress(field_reg, Field::guarded_cid_offset()), |
| 1523 Immediate(kDynamicCid)); | 1523 Immediate(kDynamicCid)); |
| 1524 __ j(EQUAL, &ok); | 1524 __ j(EQUAL, &ok); |
| 1525 | 1525 |
| 1526 __ pushq(field_reg); | 1526 __ pushq(field_reg); |
| 1527 __ pushq(value_reg); | 1527 __ pushq(value_reg); |
| 1528 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); | 1528 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); |
| 1529 __ Drop(2); // Drop the field and the value. | 1529 __ Drop(2); // Drop the field and the value. |
| 1530 } | 1530 } |
| 1531 } else { | 1531 } else { |
| 1532 ASSERT(compiler->is_optimizing()); | 1532 ASSERT(compiler->is_optimizing()); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 locs()->live_registers()->Add(locs()->in(1), kTagged); | 1835 locs()->live_registers()->Add(locs()->in(1), kTagged); |
| 1836 } | 1836 } |
| 1837 | 1837 |
| 1838 Label store_pointer; | 1838 Label store_pointer; |
| 1839 Label store_double; | 1839 Label store_double; |
| 1840 Label store_float32x4; | 1840 Label store_float32x4; |
| 1841 Label store_float64x2; | 1841 Label store_float64x2; |
| 1842 | 1842 |
| 1843 __ LoadObject(temp, Field::ZoneHandle(field().raw()), PP); | 1843 __ LoadObject(temp, Field::ZoneHandle(field().raw()), PP); |
| 1844 | 1844 |
| 1845 __ cmpl(FieldAddress(temp, Field::is_nullable_offset()), | 1845 __ cmpw(FieldAddress(temp, Field::is_nullable_offset()), |
| 1846 Immediate(kNullCid)); | 1846 Immediate(kNullCid)); |
| 1847 __ j(EQUAL, &store_pointer); | 1847 __ j(EQUAL, &store_pointer); |
| 1848 | 1848 |
| 1849 __ movzxb(temp2, FieldAddress(temp, Field::kind_bits_offset())); | 1849 __ movzxb(temp2, FieldAddress(temp, Field::kind_bits_offset())); |
| 1850 __ testq(temp2, Immediate(1 << Field::kUnboxingCandidateBit)); | 1850 __ testq(temp2, Immediate(1 << Field::kUnboxingCandidateBit)); |
| 1851 __ j(ZERO, &store_pointer); | 1851 __ j(ZERO, &store_pointer); |
| 1852 | 1852 |
| 1853 __ cmpl(FieldAddress(temp, Field::guarded_cid_offset()), | 1853 __ cmpw(FieldAddress(temp, Field::guarded_cid_offset()), |
| 1854 Immediate(kDoubleCid)); | 1854 Immediate(kDoubleCid)); |
| 1855 __ j(EQUAL, &store_double); | 1855 __ j(EQUAL, &store_double); |
| 1856 | 1856 |
| 1857 __ cmpl(FieldAddress(temp, Field::guarded_cid_offset()), | 1857 __ cmpw(FieldAddress(temp, Field::guarded_cid_offset()), |
| 1858 Immediate(kFloat32x4Cid)); | 1858 Immediate(kFloat32x4Cid)); |
| 1859 __ j(EQUAL, &store_float32x4); | 1859 __ j(EQUAL, &store_float32x4); |
| 1860 | 1860 |
| 1861 __ cmpl(FieldAddress(temp, Field::guarded_cid_offset()), | 1861 __ cmpw(FieldAddress(temp, Field::guarded_cid_offset()), |
| 1862 Immediate(kFloat64x2Cid)); | 1862 Immediate(kFloat64x2Cid)); |
| 1863 __ j(EQUAL, &store_float64x2); | 1863 __ j(EQUAL, &store_float64x2); |
| 1864 | 1864 |
| 1865 // Fall through. | 1865 // Fall through. |
| 1866 __ jmp(&store_pointer); | 1866 __ jmp(&store_pointer); |
| 1867 | 1867 |
| 1868 if (!compiler->is_optimizing()) { | 1868 if (!compiler->is_optimizing()) { |
| 1869 locs()->live_registers()->Add(locs()->in(0)); | 1869 locs()->live_registers()->Add(locs()->in(0)); |
| 1870 locs()->live_registers()->Add(locs()->in(1)); | 1870 locs()->live_registers()->Add(locs()->in(1)); |
| 1871 } | 1871 } |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 Register temp = locs()->temp(1).reg(); | 2195 Register temp = locs()->temp(1).reg(); |
| 2196 XmmRegister value = locs()->temp(0).fpu_reg(); | 2196 XmmRegister value = locs()->temp(0).fpu_reg(); |
| 2197 | 2197 |
| 2198 Label load_pointer; | 2198 Label load_pointer; |
| 2199 Label load_double; | 2199 Label load_double; |
| 2200 Label load_float32x4; | 2200 Label load_float32x4; |
| 2201 Label load_float64x2; | 2201 Label load_float64x2; |
| 2202 | 2202 |
| 2203 __ LoadObject(result, Field::ZoneHandle(field()->raw()), PP); | 2203 __ LoadObject(result, Field::ZoneHandle(field()->raw()), PP); |
| 2204 | 2204 |
| 2205 __ cmpl(FieldAddress(result, Field::is_nullable_offset()), | 2205 __ cmpw(FieldAddress(result, Field::is_nullable_offset()), |
| 2206 Immediate(kNullCid)); | 2206 Immediate(kNullCid)); |
| 2207 __ j(EQUAL, &load_pointer); | 2207 __ j(EQUAL, &load_pointer); |
| 2208 | 2208 |
| 2209 __ cmpl(FieldAddress(result, Field::guarded_cid_offset()), | 2209 __ cmpw(FieldAddress(result, Field::guarded_cid_offset()), |
| 2210 Immediate(kDoubleCid)); | 2210 Immediate(kDoubleCid)); |
| 2211 __ j(EQUAL, &load_double); | 2211 __ j(EQUAL, &load_double); |
| 2212 | 2212 |
| 2213 __ cmpl(FieldAddress(result, Field::guarded_cid_offset()), | 2213 __ cmpw(FieldAddress(result, Field::guarded_cid_offset()), |
| 2214 Immediate(kFloat32x4Cid)); | 2214 Immediate(kFloat32x4Cid)); |
| 2215 __ j(EQUAL, &load_float32x4); | 2215 __ j(EQUAL, &load_float32x4); |
| 2216 | 2216 |
| 2217 __ cmpl(FieldAddress(result, Field::guarded_cid_offset()), | 2217 __ cmpw(FieldAddress(result, Field::guarded_cid_offset()), |
| 2218 Immediate(kFloat64x2Cid)); | 2218 Immediate(kFloat64x2Cid)); |
| 2219 __ j(EQUAL, &load_float64x2); | 2219 __ j(EQUAL, &load_float64x2); |
| 2220 | 2220 |
| 2221 // Fall through. | 2221 // Fall through. |
| 2222 __ jmp(&load_pointer); | 2222 __ jmp(&load_pointer); |
| 2223 | 2223 |
| 2224 if (!compiler->is_optimizing()) { | 2224 if (!compiler->is_optimizing()) { |
| 2225 locs()->live_registers()->Add(locs()->in(0)); | 2225 locs()->live_registers()->Add(locs()->in(0)); |
| 2226 } | 2226 } |
| 2227 | 2227 |
| (...skipping 4230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6458 __ Drop(1); | 6458 __ Drop(1); |
| 6459 __ popq(result); | 6459 __ popq(result); |
| 6460 } | 6460 } |
| 6461 | 6461 |
| 6462 | 6462 |
| 6463 } // namespace dart | 6463 } // namespace dart |
| 6464 | 6464 |
| 6465 #undef __ | 6465 #undef __ |
| 6466 | 6466 |
| 6467 #endif // defined TARGET_ARCH_X64 | 6467 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |