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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 11175013: Add range to kBIT_AND with positive constants. Use that range to eliminate compares in left shifts. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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_ia32.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 13823)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -2187,6 +2187,23 @@
RangeBoundary::OverflowedMaxSmi());
break;
+ case Token::kBIT_AND:
+ if (Range::ConstantMin(right_range).value() >= 0) {
+ new_min = RangeBoundary::FromConstant(0);
+ new_max = Range::ConstantMax(right_range);
+ break;
+ }
+ if (Range::ConstantMin(left_range).value() >= 0) {
+ new_min = RangeBoundary::FromConstant(0);
+ new_max = Range::ConstantMax(left_range);
+ break;
+ }
+ if (range_ == NULL) {
Vyacheslav Egorov (Google) 2012/10/19 20:05:28 I sense a problem here. Range of a phi can start l
+ range_ = Range::Unknown();
+ return true;
+ }
+ return false;
+
default:
if (range_ == NULL) {
range_ = Range::Unknown();
@@ -2207,6 +2224,14 @@
}
+// Inclusive.
+bool Range::IsWithin(intptr_t min_int, intptr_t max_int) const {
+ if (!min().IsConstant() || (min().value() < min_int)) return false;
+ if (!max().IsConstant() || (max().value() > max_int)) return false;
+ return true;
+}
+
+
#undef __
} // namespace dart
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698