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

Unified Diff: runtime/vm/intermediate_language_arm.cc

Issue 104583002: Small cleanup and more test coverage for guarded fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_arm.cc
===================================================================
--- runtime/vm/intermediate_language_arm.cc (revision 30852)
+++ runtime/vm/intermediate_language_arm.cc (working copy)
@@ -1488,7 +1488,25 @@
if (!ok_is_fall_through) {
__ b(&ok);
}
+
+ if (deopt == NULL) {
+ ASSERT(!compiler->is_optimizing());
+ __ Bind(fail);
+
+ __ ldr(IP, FieldAddress(field_reg, Field::guarded_cid_offset()));
+ __ CompareImmediate(IP, kDynamicCid);
+ __ b(&ok, EQ);
+
+ __ Push(field_reg);
+ __ Push(value_reg);
+ __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2);
+ __ Drop(2); // Drop the field and the value.
+ }
} else {
+ ASSERT(compiler->is_optimizing());
+ ASSERT(deopt != NULL);
+ ASSERT(ok_is_fall_through);
+ // Field guard class has been initialized and is known.
if (field_reg != kNoRegister) {
__ LoadObject(field_reg, Field::ZoneHandle(field().raw()));
}
@@ -1527,18 +1545,11 @@
__ CompareImmediate(value_reg,
reinterpret_cast<intptr_t>(Object::null()));
}
-
- if (ok_is_fall_through) {
- __ b(fail, NE);
- } else {
- __ b(&ok, EQ);
- }
+ __ b(fail, NE);
} else {
// Both value's and field's class id is known.
if ((value_cid != field_cid) && (value_cid != nullability)) {
- if (ok_is_fall_through) {
- __ b(fail);
- }
+ __ b(fail);
} else if (field_has_length && (value_cid == field_cid)) {
ASSERT(value_cid_reg != kNoRegister);
if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) {
@@ -1551,31 +1562,12 @@
FieldAddress(value_reg, TypedData::length_offset()));
}
__ CompareImmediate(value_cid_reg, field_length);
- if (ok_is_fall_through) {
- __ b(fail, NE);
- }
+ __ b(fail, NE);
} else {
- // Nothing to emit.
- ASSERT(!compiler->is_optimizing());
- return;
+ UNREACHABLE();
}
}
}
-
- if (deopt == NULL) {
- ASSERT(!compiler->is_optimizing());
- __ Bind(fail);
-
- __ ldr(IP, FieldAddress(field_reg, Field::guarded_cid_offset()));
- __ CompareImmediate(IP, kDynamicCid);
- __ b(&ok, EQ);
-
- __ Push(field_reg);
- __ Push(value_reg);
- __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2);
- __ Drop(2); // Drop the field and the value.
- }
-
__ Bind(&ok);
}
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698