Add in two patches that were lost while rebasing (bug 765119, r=jandem)

This commit is contained in:
Marty Rosenberg 2012-10-03 09:37:50 -04:00
parent 88871c43a2
commit 80bec711e0
2 changed files with 14 additions and 7 deletions

View File

@ -2486,7 +2486,7 @@ class MMul : public MBinaryArithInstruction
}
bool canBeNegativeZero() {
if (range()->lower() >= 0 && range()->upper() >= 0)
if (range()->lower() > 0 || range()->upper() < 0)
return false;
return canBeNegativeZero_;
}
@ -2589,11 +2589,16 @@ class MMod : public MBinaryArithInstruction
bool recomputeRange() {
if (specialization() != MIRType_Int32)
return false;
Range *other = getOperand(0)->range();
int64_t a = Range::abs64((int64_t)other->lower());
int64_t b = Range::abs64((int64_t)other->upper());
Range r(Min(-a+1, -b+1),
Max( a-1, b-1));
Range *rhs = getOperand(1)->range();
int64_t a = Range::abs64((int64_t)rhs->lower());
int64_t b = Range::abs64((int64_t)rhs->upper());
if (a ==0 && b == 0) {
// We should never take something % 0.
Range r(INT_MIN, INT_MAX);
return range()->update(r);
}
int64_t bound = Max(1-a, b-1);
Range r(-bound, bound);
return range()->update(r);
}
};

View File

@ -272,8 +272,10 @@ Range::intersect(const Range *lhs, const Range *rhs, bool *nullRange)
//
// Instead, we should use it to eliminate the dead block.
// (Bug 765127)
if (r.upper_ < r.lower_)
if (r.upper_ < r.lower_) {
*nullRange = true;
r.makeRangeInfinite();
}
return r;
}