| Index: test/cctest/test-types.cc
|
| diff --git a/test/cctest/test-types.cc b/test/cctest/test-types.cc
|
| index 89fe0e2405896729174937a851ecb7f988bdab73..422843f90e654cad782bad43a316ae0b55372345 100644
|
| --- a/test/cctest/test-types.cc
|
| +++ b/test/cctest/test-types.cc
|
| @@ -12,22 +12,20 @@
|
| using namespace v8::internal;
|
|
|
| // Testing auxiliaries (breaking the Type abstraction).
|
| -typedef uintptr_t bitset;
|
| -
|
| struct ZoneRep {
|
| typedef void* Struct;
|
|
|
| static bool IsStruct(Type* t, int tag) {
|
| return !IsBitset(t) && reinterpret_cast<intptr_t>(AsStruct(t)[0]) == tag;
|
| }
|
| - static bool IsBitset(Type* t) { return reinterpret_cast<bitset>(t) & 1; }
|
| + static bool IsBitset(Type* t) { return reinterpret_cast<intptr_t>(t) & 1; }
|
| static bool IsUnion(Type* t) { return IsStruct(t, 6); }
|
|
|
| static Struct* AsStruct(Type* t) {
|
| return reinterpret_cast<Struct*>(t);
|
| }
|
| - static bitset AsBitset(Type* t) {
|
| - return reinterpret_cast<bitset>(t) ^ 1u;
|
| + static int AsBitset(Type* t) {
|
| + return static_cast<int>(reinterpret_cast<intptr_t>(t) >> 1);
|
| }
|
| static Struct* AsUnion(Type* t) {
|
| return AsStruct(t);
|
| @@ -57,9 +55,7 @@ struct HeapRep {
|
| static bool IsUnion(Handle<HeapType> t) { return IsStruct(t, 6); }
|
|
|
| static Struct* AsStruct(Handle<HeapType> t) { return FixedArray::cast(*t); }
|
| - static bitset AsBitset(Handle<HeapType> t) {
|
| - return reinterpret_cast<bitset>(*t);
|
| - }
|
| + static int AsBitset(Handle<HeapType> t) { return Smi::cast(*t)->value(); }
|
| static Struct* AsUnion(Handle<HeapType> t) { return AsStruct(t); }
|
| static int Length(Struct* structured) { return structured->length() - 1; }
|
|
|
| @@ -70,11 +66,9 @@ struct HeapRep {
|
| using HeapType::BitsetType::Glb;
|
| using HeapType::BitsetType::Lub;
|
| using HeapType::BitsetType::InherentLub;
|
| - static bitset Glb(Handle<HeapType> type) { return Glb(*type); }
|
| - static bitset Lub(Handle<HeapType> type) { return Lub(*type); }
|
| - static bitset InherentLub(Handle<HeapType> type) {
|
| - return InherentLub(*type);
|
| - }
|
| + static int Glb(Handle<HeapType> type) { return Glb(*type); }
|
| + static int Lub(Handle<HeapType> type) { return Lub(*type); }
|
| + static int InherentLub(Handle<HeapType> type) { return InherentLub(*type); }
|
| };
|
| };
|
|
|
| @@ -371,7 +365,7 @@ struct Tests : Rep {
|
| CHECK(type1->Is(type2));
|
| CHECK(!type2->Is(type1));
|
| if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) {
|
| - CHECK(Rep::AsBitset(type1) != Rep::AsBitset(type2));
|
| + CHECK_NE(Rep::AsBitset(type1), Rep::AsBitset(type2));
|
| }
|
| }
|
|
|
| @@ -379,7 +373,7 @@ struct Tests : Rep {
|
| CHECK(!type1->Is(type2));
|
| CHECK(!type2->Is(type1));
|
| if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) {
|
| - CHECK(Rep::AsBitset(type1) != Rep::AsBitset(type2));
|
| + CHECK_NE(Rep::AsBitset(type1), Rep::AsBitset(type2));
|
| }
|
| }
|
|
|
| @@ -387,8 +381,8 @@ struct Tests : Rep {
|
| CHECK(type1->Maybe(type2));
|
| CHECK(type2->Maybe(type1));
|
| if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) {
|
| - CHECK(0 !=
|
| - (Rep::AsBitset(type1) & Rep::AsBitset(type2) & Rep::AsBitset(mask)));
|
| + CHECK_NE(0,
|
| + Rep::AsBitset(type1) & Rep::AsBitset(type2) & Rep::AsBitset(mask));
|
| }
|
| }
|
|
|
| @@ -398,8 +392,8 @@ struct Tests : Rep {
|
| CHECK(!type1->Maybe(type2));
|
| CHECK(!type2->Maybe(type1));
|
| if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) {
|
| - CHECK(0 ==
|
| - (Rep::AsBitset(type1) & Rep::AsBitset(type2) & Rep::AsBitset(mask)));
|
| + CHECK_EQ(0,
|
| + Rep::AsBitset(type1) & Rep::AsBitset(type2) & Rep::AsBitset(mask));
|
| }
|
| }
|
|
|
| @@ -408,16 +402,8 @@ struct Tests : Rep {
|
| CHECK(this->IsBitset(T.None));
|
| CHECK(this->IsBitset(T.Any));
|
|
|
| - CHECK(bitset(0) == this->AsBitset(T.None));
|
| - printf("[BitSet] value=%p enum=%p bitset=%p any=%p this=%p any=%p\n",
|
| - reinterpret_cast<void*>(bitset(0xfffffffeu)),
|
| - reinterpret_cast<void*>(bitset(HeapType::BitsetType::kAny)),
|
| - reinterpret_cast<void*>(
|
| - HeapTypeConfig::from_bitset(HeapType::BitsetType::kAny)),
|
| - reinterpret_cast<void*>(HeapType::Any()),
|
| - reinterpret_cast<void*>(this->AsBitset(T.Any)),
|
| - reinterpret_cast<void*>(*T.Any));
|
| - CHECK(bitset(0xfffffffeu) == this->AsBitset(T.Any));
|
| + CHECK_EQ(0, this->AsBitset(T.None));
|
| + CHECK_EQ(-1, this->AsBitset(T.Any));
|
|
|
| // Union(T1, T2) is bitset for bitsets T1,T2
|
| for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) {
|
| @@ -459,8 +445,8 @@ struct Tests : Rep {
|
| TypeHandle type2 = *it2;
|
| TypeHandle union12 = T.Union(type1, type2);
|
| if (this->IsBitset(type1) && this->IsBitset(type2)) {
|
| - CHECK(
|
| - (this->AsBitset(type1) | this->AsBitset(type2)) ==
|
| + CHECK_EQ(
|
| + this->AsBitset(type1) | this->AsBitset(type2),
|
| this->AsBitset(union12));
|
| }
|
| }
|
| @@ -473,8 +459,8 @@ struct Tests : Rep {
|
| TypeHandle type2 = *it2;
|
| TypeHandle intersect12 = T.Intersect(type1, type2);
|
| if (this->IsBitset(type1) && this->IsBitset(type2)) {
|
| - CHECK(
|
| - (this->AsBitset(type1) & this->AsBitset(type2)) ==
|
| + CHECK_EQ(
|
| + this->AsBitset(type1) & this->AsBitset(type2),
|
| this->AsBitset(intersect12));
|
| }
|
| }
|
| @@ -1831,7 +1817,7 @@ typedef Tests<HeapType, Handle<HeapType>, Isolate, HeapRep> HeapTests;
|
|
|
| TEST(BitsetType) {
|
| CcTest::InitializeVM();
|
| -// ZoneTests().Bitset();
|
| + ZoneTests().Bitset();
|
| HeapTests().Bitset();
|
| }
|
|
|
|
|