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)) { |