bits &= ~number_bits;
result->Set(0, BitsetType::New(bits, region));
}
- return NormalizeUnion(result, size);
+ return NormalizeUnion(result, size, region);
}
size = AddToUnion(type1, result, size, region);
size = AddToUnion(type2, result, size, region);
- return NormalizeUnion(result, size);
+ return NormalizeUnion(result, size, region);
}
}
-template<class Config>
+template <class Config>
typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NormalizeUnion(
- UnionHandle unioned, int size) {
+ UnionHandle unioned, int size, Region* region) {
DCHECK(size >= 1);
DCHECK(unioned->Get(0)->IsBitset());
// If the union has just one element, return it.
if (representation == unioned->Get(1)->Representation()) {
return unioned->Get(1);
}
- // TODO(jarin) If the element at 1 is range of constant, slap
- // the representation on it and return that.
+ if (unioned->Get(1)->IsRange()) {
+ return RangeType::New(unioned->Get(1)->AsRange()->Min(),
+ unioned->Get(1)->AsRange()->Max(), unioned->Get(0),
+ region);
+ }
}
unioned->Shrink(size);
SLOW_DCHECK(unioned->Wellformed());
TypeHandle type, UnionHandle result, int size, Region* region);
static int IntersectAux(TypeHandle type, TypeHandle other, UnionHandle result,
int size, Limits* limits, Region* region);
- static TypeHandle NormalizeUnion(UnionHandle unioned, int size);
+ static TypeHandle NormalizeUnion(UnionHandle unioned, int size,
+ Region* region);
static TypeHandle NormalizeRangeAndBitset(RangeHandle range, bitset* bits,
Region* region);
};