Bug 1008106 - IonMonkey: Set has-bounds flags after Range::refineInt32BoundsByExponent r=nbp

This commit is contained in:
Dan Gohman 2014-05-13 20:58:33 -07:00
Родитель cbc884ac7a
Коммит 0759a0cbb4
2 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -453,7 +453,9 @@ Range::intersect(TempAllocator &alloc, const Range *lhs, const Range *rhs, bool
newHasInt32LowerBound && newHasInt32UpperBound &&
newLower == newUpper))
{
refineInt32BoundsByExponent(newExponent, &newLower, &newUpper);
refineInt32BoundsByExponent(newExponent,
&newLower, &newHasInt32LowerBound,
&newUpper, &newHasInt32UpperBound);
// If we're intersecting two ranges that don't overlap, this could also
// push the bounds past each other, since the actual intersection is
@ -2113,7 +2115,9 @@ Range::wrapAroundToInt32()
// Clearing the fractional field may provide an opportunity to refine
// lower_ or upper_.
refineInt32BoundsByExponent(max_exponent_, &lower_, &upper_);
refineInt32BoundsByExponent(max_exponent_,
&lower_, &hasInt32LowerBound_,
&upper_, &hasInt32UpperBound_);
assertInvariants();
}

Просмотреть файл

@ -277,12 +277,17 @@ class Range : public TempObject {
// Given an exponent value and pointers to the lower and upper bound values,
// this function refines the lower and upper bound values to the tighest
// bound for integer values implied by the exponent.
static void refineInt32BoundsByExponent(uint16_t e, int32_t *l, int32_t *h) {
static void refineInt32BoundsByExponent(uint16_t e,
int32_t *l, bool *lb,
int32_t *h, bool *hb)
{
if (e < MaxInt32Exponent) {
// pow(2, max_exponent_+1)-1 to compute a maximum absolute value.
int32_t limit = (uint32_t(1) << (e + 1)) - 1;
*h = Min(*h, limit);
*l = Max(*l, -limit);
*hb = true;
*lb = true;
}
}