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

Unified Diff: test/cctest/test-types.cc

Issue 2310923002: [turbofan] Also nuke Array and Function types. (Closed)
Patch Set: Created 4 years, 3 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.cc ('k') | test/cctest/types-fuzz.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-types.cc
diff --git a/test/cctest/test-types.cc b/test/cctest/test-types.cc
index 3d295ccd4e336962d13282ea491ec0791a7b1f4f..83191688a3a5374e464f8cdd4f9297bf7564bdfc 100644
--- a/test/cctest/test-types.cc
+++ b/test/cctest/test-types.cc
@@ -113,7 +113,7 @@ struct Tests {
Type* t = *it;
CHECK(1 ==
this->IsBitset(t) + t->IsConstant() + t->IsRange() +
- this->IsUnion(t) + t->IsArray() + t->IsFunction());
+ this->IsUnion(t));
}
}
@@ -378,102 +378,6 @@ struct Tests {
}
}
- void Array() {
- // Constructor
- for (int i = 0; i < 20; ++i) {
- Type* type = T.Random();
- Type* array = T.Array1(type);
- CHECK(array->IsArray());
- }
-
- // Attributes
- for (int i = 0; i < 20; ++i) {
- Type* type = T.Random();
- Type* array = T.Array1(type);
- CheckEqual(type, array->AsArray()->Element());
- }
-
- // Functionality & Injectivity: Array(T1) = Array(T2) iff T1 = T2
- for (int i = 0; i < 20; ++i) {
- for (int j = 0; j < 20; ++j) {
- Type* type1 = T.Random();
- Type* type2 = T.Random();
- Type* array1 = T.Array1(type1);
- Type* array2 = T.Array1(type2);
- CHECK(Equal(array1, array2) == Equal(type1, type2));
- }
- }
- }
-
- void Function() {
- // Constructors
- for (int i = 0; i < 20; ++i) {
- for (int j = 0; j < 20; ++j) {
- for (int k = 0; k < 20; ++k) {
- Type* type1 = T.Random();
- Type* type2 = T.Random();
- Type* type3 = T.Random();
- Type* function0 = T.Function0(type1, type2);
- Type* function1 = T.Function1(type1, type2, type3);
- Type* function2 = T.Function2(type1, type2, type3);
- CHECK(function0->IsFunction());
- CHECK(function1->IsFunction());
- CHECK(function2->IsFunction());
- }
- }
- }
-
- // Attributes
- for (int i = 0; i < 20; ++i) {
- for (int j = 0; j < 20; ++j) {
- for (int k = 0; k < 20; ++k) {
- Type* type1 = T.Random();
- Type* type2 = T.Random();
- Type* type3 = T.Random();
- Type* function0 = T.Function0(type1, type2);
- Type* function1 = T.Function1(type1, type2, type3);
- Type* function2 = T.Function2(type1, type2, type3);
- CHECK_EQ(0, function0->AsFunction()->Arity());
- CHECK_EQ(1, function1->AsFunction()->Arity());
- CHECK_EQ(2, function2->AsFunction()->Arity());
- CheckEqual(type1, function0->AsFunction()->Result());
- CheckEqual(type1, function1->AsFunction()->Result());
- CheckEqual(type1, function2->AsFunction()->Result());
- CheckEqual(type2, function0->AsFunction()->Receiver());
- CheckEqual(type2, function1->AsFunction()->Receiver());
- CheckEqual(T.Any, function2->AsFunction()->Receiver());
- CheckEqual(type3, function1->AsFunction()->Parameter(0));
- CheckEqual(type2, function2->AsFunction()->Parameter(0));
- CheckEqual(type3, function2->AsFunction()->Parameter(1));
- }
- }
- }
-
- // Functionality & Injectivity: Function(Ts1) = Function(Ts2) iff Ts1 = Ts2
- for (int i = 0; i < 20; ++i) {
- for (int j = 0; j < 20; ++j) {
- for (int k = 0; k < 20; ++k) {
- Type* type1 = T.Random();
- Type* type2 = T.Random();
- Type* type3 = T.Random();
- Type* function01 = T.Function0(type1, type2);
- Type* function02 = T.Function0(type1, type3);
- Type* function03 = T.Function0(type3, type2);
- Type* function11 = T.Function1(type1, type2, type2);
- Type* function12 = T.Function1(type1, type2, type3);
- Type* function21 = T.Function2(type1, type2, type2);
- Type* function22 = T.Function2(type1, type2, type3);
- Type* function23 = T.Function2(type1, type3, type2);
- CHECK(Equal(function01, function02) == Equal(type2, type3));
- CHECK(Equal(function01, function03) == Equal(type1, type3));
- CHECK(Equal(function11, function12) == Equal(type2, type3));
- CHECK(Equal(function21, function22) == Equal(type2, type3));
- CHECK(Equal(function21, function23) == Equal(type2, type3));
- }
- }
- }
- }
-
void Of() {
// Constant(V)->Is(Of(V))
for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) {
@@ -686,8 +590,6 @@ struct Tests {
(type1->IsConstant() && type2->IsRange()) ||
(this->IsBitset(type1) && type2->IsRange()) ||
(type1->IsRange() && type2->IsRange()) ||
- (type1->IsArray() && type2->IsArray()) ||
- (type1->IsFunction() && type2->IsFunction()) ||
!type1->IsInhabited());
}
}
@@ -728,32 +630,6 @@ struct Tests {
}
}
- // Array(T1)->Is(Array(T2)) iff T1 = T2
- for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) {
- for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) {
- Type* element1 = *it1;
- Type* element2 = *it2;
- Type* type1 = T.Array1(element1);
- Type* type2 = T.Array1(element2);
- CHECK(type1->Is(type2) == element1->Equals(element2));
- }
- }
-
- // Function0(S1, T1)->Is(Function0(S2, T2)) iff S1 = S2 and T1 = T2
- for (TypeIterator i = T.types.begin(); i != T.types.end(); ++i) {
- for (TypeIterator j = T.types.begin(); j != T.types.end(); ++j) {
- Type* result1 = *i;
- Type* receiver1 = *j;
- Type* type1 = T.Function0(result1, receiver1);
- Type* result2 = T.Random();
- Type* receiver2 = T.Random();
- Type* type2 = T.Function0(result2, receiver2);
- CHECK(type1->Is(type2) ==
- (result1->Equals(result2) && receiver1->Equals(receiver2)));
- }
- }
-
-
// Range-specific subtyping
// If IsInteger(v) then Constant(v)->Is(Range(v, v)).
@@ -836,16 +712,6 @@ struct Tests {
CheckUnordered(T.ObjectConstant1, T.ArrayConstant);
CheckUnordered(T.UninitializedConstant, T.Null);
CheckUnordered(T.UninitializedConstant, T.Undefined);
-
- CheckSub(T.NumberArray, T.OtherObject);
- CheckSub(T.NumberArray, T.Receiver);
- CheckSub(T.NumberArray, T.Object);
- CheckUnordered(T.StringArray, T.AnyArray);
-
- CheckSub(T.MethodFunction, T.Object);
- CheckSub(T.NumberFunction1, T.Object);
- CheckUnordered(T.SignedFunction1, T.NumberFunction1);
- CheckUnordered(T.NumberFunction1, T.NumberFunction2);
}
void Contains() {
@@ -962,14 +828,6 @@ struct Tests {
CheckOverlap(T.ObjectConstant1, T.ObjectConstant1);
CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2);
CheckDisjoint(T.ObjectConstant1, T.ArrayConstant);
- CheckOverlap(T.NumberArray, T.Receiver);
- CheckDisjoint(T.NumberArray, T.AnyArray);
- CheckDisjoint(T.NumberArray, T.StringArray);
- CheckOverlap(T.MethodFunction, T.Object);
- CheckDisjoint(T.SignedFunction1, T.NumberFunction1);
- CheckDisjoint(T.SignedFunction1, T.NumberFunction2);
- CheckDisjoint(T.NumberFunction1, T.NumberFunction2);
- CheckDisjoint(T.SignedFunction1, T.MethodFunction);
}
void Union1() {
@@ -1112,25 +970,6 @@ struct Tests {
CheckDisjoint(
T.Union(T.ObjectConstant1, T.ArrayConstant), T.Number);
- // Bitset-array
- CHECK(this->IsBitset(T.Union(T.AnyArray, T.Receiver)));
- CHECK(this->IsUnion(T.Union(T.NumberArray, T.Number)));
-
- CheckEqual(T.Union(T.AnyArray, T.Receiver), T.Receiver);
- CheckEqual(T.Union(T.AnyArray, T.OtherObject), T.OtherObject);
- CheckUnordered(T.Union(T.AnyArray, T.String), T.Receiver);
- CheckOverlap(T.Union(T.NumberArray, T.String), T.Object);
- CheckDisjoint(T.Union(T.NumberArray, T.String), T.Number);
-
- // Bitset-function
- CHECK(this->IsBitset(T.Union(T.MethodFunction, T.Object)));
- CHECK(this->IsUnion(T.Union(T.NumberFunction1, T.Number)));
-
- CheckEqual(T.Union(T.MethodFunction, T.Object), T.Object);
- CheckUnordered(T.Union(T.NumberFunction1, T.String), T.Object);
- CheckOverlap(T.Union(T.NumberFunction2, T.String), T.Object);
- CheckDisjoint(T.Union(T.NumberFunction1, T.String), T.Number);
-
// Bitset-constant
CheckSub(
T.Union(T.ObjectConstant1, T.Signed32), T.Union(T.Object, T.Number));
@@ -1150,18 +989,6 @@ struct Tests {
T.Union(
T.ObjectConstant2, T.Union(T.ArrayConstant, T.ObjectConstant1)));
- // Array-union
- CheckEqual(
- T.Union(T.AnyArray, T.Union(T.NumberArray, T.AnyArray)),
- T.Union(T.AnyArray, T.NumberArray));
- CheckSub(T.Union(T.AnyArray, T.NumberArray), T.OtherObject);
-
- // Function-union
- CheckEqual(
- T.Union(T.NumberFunction1, T.NumberFunction2),
- T.Union(T.NumberFunction2, T.NumberFunction1));
- CheckSub(T.Union(T.SignedFunction1, T.MethodFunction), T.Object);
-
// Union-union
CheckEqual(
T.Union(
@@ -1228,33 +1055,6 @@ struct Tests {
}
}
- // Bitset-array
- CheckEqual(T.Intersect(T.NumberArray, T.Object), T.NumberArray);
- CheckEqual(T.Semantic(T.Intersect(T.AnyArray, T.Proxy)), T.None);
-
- // Bitset-function
- CheckEqual(T.Intersect(T.MethodFunction, T.Object), T.MethodFunction);
- CheckEqual(T.Semantic(T.Intersect(T.NumberFunction1, T.Proxy)), T.None);
-
- // Array-union
- CheckEqual(
- T.Intersect(T.AnyArray, T.Union(T.Object, T.SmiConstant)),
- T.AnyArray);
- CHECK(
- !T.Intersect(T.Union(T.AnyArray, T.ArrayConstant), T.NumberArray)
- ->IsInhabited());
-
- // Function-union
- CheckEqual(
- T.Intersect(T.MethodFunction, T.Union(T.String, T.MethodFunction)),
- T.MethodFunction);
- CheckEqual(
- T.Intersect(T.NumberFunction1, T.Union(T.Object, T.SmiConstant)),
- T.NumberFunction1);
- CHECK(
- !T.Intersect(T.Union(T.MethodFunction, T.Name), T.NumberFunction2)
- ->IsInhabited());
-
// Constant-union
CheckEqual(
T.Intersect(
@@ -1360,10 +1160,6 @@ TEST(ConstantType) { Tests().Constant(); }
TEST(RangeType) { Tests().Range(); }
-TEST(ArrayType) { Tests().Array(); }
-
-TEST(FunctionType) { Tests().Function(); }
-
TEST(Of) { Tests().Of(); }
TEST(MinMax) { Tests().MinMax(); }
« no previous file with comments | « src/types.cc ('k') | test/cctest/types-fuzz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698