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

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 14299)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -2513,6 +2513,23 @@
}
break;
+ case Token::kBIT_AND:
+ if (Range::ConstantMin(right_range).value() >= 0) {
+ min = RangeBoundary::FromConstant(0);
+ max = Range::ConstantMax(right_range);
+ break;
+ }
+ if (Range::ConstantMin(left_range).value() >= 0) {
+ min = RangeBoundary::FromConstant(0);
+ max = Range::ConstantMax(left_range);
+ break;
+ }
+
+ if (range_ == NULL) {
+ range_ = Range::Unknown();
+ }
+ return;
+
default:
if (range_ == NULL) {
range_ = Range::Unknown();
@@ -2530,6 +2547,14 @@
}
+// Inclusive.
+bool Range::IsWithin(intptr_t min_int, intptr_t max_int) const {
+ if (min().LowerBound().value() < min_int) return false;
+ if (max().UpperBound().value() > max_int) return false;
+ return true;
+}
+
+
bool CheckArrayBoundInstr::IsRedundant(RangeBoundary length) {
// Check that array has an immutable length.
if ((array_type() != kArrayCid) && (array_type() != kImmutableArrayCid)) {
« 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