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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 1058793003: A CheckClass instruction that compares against a null class only can be optimized to check instance… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
===================================================================
--- runtime/vm/intermediate_language.cc (revision 44874)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -191,7 +191,7 @@
}
-bool CheckClassInstr::IsNullCheck() const {
+bool CheckClassInstr::DeoptIfNull() const {
if (unary_checks().NumberOfChecks() != 1) {
return false;
}
@@ -203,6 +203,19 @@
}
+// Null object is a singleton of null-class (except for some sentinel,
+// transitional temporaries). Instead of checking against the null class only
+// we can check against null instance instead.
+bool CheckClassInstr::DeoptIfNotNull() const {
+ if (unary_checks().NumberOfChecks() != 1) {
+ return false;
+ }
+ const intptr_t cid = unary_checks().GetCidAt(0);
+ return cid == kNullCid;
+}
+
+
+
bool CheckClassInstr::IsDenseSwitch() const {
if (unary_checks().GetReceiverClassIdAt(0) == kSmiCid) return false;
if (cids_.length() > 2 &&
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698