Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: runtime/vm/intermediate_language_arm64.cc

Issue 1176703002: Make guard_cid and nullable_cid half words. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1463
1464 Label* deopt = compiler->is_optimizing() ? 1464 Label* deopt = compiler->is_optimizing() ?
1465 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL; 1465 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField) : NULL;
1466 1466
1467 Label* fail = (deopt != NULL) ? deopt : &fail_label; 1467 Label* fail = (deopt != NULL) ? deopt : &fail_label;
1468 1468
1469 if (emit_full_guard) { 1469 if (emit_full_guard) {
1470 __ LoadObject(field_reg, Field::ZoneHandle(field().raw()), PP); 1470 __ LoadObject(field_reg, Field::ZoneHandle(field().raw()), PP);
1471 1471
1472 FieldAddress field_cid_operand( 1472 FieldAddress field_cid_operand(
1473 field_reg, Field::guarded_cid_offset(), kWord); 1473 field_reg, Field::guarded_cid_offset(), kUnsignedHalfword);
1474 FieldAddress field_nullability_operand( 1474 FieldAddress field_nullability_operand(
1475 field_reg, Field::is_nullable_offset(), kWord); 1475 field_reg, Field::is_nullable_offset(), kUnsignedHalfword);
1476 1476
1477 if (value_cid == kDynamicCid) { 1477 if (value_cid == kDynamicCid) {
1478 LoadValueCid(compiler, value_cid_reg, value_reg); 1478 LoadValueCid(compiler, value_cid_reg, value_reg);
1479 Label skip_length_check; 1479 Label skip_length_check;
1480 __ ldr(TMP, field_cid_operand, kWord); 1480 __ ldr(TMP, field_cid_operand, kUnsignedHalfword);
1481 __ CompareRegisters(value_cid_reg, TMP); 1481 __ CompareRegisters(value_cid_reg, TMP);
1482 __ b(&ok, EQ); 1482 __ b(&ok, EQ);
1483 __ ldr(TMP, field_nullability_operand, kWord); 1483 __ ldr(TMP, field_nullability_operand, kUnsignedHalfword);
1484 __ CompareRegisters(value_cid_reg, TMP); 1484 __ CompareRegisters(value_cid_reg, TMP);
1485 } else if (value_cid == kNullCid) { 1485 } else if (value_cid == kNullCid) {
1486 __ ldr(value_cid_reg, field_nullability_operand, kWord); 1486 __ ldr(value_cid_reg, field_nullability_operand, kUnsignedHalfword);
1487 __ CompareImmediate(value_cid_reg, value_cid, PP); 1487 __ CompareImmediate(value_cid_reg, value_cid, PP);
1488 } else { 1488 } else {
1489 Label skip_length_check; 1489 Label skip_length_check;
1490 __ ldr(value_cid_reg, field_cid_operand, kWord); 1490 __ ldr(value_cid_reg, field_cid_operand, kUnsignedHalfword);
1491 __ CompareImmediate(value_cid_reg, value_cid, PP); 1491 __ CompareImmediate(value_cid_reg, value_cid, PP);
1492 } 1492 }
1493 __ b(&ok, EQ); 1493 __ b(&ok, EQ);
1494 1494
1495 // Check if the tracked state of the guarded field can be initialized 1495 // Check if the tracked state of the guarded field can be initialized
1496 // inline. If the field needs length check we fall through to runtime 1496 // inline. If the field needs length check we fall through to runtime
1497 // which is responsible for computing offset of the length field 1497 // which is responsible for computing offset of the length field
1498 // based on the class id. 1498 // based on the class id.
1499 // Length guard will be emitted separately when needed via GuardFieldLength 1499 // Length guard will be emitted separately when needed via GuardFieldLength
1500 // instruction after GuardFieldClass. 1500 // instruction after GuardFieldClass.
1501 if (!field().needs_length_check()) { 1501 if (!field().needs_length_check()) {
1502 // Uninitialized field can be handled inline. Check if the 1502 // Uninitialized field can be handled inline. Check if the
1503 // field is still unitialized. 1503 // field is still unitialized.
1504 __ ldr(TMP, field_cid_operand, kWord); 1504 __ ldr(TMP, field_cid_operand, kUnsignedHalfword);
1505 __ CompareImmediate(TMP, kIllegalCid, PP); 1505 __ CompareImmediate(TMP, kIllegalCid, PP);
1506 __ b(fail, NE); 1506 __ b(fail, NE);
1507 1507
1508 if (value_cid == kDynamicCid) { 1508 if (value_cid == kDynamicCid) {
1509 __ str(value_cid_reg, field_cid_operand, kWord); 1509 __ str(value_cid_reg, field_cid_operand, kUnsignedHalfword);
1510 __ str(value_cid_reg, field_nullability_operand, kWord); 1510 __ str(value_cid_reg, field_nullability_operand, kUnsignedHalfword);
1511 } else { 1511 } else {
1512 __ LoadImmediate(TMP, value_cid, PP); 1512 __ LoadImmediate(TMP, value_cid, PP);
1513 __ str(TMP, field_cid_operand, kWord); 1513 __ str(TMP, field_cid_operand, kUnsignedHalfword);
1514 __ str(TMP, field_nullability_operand, kWord); 1514 __ str(TMP, field_nullability_operand, kUnsignedHalfword);
1515 } 1515 }
1516 1516
1517 if (deopt == NULL) { 1517 if (deopt == NULL) {
1518 ASSERT(!compiler->is_optimizing()); 1518 ASSERT(!compiler->is_optimizing());
1519 __ b(&ok); 1519 __ b(&ok);
1520 } 1520 }
1521 } 1521 }
1522 1522
1523 if (deopt == NULL) { 1523 if (deopt == NULL) {
1524 ASSERT(!compiler->is_optimizing()); 1524 ASSERT(!compiler->is_optimizing());
1525 __ Bind(fail); 1525 __ Bind(fail);
1526 1526
1527 __ LoadFieldFromOffset( 1527 __ LoadFieldFromOffset(
1528 TMP, field_reg, Field::guarded_cid_offset(), PP, kWord); 1528 TMP, field_reg, Field::guarded_cid_offset(), PP, kUnsignedHalfword);
1529 __ CompareImmediate(TMP, kDynamicCid, PP); 1529 __ CompareImmediate(TMP, kDynamicCid, PP);
1530 __ b(&ok, EQ); 1530 __ b(&ok, EQ);
1531 1531
1532 __ Push(field_reg); 1532 __ Push(field_reg);
1533 __ Push(value_reg); 1533 __ Push(value_reg);
1534 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); 1534 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2);
1535 __ Drop(2); // Drop the field and the value. 1535 __ Drop(2); // Drop the field and the value.
1536 } 1536 }
1537 } else { 1537 } else {
1538 ASSERT(compiler->is_optimizing()); 1538 ASSERT(compiler->is_optimizing());
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 locs()->live_registers()->Add(locs()->in(1), kTagged); 1837 locs()->live_registers()->Add(locs()->in(1), kTagged);
1838 } 1838 }
1839 1839
1840 Label store_pointer; 1840 Label store_pointer;
1841 Label store_double; 1841 Label store_double;
1842 Label store_float32x4; 1842 Label store_float32x4;
1843 Label store_float64x2; 1843 Label store_float64x2;
1844 1844
1845 __ LoadObject(temp, Field::ZoneHandle(field().raw()), PP); 1845 __ LoadObject(temp, Field::ZoneHandle(field().raw()), PP);
1846 1846
1847 __ LoadFieldFromOffset(temp2, temp, Field::is_nullable_offset(), PP, kWord); 1847 __ LoadFieldFromOffset(temp2, temp, Field::is_nullable_offset(), PP,
1848 kUnsignedHalfword);
1848 __ CompareImmediate(temp2, kNullCid, PP); 1849 __ CompareImmediate(temp2, kNullCid, PP);
1849 __ b(&store_pointer, EQ); 1850 __ b(&store_pointer, EQ);
1850 1851
1851 __ LoadFromOffset( 1852 __ LoadFromOffset(
1852 temp2, temp, Field::kind_bits_offset() - kHeapObjectTag, 1853 temp2, temp, Field::kind_bits_offset() - kHeapObjectTag,
1853 PP, kUnsignedByte); 1854 PP, kUnsignedByte);
1854 __ tsti(temp2, Immediate(1 << Field::kUnboxingCandidateBit)); 1855 __ tsti(temp2, Immediate(1 << Field::kUnboxingCandidateBit));
1855 __ b(&store_pointer, EQ); 1856 __ b(&store_pointer, EQ);
1856 1857
1857 __ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP, kWord); 1858 __ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP,
1859 kUnsignedHalfword);
1858 __ CompareImmediate(temp2, kDoubleCid, PP); 1860 __ CompareImmediate(temp2, kDoubleCid, PP);
1859 __ b(&store_double, EQ); 1861 __ b(&store_double, EQ);
1860 1862
1861 __ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP, kWord); 1863 __ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP,
1864 kUnsignedHalfword);
1862 __ CompareImmediate(temp2, kFloat32x4Cid, PP); 1865 __ CompareImmediate(temp2, kFloat32x4Cid, PP);
1863 __ b(&store_float32x4, EQ); 1866 __ b(&store_float32x4, EQ);
1864 1867
1865 __ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP, kWord); 1868 __ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP,
1869 kUnsignedHalfword);
1866 __ CompareImmediate(temp2, kFloat64x2Cid, PP); 1870 __ CompareImmediate(temp2, kFloat64x2Cid, PP);
1867 __ b(&store_float64x2, EQ); 1871 __ b(&store_float64x2, EQ);
1868 1872
1869 // Fall through. 1873 // Fall through.
1870 __ b(&store_pointer); 1874 __ b(&store_pointer);
1871 1875
1872 if (!compiler->is_optimizing()) { 1876 if (!compiler->is_optimizing()) {
1873 locs()->live_registers()->Add(locs()->in(0)); 1877 locs()->live_registers()->Add(locs()->in(0));
1874 locs()->live_registers()->Add(locs()->in(1)); 1878 locs()->live_registers()->Add(locs()->in(1));
1875 } 1879 }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 const Register temp = locs()->temp(0).reg(); 2194 const Register temp = locs()->temp(0).reg();
2191 2195
2192 Label load_pointer; 2196 Label load_pointer;
2193 Label load_double; 2197 Label load_double;
2194 Label load_float32x4; 2198 Label load_float32x4;
2195 Label load_float64x2; 2199 Label load_float64x2;
2196 2200
2197 __ LoadObject(result_reg, Field::ZoneHandle(field()->raw()), PP); 2201 __ LoadObject(result_reg, Field::ZoneHandle(field()->raw()), PP);
2198 2202
2199 FieldAddress field_cid_operand( 2203 FieldAddress field_cid_operand(
2200 result_reg, Field::guarded_cid_offset(), kWord); 2204 result_reg, Field::guarded_cid_offset(), kUnsignedHalfword);
2201 FieldAddress field_nullability_operand( 2205 FieldAddress field_nullability_operand(
2202 result_reg, Field::is_nullable_offset(), kWord); 2206 result_reg, Field::is_nullable_offset(), kUnsignedHalfword);
2203 2207
2204 __ ldr(temp, field_nullability_operand, kWord); 2208 __ ldr(temp, field_nullability_operand, kUnsignedHalfword);
2205 __ CompareImmediate(temp, kNullCid, PP); 2209 __ CompareImmediate(temp, kNullCid, PP);
2206 __ b(&load_pointer, EQ); 2210 __ b(&load_pointer, EQ);
2207 2211
2208 __ ldr(temp, field_cid_operand, kWord); 2212 __ ldr(temp, field_cid_operand, kUnsignedHalfword);
2209 __ CompareImmediate(temp, kDoubleCid, PP); 2213 __ CompareImmediate(temp, kDoubleCid, PP);
2210 __ b(&load_double, EQ); 2214 __ b(&load_double, EQ);
2211 2215
2212 __ ldr(temp, field_cid_operand, kWord); 2216 __ ldr(temp, field_cid_operand, kUnsignedHalfword);
2213 __ CompareImmediate(temp, kFloat32x4Cid, PP); 2217 __ CompareImmediate(temp, kFloat32x4Cid, PP);
2214 __ b(&load_float32x4, EQ); 2218 __ b(&load_float32x4, EQ);
2215 2219
2216 __ ldr(temp, field_cid_operand, kWord); 2220 __ ldr(temp, field_cid_operand, kUnsignedHalfword);
2217 __ CompareImmediate(temp, kFloat64x2Cid, PP); 2221 __ CompareImmediate(temp, kFloat64x2Cid, PP);
2218 __ b(&load_float64x2, EQ); 2222 __ b(&load_float64x2, EQ);
2219 2223
2220 // Fall through. 2224 // Fall through.
2221 __ b(&load_pointer); 2225 __ b(&load_pointer);
2222 2226
2223 if (!compiler->is_optimizing()) { 2227 if (!compiler->is_optimizing()) {
2224 locs()->live_registers()->Add(locs()->in(0)); 2228 locs()->live_registers()->Add(locs()->in(0));
2225 } 2229 }
2226 2230
(...skipping 3426 matching lines...) Expand 10 before | Expand all | Expand 10 after
5653 1, 5657 1,
5654 locs()); 5658 locs());
5655 __ Drop(1); 5659 __ Drop(1);
5656 __ Pop(result); 5660 __ Pop(result);
5657 } 5661 }
5658 5662
5659 5663
5660 } // namespace dart 5664 } // namespace dart
5661 5665
5662 #endif // defined TARGET_ARCH_ARM64 5666 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698