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

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

Issue 795713003: Steps towards unification of number bitset and range types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing review comments. 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
Index: test/cctest/test-types.cc
diff --git a/test/cctest/test-types.cc b/test/cctest/test-types.cc
index ebef527dd0b3a64b019bdcf739e59f9ceef6f73d..18758819cc7d72534c049168b6ec8862f058efc8 100644
--- a/test/cctest/test-types.cc
+++ b/test/cctest/test-types.cc
@@ -294,39 +294,33 @@ struct Tests : Rep {
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.NegativeSignedSmall));
- CHECK(T.Constant(fac->NewNumber(-0x3fffffff))->Is(T.NegativeSignedSmall));
- CHECK(T.Constant(fac->NewNumber(-0x40000000))->Is(T.NegativeSignedSmall));
+ 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));
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.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));
+ CHECK(!T.Constant(fac->NewNumber(-0x40000001))->Is(T.SignedSmall));
+ CHECK(!T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.SignedSmall));
} 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(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(-0x40000001))->Is(T.SignedSmall));
+ CHECK(T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.SignedSmall));
}
CHECK(T.Constant(fac->NewNumber(0x80000000u))->Is(T.Unsigned32));
- CHECK(!T.Constant(fac->NewNumber(0x80000000u))->Is(T.NonNegativeSigned32));
+ CHECK(!T.Constant(fac->NewNumber(0x80000000u))->Is(T.Unsigned31));
CHECK(T.Constant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned32));
- CHECK(!T.Constant(fac->NewNumber(0xffffffffu))->Is(T.NonNegativeSigned32));
+ CHECK(!T.Constant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned31));
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));
@@ -795,6 +789,7 @@ struct Tests : Rep {
(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()) ||
@@ -933,7 +928,7 @@ struct Tests : Rep {
CheckSub(T.SignedSmall, T.Number);
CheckSub(T.Signed32, T.Number);
- CheckSub(T.SignedSmall, T.Signed32);
+ CheckSub(T.Signed31, T.Signed32);
rossberg 2015/01/19 11:43:56 Nit: change this back as well. It's actually impor
CheckUnordered(T.SignedSmall, T.MinusZero);
CheckUnordered(T.Signed32, T.Unsigned32);
@@ -1477,8 +1472,8 @@ struct Tests : Rep {
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);
@@ -1548,11 +1543,9 @@ struct Tests : Rep {
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() {
@@ -1766,11 +1759,9 @@ struct Tests : Rep {
->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),

Powered by Google App Engine
This is Rietveld 408576698