Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 3feab4af02893c61a4764feee6c20ab6bd389324..ecc97e09c1d19cf800e87cba86738e57358279ec 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -156,6 +156,20 @@ void Range::Union(Range* other) { |
} |
+void Range::CombinedMax(Range* other) { |
+ upper_ = Max(upper_, other->upper_); |
+ lower_ = Max(lower_, other->lower_); |
+ set_can_be_minus_zero(CanBeMinusZero() || other->CanBeMinusZero()); |
+} |
+ |
+ |
+void Range::CombinedMin(Range* other) { |
+ upper_ = Min(upper_, other->upper_); |
+ lower_ = Min(lower_, other->lower_); |
+ set_can_be_minus_zero(CanBeMinusZero() || other->CanBeMinusZero()); |
+} |
+ |
+ |
void Range::Sar(int32_t value) { |
int32_t bits = value & 0x1F; |
lower_ = lower_ >> bits; |
@@ -1238,6 +1252,24 @@ Range* HMod::InferRange(Zone* zone) { |
} |
+Range* HMathMinMax::InferRange(Zone* zone) { |
+ if (representation().IsInteger32()) { |
+ Range* a = left()->range(); |
+ Range* b = right()->range(); |
+ Range* res = a->Copy(zone); |
+ if (operation_ == kMathMax) { |
+ res->CombinedMax(b); |
+ } else { |
+ ASSERT(operation_ == kMathMin); |
+ res->CombinedMin(b); |
+ } |
+ return res; |
+ } else { |
+ return HValue::InferRange(zone); |
+ } |
+} |
+ |
+ |
void HPhi::PrintTo(StringStream* stream) { |
stream->Add("["); |
for (int i = 0; i < OperandCount(); ++i) { |