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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 22580005: Implement IsNullCheck for CheckClassInstr. If input is nullable expected type, then check for null … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language.cc
===================================================================
--- runtime/vm/intermediate_language.cc (revision 25902)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -86,8 +86,7 @@
CheckClassInstr::CheckClassInstr(Value* value,
intptr_t deopt_id,
const ICData& unary_checks)
- : unary_checks_(unary_checks),
- null_check_(false) {
+ : unary_checks_(unary_checks) {
ASSERT(unary_checks.IsZoneHandle());
// Expected useful check data.
ASSERT(!unary_checks_.IsNull());
@@ -128,6 +127,16 @@
}
+bool CheckClassInstr::IsNullCheck() const {
+ if (unary_checks().NumberOfChecks() != 1) {
+ return false;
+ }
+ CompileType* in_type = value()->Type();
+ const intptr_t cid = unary_checks().GetCidAt(0);
+ return in_type->is_nullable() && (in_type->ToNullableCid() == cid);
+}
+
+
bool GuardFieldInstr::AttributesEqual(Instruction* other) const {
return field().raw() == other->AsGuardField()->field().raw();
}

Powered by Google App Engine
This is Rietveld 408576698