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

Unified Diff: src/types.h

Issue 904863002: [turbofan] Separate representation type operations from the semantic types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix intersection to be pointwise 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/hydrogen-types.cc ('k') | src/types.cc » ('j') | src/types.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/types.h
diff --git a/src/types.h b/src/types.h
index 55c7e6c4692d8e19c89177a97128bd8ee222cd8b..669e02bd7ff3feac32ef3c2e99f49d837b1b3c13 100644
--- a/src/types.h
+++ b/src/types.h
@@ -349,6 +349,16 @@ class TypeImpl : public Config::Base {
PROPER_BITSET_TYPE_LIST(DEFINE_TYPE_CONSTRUCTOR)
#undef DEFINE_TYPE_CONSTRUCTOR
+#define DEFINE_TYPE_CONSTRUCTOR(type, value) \
+ static TypeImpl* Mask##type##ForTesting() { \
+ return BitsetType::New(BitsetType::k##type); \
+ } \
+ static TypeHandle Mask##type##ForTesting(Region* region) { \
+ return BitsetType::New(BitsetType::k##type, region); \
+ }
+ MASK_BITSET_TYPE_LIST(DEFINE_TYPE_CONSTRUCTOR)
+#undef DEFINE_TYPE_CONSTRUCTOR
+
static TypeImpl* SignedSmall() {
return BitsetType::New(BitsetType::SignedSmall());
}
@@ -563,12 +573,16 @@ class TypeImpl : public Config::Base {
}
UnionType* AsUnion() { return UnionType::cast(this); }
+ bitset GetRepresentation();
rossberg 2015/02/11 12:34:11 Nit: drop the "Get"
Jarin 2015/02/11 16:10:47 Done.
+
// Auxiliary functions.
+ bool SemanticMaybe(TypeImpl* that);
bitset BitsetGlb() { return BitsetType::Glb(this); }
bitset BitsetLub() { return BitsetType::Lub(this); }
bool SlowIs(TypeImpl* that);
+ bool SemanticIs(TypeImpl* that);
static bool IsInteger(double x) {
return nearbyint(x) == x && !i::IsMinusZero(x); // Allows for infinities.
@@ -580,16 +594,9 @@ class TypeImpl : public Config::Base {
struct Limits {
double min;
double max;
- bitset representation;
- Limits(double min, double max, bitset representation)
- : min(min), max(max), representation(representation) {}
- explicit Limits(RangeType* range)
- : min(range->Min()),
- max(range->Max()),
- representation(REPRESENTATION(range->Bound())) {}
- static Limits Empty(Region* region) {
- return Limits(1, 0, BitsetType::kNone);
- }
+ Limits(double min, double max) : min(min), max(max) {}
+ explicit Limits(RangeType* range) : min(range->Min()), max(range->Max()) {}
+ static Limits Empty(Region* region) { return Limits(1, 0); }
};
static bool IsEmpty(Limits lim);
@@ -649,11 +656,13 @@ class TypeImpl<Config>::BitsetType : public TypeImpl<Config> {
if (FLAG_enable_slow_asserts) CheckNumberBits(bits);
return Config::from_bitset(bits, region);
}
- // TODO(neis): Eventually allow again for types with empty semantics
- // part and modify intersection and possibly subtyping accordingly.
static bool IsInhabited(bitset bits) {
- return bits & kSemantic;
+ return SEMANTIC(bits) != kNone && REPRESENTATION(bits) != kNone;
+ }
+
+ static bool SemanticIsInhabited(bitset bits) {
+ return SEMANTIC(bits) != kNone;
}
static bool Is(bitset bits1, bitset bits2) {
@@ -855,8 +864,8 @@ class TypeImpl<Config>::RangeType : public TypeImpl<Config> {
return Config::template cast<RangeType>(Config::from_range(range));
}
- static RangeHandle New(Limits lim, Region* region) {
- return New(lim.min, lim.max, BitsetType::New(lim.representation, region),
+ static RangeHandle New(Limits lim, bitset representation, Region* region) {
+ return New(lim.min, lim.max, BitsetType::New(representation, region),
region);
}
@@ -866,7 +875,6 @@ class TypeImpl<Config>::RangeType : public TypeImpl<Config> {
}
};
// TODO(neis): Also cache min and max values.
-// TODO(neis): Allow restricting the representation.
// -----------------------------------------------------------------------------
« no previous file with comments | « src/hydrogen-types.cc ('k') | src/types.cc » ('j') | src/types.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698