Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(853)

Unified Diff: src/types.cc

Issue 972543003: [turbofan] Normalize union of representation and range to a range. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/types.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/types.cc
diff --git a/src/types.cc b/src/types.cc
index 37386cd82f6012e1ccf05caabb6e19fcd4b6664c..f1cf6204a2beacae34bdebf190c01bd7ca41264c 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -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());
« no previous file with comments | « src/types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698