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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_arm64.cc ('k') | runtime/vm/intermediate_language_mips.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) 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 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 1453
1454 if (emit_full_guard) { 1454 if (emit_full_guard) {
1455 __ LoadObject(field_reg, Field::ZoneHandle(field().raw())); 1455 __ LoadObject(field_reg, Field::ZoneHandle(field().raw()));
1456 1456
1457 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset()); 1457 FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset());
1458 FieldAddress field_nullability_operand( 1458 FieldAddress field_nullability_operand(
1459 field_reg, Field::is_nullable_offset()); 1459 field_reg, Field::is_nullable_offset());
1460 1460
1461 if (value_cid == kDynamicCid) { 1461 if (value_cid == kDynamicCid) {
1462 LoadValueCid(compiler, value_cid_reg, value_reg); 1462 LoadValueCid(compiler, value_cid_reg, value_reg);
1463 __ cmpl(value_cid_reg, field_cid_operand); 1463 __ cmpw(value_cid_reg, field_cid_operand);
1464 __ j(EQUAL, &ok); 1464 __ j(EQUAL, &ok);
1465 __ cmpl(value_cid_reg, field_nullability_operand); 1465 __ cmpw(value_cid_reg, field_nullability_operand);
1466 } else if (value_cid == kNullCid) { 1466 } else if (value_cid == kNullCid) {
1467 // Value in graph known to be null. 1467 // Value in graph known to be null.
1468 // Compare with null. 1468 // Compare with null.
1469 __ cmpl(field_nullability_operand, Immediate(value_cid)); 1469 __ cmpw(field_nullability_operand, Immediate(value_cid));
1470 } else { 1470 } else {
1471 // Value in graph known to be non-null. 1471 // Value in graph known to be non-null.
1472 // Compare class id with guard field class id. 1472 // Compare class id with guard field class id.
1473 __ cmpl(field_cid_operand, Immediate(value_cid)); 1473 __ cmpw(field_cid_operand, Immediate(value_cid));
1474 } 1474 }
1475 __ j(EQUAL, &ok); 1475 __ j(EQUAL, &ok);
1476 1476
1477 // Check if the tracked state of the guarded field can be initialized 1477 // Check if the tracked state of the guarded field can be initialized
1478 // inline. If the field needs length check we fall through to runtime 1478 // inline. If the field needs length check we fall through to runtime
1479 // which is responsible for computing offset of the length field 1479 // which is responsible for computing offset of the length field
1480 // based on the class id. 1480 // based on the class id.
1481 // Length guard will be emitted separately when needed via GuardFieldLength 1481 // Length guard will be emitted separately when needed via GuardFieldLength
1482 // instruction after GuardFieldClass. 1482 // instruction after GuardFieldClass.
1483 if (!field().needs_length_check()) { 1483 if (!field().needs_length_check()) {
1484 // Uninitialized field can be handled inline. Check if the 1484 // Uninitialized field can be handled inline. Check if the
1485 // field is still unitialized. 1485 // field is still unitialized.
1486 __ cmpl(field_cid_operand, Immediate(kIllegalCid)); 1486 __ cmpw(field_cid_operand, Immediate(kIllegalCid));
1487 // Jump to failure path when guard field has been initialized and 1487 // Jump to failure path when guard field has been initialized and
1488 // the field and value class ids do not not match. 1488 // the field and value class ids do not not match.
1489 __ j(NOT_EQUAL, fail); 1489 __ j(NOT_EQUAL, fail);
1490 1490
1491 if (value_cid == kDynamicCid) { 1491 if (value_cid == kDynamicCid) {
1492 // Do not know value's class id. 1492 // Do not know value's class id.
1493 __ movl(field_cid_operand, value_cid_reg); 1493 __ movw(field_cid_operand, value_cid_reg);
1494 __ movl(field_nullability_operand, value_cid_reg); 1494 __ movw(field_nullability_operand, value_cid_reg);
1495 } else { 1495 } else {
1496 ASSERT(field_reg != kNoRegister); 1496 ASSERT(field_reg != kNoRegister);
1497 __ movl(field_cid_operand, Immediate(value_cid)); 1497 __ movw(field_cid_operand, Immediate(value_cid));
1498 __ movl(field_nullability_operand, Immediate(value_cid)); 1498 __ movw(field_nullability_operand, Immediate(value_cid));
1499 } 1499 }
1500 1500
1501 if (deopt == NULL) { 1501 if (deopt == NULL) {
1502 ASSERT(!compiler->is_optimizing()); 1502 ASSERT(!compiler->is_optimizing());
1503 __ jmp(&ok); 1503 __ jmp(&ok);
1504 } 1504 }
1505 } 1505 }
1506 1506
1507 if (deopt == NULL) { 1507 if (deopt == NULL) {
1508 ASSERT(!compiler->is_optimizing()); 1508 ASSERT(!compiler->is_optimizing());
1509 __ Bind(fail); 1509 __ Bind(fail);
1510 1510
1511 __ cmpl(FieldAddress(field_reg, Field::guarded_cid_offset()), 1511 __ cmpw(FieldAddress(field_reg, Field::guarded_cid_offset()),
1512 Immediate(kDynamicCid)); 1512 Immediate(kDynamicCid));
1513 __ j(EQUAL, &ok); 1513 __ j(EQUAL, &ok);
1514 1514
1515 __ pushl(field_reg); 1515 __ pushl(field_reg);
1516 __ pushl(value_reg); 1516 __ pushl(value_reg);
1517 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2); 1517 __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2);
1518 __ Drop(2); // Drop the field and the value. 1518 __ Drop(2); // Drop the field and the value.
1519 } 1519 }
1520 } else { 1520 } else {
1521 ASSERT(compiler->is_optimizing()); 1521 ASSERT(compiler->is_optimizing());
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 locs()->live_registers()->Add(locs()->in(1), kTagged); 1832 locs()->live_registers()->Add(locs()->in(1), kTagged);
1833 } 1833 }
1834 1834
1835 Label store_pointer; 1835 Label store_pointer;
1836 Label store_double; 1836 Label store_double;
1837 Label store_float32x4; 1837 Label store_float32x4;
1838 Label store_float64x2; 1838 Label store_float64x2;
1839 1839
1840 __ LoadObject(temp, Field::ZoneHandle(field().raw())); 1840 __ LoadObject(temp, Field::ZoneHandle(field().raw()));
1841 1841
1842 __ cmpl(FieldAddress(temp, Field::is_nullable_offset()), 1842 __ cmpw(FieldAddress(temp, Field::is_nullable_offset()),
1843 Immediate(kNullCid)); 1843 Immediate(kNullCid));
1844 __ j(EQUAL, &store_pointer); 1844 __ j(EQUAL, &store_pointer);
1845 1845
1846 __ movzxb(temp2, FieldAddress(temp, Field::kind_bits_offset())); 1846 __ movzxb(temp2, FieldAddress(temp, Field::kind_bits_offset()));
1847 __ testl(temp2, Immediate(1 << Field::kUnboxingCandidateBit)); 1847 __ testl(temp2, Immediate(1 << Field::kUnboxingCandidateBit));
1848 __ j(ZERO, &store_pointer); 1848 __ j(ZERO, &store_pointer);
1849 1849
1850 __ cmpl(FieldAddress(temp, Field::guarded_cid_offset()), 1850 __ cmpw(FieldAddress(temp, Field::guarded_cid_offset()),
1851 Immediate(kDoubleCid)); 1851 Immediate(kDoubleCid));
1852 __ j(EQUAL, &store_double); 1852 __ j(EQUAL, &store_double);
1853 1853
1854 __ cmpl(FieldAddress(temp, Field::guarded_cid_offset()), 1854 __ cmpw(FieldAddress(temp, Field::guarded_cid_offset()),
1855 Immediate(kFloat32x4Cid)); 1855 Immediate(kFloat32x4Cid));
1856 __ j(EQUAL, &store_float32x4); 1856 __ j(EQUAL, &store_float32x4);
1857 1857
1858 __ cmpl(FieldAddress(temp, Field::guarded_cid_offset()), 1858 __ cmpw(FieldAddress(temp, Field::guarded_cid_offset()),
1859 Immediate(kFloat64x2Cid)); 1859 Immediate(kFloat64x2Cid));
1860 __ j(EQUAL, &store_float64x2); 1860 __ j(EQUAL, &store_float64x2);
1861 1861
1862 // Fall through. 1862 // Fall through.
1863 __ jmp(&store_pointer); 1863 __ jmp(&store_pointer);
1864 1864
1865 1865
1866 if (!compiler->is_optimizing()) { 1866 if (!compiler->is_optimizing()) {
1867 locs()->live_registers()->Add(locs()->in(0)); 1867 locs()->live_registers()->Add(locs()->in(0));
1868 locs()->live_registers()->Add(locs()->in(1)); 1868 locs()->live_registers()->Add(locs()->in(1));
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 Label load_pointer; 2203 Label load_pointer;
2204 Label load_double; 2204 Label load_double;
2205 Label load_float32x4; 2205 Label load_float32x4;
2206 Label load_float64x2; 2206 Label load_float64x2;
2207 2207
2208 __ LoadObject(result, Field::ZoneHandle(field()->raw())); 2208 __ LoadObject(result, Field::ZoneHandle(field()->raw()));
2209 2209
2210 FieldAddress field_cid_operand(result, Field::guarded_cid_offset()); 2210 FieldAddress field_cid_operand(result, Field::guarded_cid_offset());
2211 FieldAddress field_nullability_operand(result, Field::is_nullable_offset()); 2211 FieldAddress field_nullability_operand(result, Field::is_nullable_offset());
2212 2212
2213 __ cmpl(field_nullability_operand, Immediate(kNullCid)); 2213 __ cmpw(field_nullability_operand, Immediate(kNullCid));
2214 __ j(EQUAL, &load_pointer); 2214 __ j(EQUAL, &load_pointer);
2215 2215
2216 __ cmpl(field_cid_operand, Immediate(kDoubleCid)); 2216 __ cmpw(field_cid_operand, Immediate(kDoubleCid));
2217 __ j(EQUAL, &load_double); 2217 __ j(EQUAL, &load_double);
2218 2218
2219 __ cmpl(field_cid_operand, Immediate(kFloat32x4Cid)); 2219 __ cmpw(field_cid_operand, Immediate(kFloat32x4Cid));
2220 __ j(EQUAL, &load_float32x4); 2220 __ j(EQUAL, &load_float32x4);
2221 2221
2222 __ cmpl(field_cid_operand, Immediate(kFloat64x2Cid)); 2222 __ cmpw(field_cid_operand, Immediate(kFloat64x2Cid));
2223 __ j(EQUAL, &load_float64x2); 2223 __ j(EQUAL, &load_float64x2);
2224 2224
2225 // Fall through. 2225 // Fall through.
2226 __ jmp(&load_pointer); 2226 __ jmp(&load_pointer);
2227 2227
2228 if (!compiler->is_optimizing()) { 2228 if (!compiler->is_optimizing()) {
2229 locs()->live_registers()->Add(locs()->in(0)); 2229 locs()->live_registers()->Add(locs()->in(0));
2230 } 2230 }
2231 2231
2232 { 2232 {
(...skipping 4646 matching lines...) Expand 10 before | Expand all | Expand 10 after
6879 __ Drop(1); 6879 __ Drop(1);
6880 __ popl(result); 6880 __ popl(result);
6881 } 6881 }
6882 6882
6883 6883
6884 } // namespace dart 6884 } // namespace dart
6885 6885
6886 #undef __ 6886 #undef __
6887 6887
6888 #endif // defined TARGET_ARCH_IA32 6888 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698