Commit 648ac440 authored by mvstanton's avatar mvstanton Committed by Commit bot

[turbofan] Cleanup: Type only has a semantic dimension.

BUG=

Review-Url: https://codereview.chromium.org/2366433003
Cr-Commit-Position: refs/heads/master@{#39666}
parent 01cd881b
...@@ -196,7 +196,7 @@ Node* RepresentationChanger::GetTaggedSignedRepresentationFor( ...@@ -196,7 +196,7 @@ Node* RepresentationChanger::GetTaggedSignedRepresentationFor(
} }
// Select the correct X -> Tagged operator. // Select the correct X -> Tagged operator.
const Operator* op; const Operator* op;
if (Type::Semantic(output_type, jsgraph()->zone())->Is(Type::None())) { if (output_type->Is(Type::None())) {
// This is an impossible value; it should not be used at runtime. // This is an impossible value; it should not be used at runtime.
// We just provide a dummy value here. // We just provide a dummy value here.
return jsgraph()->Constant(0); return jsgraph()->Constant(0);
...@@ -293,7 +293,7 @@ Node* RepresentationChanger::GetTaggedPointerRepresentationFor( ...@@ -293,7 +293,7 @@ Node* RepresentationChanger::GetTaggedPointerRepresentationFor(
break; break;
} }
// Select the correct X -> Tagged operator. // Select the correct X -> Tagged operator.
if (Type::Semantic(output_type, jsgraph()->zone())->Is(Type::None())) { if (output_type->Is(Type::None())) {
// This is an impossible value; it should not be used at runtime. // This is an impossible value; it should not be used at runtime.
// We just provide a dummy value here. // We just provide a dummy value here.
return jsgraph()->TheHoleConstant(); return jsgraph()->TheHoleConstant();
...@@ -338,7 +338,7 @@ Node* RepresentationChanger::GetTaggedRepresentationFor( ...@@ -338,7 +338,7 @@ Node* RepresentationChanger::GetTaggedRepresentationFor(
} }
// Select the correct X -> Tagged operator. // Select the correct X -> Tagged operator.
const Operator* op; const Operator* op;
if (Type::Semantic(output_type, jsgraph()->zone())->Is(Type::None())) { if (output_type->Is(Type::None())) {
// This is an impossible value; it should not be used at runtime. // This is an impossible value; it should not be used at runtime.
// We just provide a dummy value here. // We just provide a dummy value here.
return jsgraph()->TheHoleConstant(); return jsgraph()->TheHoleConstant();
...@@ -420,7 +420,7 @@ Node* RepresentationChanger::GetFloat32RepresentationFor( ...@@ -420,7 +420,7 @@ Node* RepresentationChanger::GetFloat32RepresentationFor(
} }
// Select the correct X -> Float32 operator. // Select the correct X -> Float32 operator.
const Operator* op = nullptr; const Operator* op = nullptr;
if (Type::Semantic(output_type, jsgraph()->zone())->Is(Type::None())) { if (output_type->Is(Type::None())) {
// This is an impossible value; it should not be used at runtime. // This is an impossible value; it should not be used at runtime.
// We just provide a dummy value here. // We just provide a dummy value here.
return jsgraph()->Float32Constant(0.0f); return jsgraph()->Float32Constant(0.0f);
...@@ -490,7 +490,7 @@ Node* RepresentationChanger::GetFloat64RepresentationFor( ...@@ -490,7 +490,7 @@ Node* RepresentationChanger::GetFloat64RepresentationFor(
} }
// Select the correct X -> Float64 operator. // Select the correct X -> Float64 operator.
const Operator* op = nullptr; const Operator* op = nullptr;
if (Type::Semantic(output_type, jsgraph()->zone())->Is(Type::None())) { if (output_type->Is(Type::None())) {
// This is an impossible value; it should not be used at runtime. // This is an impossible value; it should not be used at runtime.
// We just provide a dummy value here. // We just provide a dummy value here.
return jsgraph()->Float64Constant(0.0); return jsgraph()->Float64Constant(0.0);
...@@ -576,7 +576,7 @@ Node* RepresentationChanger::GetWord32RepresentationFor( ...@@ -576,7 +576,7 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
// Select the correct X -> Word32 operator. // Select the correct X -> Word32 operator.
const Operator* op = nullptr; const Operator* op = nullptr;
if (Type::Semantic(output_type, jsgraph()->zone())->Is(Type::None())) { if (output_type->Is(Type::None())) {
// This is an impossible value; it should not be used at runtime. // This is an impossible value; it should not be used at runtime.
// We just provide a dummy value here. // We just provide a dummy value here.
return jsgraph()->Int32Constant(0); return jsgraph()->Int32Constant(0);
...@@ -698,7 +698,7 @@ Node* RepresentationChanger::GetBitRepresentationFor( ...@@ -698,7 +698,7 @@ Node* RepresentationChanger::GetBitRepresentationFor(
} }
// Select the correct X -> Bit operator. // Select the correct X -> Bit operator.
const Operator* op; const Operator* op;
if (Type::Semantic(output_type, jsgraph()->zone())->Is(Type::None())) { if (output_type->Is(Type::None())) {
// This is an impossible value; it should not be used at runtime. // This is an impossible value; it should not be used at runtime.
// We just provide a dummy value here. // We just provide a dummy value here.
return jsgraph()->Int32Constant(0); return jsgraph()->Int32Constant(0);
...@@ -737,7 +737,7 @@ Node* RepresentationChanger::GetBitRepresentationFor( ...@@ -737,7 +737,7 @@ Node* RepresentationChanger::GetBitRepresentationFor(
Node* RepresentationChanger::GetWord64RepresentationFor( Node* RepresentationChanger::GetWord64RepresentationFor(
Node* node, MachineRepresentation output_rep, Type* output_type) { Node* node, MachineRepresentation output_rep, Type* output_type) {
if (Type::Semantic(output_type, jsgraph()->zone())->Is(Type::None())) { if (output_type->Is(Type::None())) {
// This is an impossible value; it should not be used at runtime. // This is an impossible value; it should not be used at runtime.
// We just provide a dummy value here. // We just provide a dummy value here.
return jsgraph()->Int64Constant(0); return jsgraph()->Int64Constant(0);
......
This diff is collapsed.
...@@ -22,13 +22,7 @@ namespace compiler { ...@@ -22,13 +22,7 @@ namespace compiler {
// can express class types (a.k.a. specific maps) and singleton types (i.e., // can express class types (a.k.a. specific maps) and singleton types (i.e.,
// concrete constants). // concrete constants).
// //
// Types consist of two dimensions: semantic (value range) and representation. // The following equations and inequations hold:
// Both are related through subtyping.
//
//
// SEMANTIC DIMENSION
//
// The following equations and inequations hold for the semantic axis:
// //
// None <= T // None <= T
// T <= Any // T <= Any
...@@ -40,7 +34,6 @@ namespace compiler { ...@@ -40,7 +34,6 @@ namespace compiler {
// InternalizedString < String // InternalizedString < String
// //
// Receiver = Object \/ Proxy // Receiver = Object \/ Proxy
// RegExp < Object
// OtherUndetectable < Object // OtherUndetectable < Object
// DetectableReceiver = Receiver - OtherUndetectable // DetectableReceiver = Receiver - OtherUndetectable
// //
...@@ -103,18 +96,13 @@ namespace compiler { ...@@ -103,18 +96,13 @@ namespace compiler {
// clang-format off // clang-format off
#define MASK_BITSET_TYPE_LIST(V) \
V(Semantic, 0xfffffffeu)
#define SEMANTIC(k) ((k) & BitsetType::kSemantic)
#define INTERNAL_BITSET_TYPE_LIST(V) \ #define INTERNAL_BITSET_TYPE_LIST(V) \
V(OtherUnsigned31, 1u << 1) \ V(OtherUnsigned31, 1u << 1) \
V(OtherUnsigned32, 1u << 2) \ V(OtherUnsigned32, 1u << 2) \
V(OtherSigned32, 1u << 3) \ V(OtherSigned32, 1u << 3) \
V(OtherNumber, 1u << 4) \ V(OtherNumber, 1u << 4) \
#define SEMANTIC_BITSET_TYPE_LIST(V) \ #define PROPER_BITSET_TYPE_LIST(V) \
V(None, 0u) \ V(None, 0u) \
V(Negative31, 1u << 5) \ V(Negative31, 1u << 5) \
V(Null, 1u << 6) \ V(Null, 1u << 6) \
...@@ -193,13 +181,9 @@ namespace compiler { ...@@ -193,13 +181,9 @@ namespace compiler {
* occur as part of PlainNumber. * occur as part of PlainNumber.
*/ */
#define PROPER_BITSET_TYPE_LIST(V) \ #define BITSET_TYPE_LIST(V) \
SEMANTIC_BITSET_TYPE_LIST(V) INTERNAL_BITSET_TYPE_LIST(V) \
PROPER_BITSET_TYPE_LIST(V)
#define BITSET_TYPE_LIST(V) \
MASK_BITSET_TYPE_LIST(V) \
INTERNAL_BITSET_TYPE_LIST(V) \
SEMANTIC_BITSET_TYPE_LIST(V)
class Type; class Type;
...@@ -224,11 +208,7 @@ class BitsetType { ...@@ -224,11 +208,7 @@ class BitsetType {
return static_cast<bitset>(reinterpret_cast<uintptr_t>(this) ^ 1u); return static_cast<bitset>(reinterpret_cast<uintptr_t>(this) ^ 1u);
} }
static bool IsInhabited(bitset bits) { return SemanticIsInhabited(bits); } static bool IsInhabited(bitset bits) { return bits != kNone; }
static bool SemanticIsInhabited(bitset bits) {
return SEMANTIC(bits) != kNone;
}
static bool Is(bitset bits1, bitset bits2) { static bool Is(bitset bits1, bitset bits2) {
return (bits1 | bits2) == bits2; return (bits1 | bits2) == bits2;
...@@ -371,7 +351,7 @@ class RangeType : public TypeBase { ...@@ -371,7 +351,7 @@ class RangeType : public TypeBase {
static Type* New(Limits lim, Zone* zone) { static Type* New(Limits lim, Zone* zone) {
DCHECK(IsInteger(lim.min) && IsInteger(lim.max)); DCHECK(IsInteger(lim.min) && IsInteger(lim.max));
DCHECK(lim.min <= lim.max); DCHECK(lim.min <= lim.max);
BitsetType::bitset bits = SEMANTIC(BitsetType::Lub(lim.min, lim.max)); BitsetType::bitset bits = BitsetType::Lub(lim.min, lim.max);
return AsType(new (zone->New(sizeof(RangeType))) RangeType(bits, lim)); return AsType(new (zone->New(sizeof(RangeType))) RangeType(bits, lim));
} }
...@@ -526,9 +506,6 @@ class Type { ...@@ -526,9 +506,6 @@ class Type {
} }
static Type* For(i::Handle<i::Map> map) { return For(*map); } static Type* For(i::Handle<i::Map> map) { return For(*map); }
// Extraction of components.
static Type* Semantic(Type* t, Zone* zone);
// Predicates. // Predicates.
bool IsInhabited() { return BitsetType::IsInhabited(this->BitsetLub()); } bool IsInhabited() { return BitsetType::IsInhabited(this->BitsetLub()); }
...@@ -627,14 +604,10 @@ class Type { ...@@ -627,14 +604,10 @@ class Type {
} }
UnionType* AsUnion() { return UnionType::cast(this); } UnionType* AsUnion() { return UnionType::cast(this); }
// Auxiliary functions.
bool SemanticMaybe(Type* that);
bitset BitsetGlb() { return BitsetType::Glb(this); } bitset BitsetGlb() { return BitsetType::Glb(this); }
bitset BitsetLub() { return BitsetType::Lub(this); } bitset BitsetLub() { return BitsetType::Lub(this); }
bool SlowIs(Type* that); bool SlowIs(Type* that);
bool SemanticIs(Type* that);
static bool Overlap(RangeType* lhs, RangeType* rhs); static bool Overlap(RangeType* lhs, RangeType* rhs);
static bool Contains(RangeType* lhs, RangeType* rhs); static bool Contains(RangeType* lhs, RangeType* rhs);
......
...@@ -108,9 +108,6 @@ class Types { ...@@ -108,9 +108,6 @@ class Types {
PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
#undef DECLARE_TYPE #undef DECLARE_TYPE
#define DECLARE_TYPE(name, value) Type* Mask##name##ForTesting;
MASK_BITSET_TYPE_LIST(DECLARE_TYPE)
#undef DECLARE_TYPE
Type* SignedSmall; Type* SignedSmall;
Type* UnsignedSmall; Type* UnsignedSmall;
...@@ -142,8 +139,6 @@ class Types { ...@@ -142,8 +139,6 @@ class Types {
Type* Intersect(Type* t1, Type* t2) { return Type::Intersect(t1, t2, zone_); } Type* Intersect(Type* t1, Type* t2) { return Type::Intersect(t1, t2, zone_); }
Type* Semantic(Type* t) { return Type::Semantic(t, zone_); }
Type* Random() { Type* Random() {
return types[rng_->NextInt(static_cast<int>(types.size()))]; return types[rng_->NextInt(static_cast<int>(types.size()))];
} }
......
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