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

Side by Side Diff: test/cctest/test-types.cc

Issue 795993002: Introduce unsigned representation types (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « src/typing.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <vector> 5 #include <vector>
6 6
7 #include "src/hydrogen-types.h" 7 #include "src/hydrogen-types.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/types.h" 9 #include "src/types.h"
10 #include "test/cctest/cctest.h" 10 #include "test/cctest/cctest.h"
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 CheckSub(T.InternalizedString, T.UniqueName); 927 CheckSub(T.InternalizedString, T.UniqueName);
928 CheckSub(T.InternalizedString, T.Name); 928 CheckSub(T.InternalizedString, T.Name);
929 CheckSub(T.Symbol, T.UniqueName); 929 CheckSub(T.Symbol, T.UniqueName);
930 CheckSub(T.Symbol, T.Name); 930 CheckSub(T.Symbol, T.Name);
931 CheckUnordered(T.String, T.UniqueName); 931 CheckUnordered(T.String, T.UniqueName);
932 CheckUnordered(T.String, T.Symbol); 932 CheckUnordered(T.String, T.Symbol);
933 CheckUnordered(T.InternalizedString, T.Symbol); 933 CheckUnordered(T.InternalizedString, T.Symbol);
934 934
935 CheckSub(T.Object, T.Receiver); 935 CheckSub(T.Object, T.Receiver);
936 CheckSub(T.Array, T.Object); 936 CheckSub(T.Array, T.Object);
937 CheckSub(T.Function, T.Object);
938 CheckSub(T.Proxy, T.Receiver); 937 CheckSub(T.Proxy, T.Receiver);
939 CheckUnordered(T.Object, T.Proxy); 938 CheckUnordered(T.Object, T.Proxy);
940 CheckUnordered(T.Array, T.Function);
941 939
942 940
943 // Subtyping between concrete structural types 941 // Subtyping between concrete structural types
944 942
945 CheckSub(T.ObjectClass, T.Object); 943 CheckSub(T.ObjectClass, T.Object);
946 CheckSub(T.ArrayClass, T.Object); 944 CheckSub(T.ArrayClass, T.Object);
947 CheckSub(T.ArrayClass, T.Array); 945 CheckSub(T.ArrayClass, T.Array);
948 CheckSub(T.UninitializedClass, T.Internal); 946 CheckSub(T.UninitializedClass, T.Internal);
949 CheckUnordered(T.ObjectClass, T.ArrayClass); 947 CheckUnordered(T.ObjectClass, T.ArrayClass);
950 CheckUnordered(T.UninitializedClass, T.Null); 948 CheckUnordered(T.UninitializedClass, T.Null);
(...skipping 15 matching lines...) Expand all
966 CheckUnordered(T.ObjectConstant1, T.ObjectClass); 964 CheckUnordered(T.ObjectConstant1, T.ObjectClass);
967 CheckUnordered(T.ObjectConstant2, T.ObjectClass); 965 CheckUnordered(T.ObjectConstant2, T.ObjectClass);
968 CheckUnordered(T.ObjectConstant1, T.ArrayClass); 966 CheckUnordered(T.ObjectConstant1, T.ArrayClass);
969 CheckUnordered(T.ObjectConstant2, T.ArrayClass); 967 CheckUnordered(T.ObjectConstant2, T.ArrayClass);
970 CheckUnordered(T.ArrayConstant, T.ObjectClass); 968 CheckUnordered(T.ArrayConstant, T.ObjectClass);
971 969
972 CheckSub(T.NumberArray, T.Array); 970 CheckSub(T.NumberArray, T.Array);
973 CheckSub(T.NumberArray, T.Object); 971 CheckSub(T.NumberArray, T.Object);
974 CheckUnordered(T.StringArray, T.AnyArray); 972 CheckUnordered(T.StringArray, T.AnyArray);
975 973
976 CheckSub(T.MethodFunction, T.Function); 974 CheckSub(T.MethodFunction, T.Object);
977 CheckSub(T.NumberFunction1, T.Object); 975 CheckSub(T.NumberFunction1, T.Object);
978 CheckUnordered(T.SignedFunction1, T.NumberFunction1); 976 CheckUnordered(T.SignedFunction1, T.NumberFunction1);
979 CheckUnordered(T.NumberFunction1, T.NumberFunction2); 977 CheckUnordered(T.NumberFunction1, T.NumberFunction2);
980 } 978 }
981 979
982 void NowIs() { 980 void NowIs() {
983 // Least Element (Bottom): None->NowIs(T) 981 // Least Element (Bottom): None->NowIs(T)
984 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { 982 for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) {
985 TypeHandle type = *it; 983 TypeHandle type = *it;
986 CHECK(T.None->NowIs(type)); 984 CHECK(T.None->NowIs(type));
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 CheckOverlap(T.InternalizedString, T.String); 1250 CheckOverlap(T.InternalizedString, T.String);
1253 CheckOverlap(T.InternalizedString, T.UniqueName); 1251 CheckOverlap(T.InternalizedString, T.UniqueName);
1254 CheckOverlap(T.InternalizedString, T.Name); 1252 CheckOverlap(T.InternalizedString, T.Name);
1255 CheckOverlap(T.Symbol, T.UniqueName); 1253 CheckOverlap(T.Symbol, T.UniqueName);
1256 CheckOverlap(T.Symbol, T.Name); 1254 CheckOverlap(T.Symbol, T.Name);
1257 CheckOverlap(T.String, T.UniqueName); 1255 CheckOverlap(T.String, T.UniqueName);
1258 CheckDisjoint(T.String, T.Symbol); 1256 CheckDisjoint(T.String, T.Symbol);
1259 CheckDisjoint(T.InternalizedString, T.Symbol); 1257 CheckDisjoint(T.InternalizedString, T.Symbol);
1260 CheckOverlap(T.Object, T.Receiver); 1258 CheckOverlap(T.Object, T.Receiver);
1261 CheckOverlap(T.Array, T.Object); 1259 CheckOverlap(T.Array, T.Object);
1262 CheckOverlap(T.Function, T.Object);
1263 CheckOverlap(T.Proxy, T.Receiver); 1260 CheckOverlap(T.Proxy, T.Receiver);
1264 CheckDisjoint(T.Object, T.Proxy); 1261 CheckDisjoint(T.Object, T.Proxy);
1265 CheckDisjoint(T.Array, T.Function);
1266 1262
1267 // Structural types 1263 // Structural types
1268 CheckOverlap(T.ObjectClass, T.Object); 1264 CheckOverlap(T.ObjectClass, T.Object);
1269 CheckOverlap(T.ArrayClass, T.Object); 1265 CheckOverlap(T.ArrayClass, T.Object);
1270 CheckOverlap(T.ObjectClass, T.ObjectClass); 1266 CheckOverlap(T.ObjectClass, T.ObjectClass);
1271 CheckOverlap(T.ArrayClass, T.ArrayClass); 1267 CheckOverlap(T.ArrayClass, T.ArrayClass);
1272 CheckDisjoint(T.ObjectClass, T.ArrayClass); 1268 CheckDisjoint(T.ObjectClass, T.ArrayClass);
1273 CheckOverlap(T.SmiConstant, T.SignedSmall); 1269 CheckOverlap(T.SmiConstant, T.SignedSmall);
1274 CheckOverlap(T.SmiConstant, T.Signed32); 1270 CheckOverlap(T.SmiConstant, T.Signed32);
1275 CheckOverlap(T.SmiConstant, T.Number); 1271 CheckOverlap(T.SmiConstant, T.Number);
1276 CheckOverlap(T.ObjectConstant1, T.Object); 1272 CheckOverlap(T.ObjectConstant1, T.Object);
1277 CheckOverlap(T.ObjectConstant2, T.Object); 1273 CheckOverlap(T.ObjectConstant2, T.Object);
1278 CheckOverlap(T.ArrayConstant, T.Object); 1274 CheckOverlap(T.ArrayConstant, T.Object);
1279 CheckOverlap(T.ArrayConstant, T.Array); 1275 CheckOverlap(T.ArrayConstant, T.Array);
1280 CheckOverlap(T.ObjectConstant1, T.ObjectConstant1); 1276 CheckOverlap(T.ObjectConstant1, T.ObjectConstant1);
1281 CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2); 1277 CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2);
1282 CheckDisjoint(T.ObjectConstant1, T.ArrayConstant); 1278 CheckDisjoint(T.ObjectConstant1, T.ArrayConstant);
1283 CheckDisjoint(T.ObjectConstant1, T.ArrayClass); 1279 CheckDisjoint(T.ObjectConstant1, T.ArrayClass);
1284 CheckDisjoint(T.ObjectConstant2, T.ArrayClass); 1280 CheckDisjoint(T.ObjectConstant2, T.ArrayClass);
1285 CheckDisjoint(T.ArrayConstant, T.ObjectClass); 1281 CheckDisjoint(T.ArrayConstant, T.ObjectClass);
1286 CheckOverlap(T.NumberArray, T.Array); 1282 CheckOverlap(T.NumberArray, T.Array);
1287 CheckDisjoint(T.NumberArray, T.AnyArray); 1283 CheckDisjoint(T.NumberArray, T.AnyArray);
1288 CheckDisjoint(T.NumberArray, T.StringArray); 1284 CheckDisjoint(T.NumberArray, T.StringArray);
1289 CheckOverlap(T.MethodFunction, T.Function); 1285 CheckOverlap(T.MethodFunction, T.Object);
1290 CheckDisjoint(T.SignedFunction1, T.NumberFunction1); 1286 CheckDisjoint(T.SignedFunction1, T.NumberFunction1);
1291 CheckDisjoint(T.SignedFunction1, T.NumberFunction2); 1287 CheckDisjoint(T.SignedFunction1, T.NumberFunction2);
1292 CheckDisjoint(T.NumberFunction1, T.NumberFunction2); 1288 CheckDisjoint(T.NumberFunction1, T.NumberFunction2);
1293 CheckDisjoint(T.SignedFunction1, T.MethodFunction); 1289 CheckDisjoint(T.SignedFunction1, T.MethodFunction);
1294 CheckOverlap(T.ObjectConstant1, T.ObjectClass); // !!! 1290 CheckOverlap(T.ObjectConstant1, T.ObjectClass); // !!!
1295 CheckOverlap(T.ObjectConstant2, T.ObjectClass); // !!! 1291 CheckOverlap(T.ObjectConstant2, T.ObjectClass); // !!!
1296 CheckOverlap(T.NumberClass, T.Intersect(T.Number, T.Untagged)); // !!! 1292 CheckOverlap(T.NumberClass, T.Intersect(T.Number, T.Untagged)); // !!!
1297 } 1293 }
1298 1294
1299 void Union1() { 1295 void Union1() {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 // Bitset-array 1445 // Bitset-array
1450 CHECK(this->IsBitset(T.Union(T.AnyArray, T.Array))); 1446 CHECK(this->IsBitset(T.Union(T.AnyArray, T.Array)));
1451 CHECK(this->IsUnion(T.Union(T.NumberArray, T.Number))); 1447 CHECK(this->IsUnion(T.Union(T.NumberArray, T.Number)));
1452 1448
1453 CheckEqual(T.Union(T.AnyArray, T.Array), T.Array); 1449 CheckEqual(T.Union(T.AnyArray, T.Array), T.Array);
1454 CheckUnordered(T.Union(T.AnyArray, T.String), T.Array); 1450 CheckUnordered(T.Union(T.AnyArray, T.String), T.Array);
1455 CheckOverlap(T.Union(T.NumberArray, T.String), T.Object); 1451 CheckOverlap(T.Union(T.NumberArray, T.String), T.Object);
1456 CheckDisjoint(T.Union(T.NumberArray, T.String), T.Number); 1452 CheckDisjoint(T.Union(T.NumberArray, T.String), T.Number);
1457 1453
1458 // Bitset-function 1454 // Bitset-function
1459 CHECK(this->IsBitset(T.Union(T.MethodFunction, T.Function))); 1455 CHECK(this->IsBitset(T.Union(T.MethodFunction, T.Object)));
1460 CHECK(this->IsUnion(T.Union(T.NumberFunction1, T.Number))); 1456 CHECK(this->IsUnion(T.Union(T.NumberFunction1, T.Number)));
1461 1457
1462 CheckEqual(T.Union(T.MethodFunction, T.Function), T.Function); 1458 CheckEqual(T.Union(T.MethodFunction, T.Object), T.Object);
1463 CheckUnordered(T.Union(T.NumberFunction1, T.String), T.Function); 1459 CheckUnordered(T.Union(T.NumberFunction1, T.String), T.Object);
1464 CheckOverlap(T.Union(T.NumberFunction2, T.String), T.Object); 1460 CheckOverlap(T.Union(T.NumberFunction2, T.String), T.Object);
1465 CheckDisjoint(T.Union(T.NumberFunction1, T.String), T.Number); 1461 CheckDisjoint(T.Union(T.NumberFunction1, T.String), T.Number);
1466 1462
1467 // Bitset-class 1463 // Bitset-class
1468 CheckSub( 1464 CheckSub(
1469 T.Union(T.ObjectClass, T.SignedSmall), T.Union(T.Object, T.Number)); 1465 T.Union(T.ObjectClass, T.SignedSmall), T.Union(T.Object, T.Number));
1470 CheckSub(T.Union(T.ObjectClass, T.Array), T.Object); 1466 CheckSub(T.Union(T.ObjectClass, T.Array), T.Object);
1471 CheckUnordered(T.Union(T.ObjectClass, T.String), T.Array); 1467 CheckUnordered(T.Union(T.ObjectClass, T.String), T.Array);
1472 CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object); 1468 CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object);
1473 CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number); 1469 CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 // Array-union 1517 // Array-union
1522 CheckEqual( 1518 CheckEqual(
1523 T.Union(T.AnyArray, T.Union(T.NumberArray, T.AnyArray)), 1519 T.Union(T.AnyArray, T.Union(T.NumberArray, T.AnyArray)),
1524 T.Union(T.AnyArray, T.NumberArray)); 1520 T.Union(T.AnyArray, T.NumberArray));
1525 CheckSub(T.Union(T.AnyArray, T.NumberArray), T.Array); 1521 CheckSub(T.Union(T.AnyArray, T.NumberArray), T.Array);
1526 1522
1527 // Function-union 1523 // Function-union
1528 CheckEqual( 1524 CheckEqual(
1529 T.Union(T.NumberFunction1, T.NumberFunction2), 1525 T.Union(T.NumberFunction1, T.NumberFunction2),
1530 T.Union(T.NumberFunction2, T.NumberFunction1)); 1526 T.Union(T.NumberFunction2, T.NumberFunction1));
1531 CheckSub(T.Union(T.SignedFunction1, T.MethodFunction), T.Function); 1527 CheckSub(T.Union(T.SignedFunction1, T.MethodFunction), T.Object);
1532 1528
1533 // Union-union 1529 // Union-union
1534 CheckEqual( 1530 CheckEqual(
1535 T.Union( 1531 T.Union(
1536 T.Union(T.ObjectConstant2, T.ObjectConstant1), 1532 T.Union(T.ObjectConstant2, T.ObjectConstant1),
1537 T.Union(T.ObjectConstant1, T.ObjectConstant2)), 1533 T.Union(T.ObjectConstant1, T.ObjectConstant2)),
1538 T.Union(T.ObjectConstant2, T.ObjectConstant1)); 1534 T.Union(T.ObjectConstant2, T.ObjectConstant1));
1539 CheckEqual( 1535 CheckEqual(
1540 T.Union( 1536 T.Union(
1541 T.Union(T.Number, T.ArrayClass), 1537 T.Union(T.Number, T.ArrayClass),
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 } 1678 }
1683 } 1679 }
1684 1680
1685 // Bitset-class 1681 // Bitset-class
1686 CheckEqual(T.Intersect(T.ObjectClass, T.Object), T.ObjectClass); 1682 CheckEqual(T.Intersect(T.ObjectClass, T.Object), T.ObjectClass);
1687 CheckEqual(T.Intersect(T.ObjectClass, T.Array), T.None); 1683 CheckEqual(T.Intersect(T.ObjectClass, T.Array), T.None);
1688 CheckEqual(T.Intersect(T.ObjectClass, T.Number), T.None); 1684 CheckEqual(T.Intersect(T.ObjectClass, T.Number), T.None);
1689 1685
1690 // Bitset-array 1686 // Bitset-array
1691 CheckEqual(T.Intersect(T.NumberArray, T.Object), T.NumberArray); 1687 CheckEqual(T.Intersect(T.NumberArray, T.Object), T.NumberArray);
1692 CheckEqual(T.Intersect(T.AnyArray, T.Function), T.None); 1688 CheckEqual(T.Intersect(T.AnyArray, T.Proxy), T.None);
1693 1689
1694 // Bitset-function 1690 // Bitset-function
1695 CheckEqual(T.Intersect(T.MethodFunction, T.Object), T.MethodFunction); 1691 CheckEqual(T.Intersect(T.MethodFunction, T.Object), T.MethodFunction);
1696 CheckEqual(T.Intersect(T.NumberFunction1, T.Array), T.None); 1692 CheckEqual(T.Intersect(T.NumberFunction1, T.Proxy), T.None);
1697 1693
1698 // Bitset-union 1694 // Bitset-union
1699 CheckEqual( 1695 CheckEqual(
1700 T.Intersect(T.Object, T.Union(T.ObjectConstant1, T.ObjectClass)), 1696 T.Intersect(T.Object, T.Union(T.ObjectConstant1, T.ObjectClass)),
1701 T.Union(T.ObjectConstant1, T.ObjectClass)); 1697 T.Union(T.ObjectConstant1, T.ObjectClass));
1702 CHECK( 1698 CHECK(
1703 !T.Intersect(T.Union(T.ArrayClass, T.ObjectConstant1), T.Number) 1699 !T.Intersect(T.Union(T.ArrayClass, T.ObjectConstant1), T.Number)
1704 ->IsInhabited()); 1700 ->IsInhabited());
1705 1701
1706 // Class-constant 1702 // Class-constant
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); 2064 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>();
2069 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); 2065 HeapTests().Convert<Type, Type*, Zone, ZoneRep>();
2070 } 2066 }
2071 2067
2072 2068
2073 TEST(HTypeFromType) { 2069 TEST(HTypeFromType) {
2074 CcTest::InitializeVM(); 2070 CcTest::InitializeVM();
2075 ZoneTests().HTypeFromType(); 2071 ZoneTests().HTypeFromType();
2076 HeapTests().HTypeFromType(); 2072 HeapTests().HTypeFromType();
2077 } 2073 }
OLDNEW
« no previous file with comments | « src/typing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698