Commit 964f6a3e authored by Jaroslav Sevcik's avatar Jaroslav Sevcik

[turbofan] Normalize union of representation and range to a range.

BUG=
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/972543003

Cr-Commit-Position: refs/heads/master@{#26944}
parent 5f49fef3
......@@ -777,7 +777,7 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Intersect(
bits &= ~number_bits;
result->Set(0, BitsetType::New(bits, region));
}
return NormalizeUnion(result, size);
return NormalizeUnion(result, size, region);
}
......@@ -992,7 +992,7 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Union(
size = AddToUnion(type1, result, size, region);
size = AddToUnion(type2, result, size, region);
return NormalizeUnion(result, size);
return NormalizeUnion(result, size, region);
}
......@@ -1016,9 +1016,9 @@ int TypeImpl<Config>::AddToUnion(
}
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.
......@@ -1032,8 +1032,11 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NormalizeUnion(
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());
......
......@@ -615,7 +615,8 @@ class TypeImpl : public Config::Base {
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);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment