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

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

Issue 868583002: Revert of Steps towards unification of number bitset and range types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | « test/cctest/compiler/test-js-typed-lowering.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 8f0b98f8042583a118ff8ff1f70a513cde83c26b..ebef527dd0b3a64b019bdcf739e59f9ceef6f73d 100644
--- a/test/cctest/test-types.cc
+++ b/test/cctest/test-types.cc
@@ -136,14 +136,6 @@
}
}
- void CheckSubOrEqual(TypeHandle type1, TypeHandle type2) {
- CHECK(type1->Is(type2));
- if (this->IsBitset(type1) && this->IsBitset(type2)) {
- CHECK((this->AsBitset(type1) | this->AsBitset(type2))
- == this->AsBitset(type2));
- }
- }
-
void CheckUnordered(TypeHandle type1, TypeHandle type2) {
CHECK(!type1->Is(type2));
CHECK(!type2->Is(type1));
@@ -302,33 +294,39 @@
CHECK(T.Constant(fac->NewNumber(0))->Is(T.UnsignedSmall));
CHECK(T.Constant(fac->NewNumber(1))->Is(T.UnsignedSmall));
CHECK(T.Constant(fac->NewNumber(0x3fffffff))->Is(T.UnsignedSmall));
- CHECK(T.Constant(fac->NewNumber(-1))->Is(T.Negative31));
- CHECK(T.Constant(fac->NewNumber(-0x3fffffff))->Is(T.Negative31));
- CHECK(T.Constant(fac->NewNumber(-0x40000000))->Is(T.Negative31));
- CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.Unsigned31));
- CHECK(!T.Constant(fac->NewNumber(0x40000000))->Is(T.Unsigned30));
- CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.Unsigned31));
- CHECK(!T.Constant(fac->NewNumber(0x7fffffff))->Is(T.Unsigned30));
- CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.Negative32));
- CHECK(!T.Constant(fac->NewNumber(-0x40000001))->Is(T.Negative31));
- CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.Negative32));
- CHECK(!T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.Negative31));
+ CHECK(T.Constant(fac->NewNumber(-1))->Is(T.NegativeSignedSmall));
+ CHECK(T.Constant(fac->NewNumber(-0x3fffffff))->Is(T.NegativeSignedSmall));
+ CHECK(T.Constant(fac->NewNumber(-0x40000000))->Is(T.NegativeSignedSmall));
if (SmiValuesAre31Bits()) {
+ CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.NonNegativeSigned32));
CHECK(!T.Constant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall));
+ CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.NonNegativeSigned32));
CHECK(!T.Constant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall));
- CHECK(!T.Constant(fac->NewNumber(-0x40000001))->Is(T.SignedSmall));
- CHECK(!T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.SignedSmall));
+ CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.NegativeSigned32));
+ CHECK(
+ !T.Constant(fac->NewNumber(-0x40000001))->Is(T.NegativeSignedSmall));
+ CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.NegativeSigned32));
+ CHECK(!T.Constant(fac->NewNumber(-0x7fffffff - 1))
+ ->Is(T.NegativeSignedSmall));
} else {
CHECK(SmiValuesAre32Bits());
CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall));
CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall));
- CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.SignedSmall));
- CHECK(T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.SignedSmall));
+ CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.NonNegativeSigned32));
+ CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.NonNegativeSigned32));
+ CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.NegativeSignedSmall));
+ CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.NegativeSignedSmall));
+ CHECK(T.Constant(fac->NewNumber(-0x7fffffff - 1))
+ ->Is(T.NegativeSignedSmall));
+ CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.NegativeSigned32));
+ CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.NegativeSigned32));
+ CHECK(
+ T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.NegativeSigned32));
}
CHECK(T.Constant(fac->NewNumber(0x80000000u))->Is(T.Unsigned32));
- CHECK(!T.Constant(fac->NewNumber(0x80000000u))->Is(T.Unsigned31));
+ CHECK(!T.Constant(fac->NewNumber(0x80000000u))->Is(T.NonNegativeSigned32));
CHECK(T.Constant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned32));
- CHECK(!T.Constant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned31));
+ CHECK(!T.Constant(fac->NewNumber(0xffffffffu))->Is(T.NonNegativeSigned32));
CHECK(T.Constant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.PlainNumber));
CHECK(!T.Constant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.Integral32));
CHECK(T.Constant(fac->NewNumber(-0x7fffffff - 2.0))->Is(T.PlainNumber));
@@ -797,7 +795,6 @@
(type1->IsClass() && type2->IsClass()) ||
(type1->IsConstant() && type2->IsConstant()) ||
(type1->IsConstant() && type2->IsRange()) ||
- (this->IsBitset(type1) && type2->IsRange()) ||
(type1->IsRange() && type2->IsRange()) ||
(type1->IsContext() && type2->IsContext()) ||
(type1->IsArray() && type2->IsArray()) ||
@@ -936,7 +933,7 @@
CheckSub(T.SignedSmall, T.Number);
CheckSub(T.Signed32, T.Number);
- CheckSubOrEqual(T.SignedSmall, T.Signed32);
+ CheckSub(T.SignedSmall, T.Signed32);
CheckUnordered(T.SignedSmall, T.MinusZero);
CheckUnordered(T.Signed32, T.Unsigned32);
@@ -1480,8 +1477,8 @@
CheckDisjoint(T.Union(T.NumberFunction1, T.String), T.Number);
// Bitset-class
- CheckSub(T.Union(T.ObjectClass, T.SignedSmall),
- T.Union(T.Object, T.Number));
+ CheckSub(
+ T.Union(T.ObjectClass, T.SignedSmall), T.Union(T.Object, T.Number));
CheckSub(T.Union(T.ObjectClass, T.Array), T.Object);
CheckUnordered(T.Union(T.ObjectClass, T.String), T.Array);
CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object);
@@ -1551,9 +1548,11 @@
T.Union(T.ObjectConstant2, T.ObjectConstant1),
T.Union(T.ObjectConstant1, T.ObjectConstant2)),
T.Union(T.ObjectConstant2, T.ObjectConstant1));
- CheckEqual(T.Union(T.Union(T.Number, T.ArrayClass),
- T.Union(T.SignedSmall, T.Array)),
- T.Union(T.Number, T.Array));
+ CheckEqual(
+ T.Union(
+ T.Union(T.Number, T.ArrayClass),
+ T.Union(T.SignedSmall, T.Array)),
+ T.Union(T.Number, T.Array));
}
void Intersect() {
@@ -1767,9 +1766,11 @@
->IsInhabited()); // !!!
// Union-union
- CheckEqual(T.Intersect(T.Union(T.Number, T.ArrayClass),
- T.Union(T.SignedSmall, T.Array)),
- T.Union(T.SignedSmall, T.ArrayClass));
+ CheckEqual(
+ T.Intersect(
+ T.Union(T.Number, T.ArrayClass),
+ T.Union(T.SignedSmall, T.Array)),
+ T.Union(T.SignedSmall, T.ArrayClass));
CheckEqual(
T.Intersect(
T.Union(T.Number, T.ObjectClass),
« no previous file with comments | « test/cctest/compiler/test-js-typed-lowering.cc ('k') | test/cctest/types-fuzz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698