Revision: 22860
Author:   [email protected]
Date:     Tue Aug  5 11:27:26 2014 UTC
Log:      Remove unnecesssary auxiliary definitions.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/413983005
http://code.google.com/p/v8/source/detail?r=22860

Modified:
 /branches/bleeding_edge/src/types.cc
 /branches/bleeding_edge/test/cctest/test-types.cc

=======================================
--- /branches/bleeding_edge/src/types.cc        Mon Aug  4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/types.cc        Tue Aug  5 11:27:26 2014 UTC
@@ -248,12 +248,11 @@
   // Fast path for bitsets.
   if (this->IsNone()) return true;
   if (that->IsBitset()) {
-    return (BitsetType::Lub(this) | that->AsBitset()) == that->AsBitset();
+    return BitsetType::Is(BitsetType::Lub(this), that->AsBitset());
   }
if (this->IsBitset() && SEMANTIC(this->AsBitset()) == BitsetType::kNone) { // Bitsets only have non-bitset supertypes along the representation axis.
-    int that_bitset = that->BitsetGlb();
-    return (BitsetType::Is(this->AsBitset(), that_bitset));
+    return BitsetType::Is(this->AsBitset(), that->BitsetGlb());
   }

   if (that->IsClass()) {
@@ -486,7 +485,7 @@
   for (int i = 0; i < current_size; ++i) {
     TypeHandle that = unioned->Get(i);
     if (that->IsBitset()) {
-      if ((bound | that->AsBitset()) == that->AsBitset()) return i;
+      if (BitsetType::Is(bound, that->AsBitset())) return i;
     } else if (that->IsClass() && this->IsClass()) {
       if (*this->AsClass()->Map() == *that->AsClass()->Map()) return i;
     } else if (that->IsConstant() && this->IsConstant()) {
@@ -510,7 +509,6 @@
 int TypeImpl<Config>::ExtendUnion(
     UnionHandle result, int size, TypeHandle type,
     TypeHandle other, bool is_intersect, Region* region) {
-  int old_size = size;
   if (type->IsUnion()) {
     UnionHandle unioned = handle(type->AsUnion());
     for (int i = 0; i < unioned->Length(); ++i) {
@@ -529,7 +527,7 @@
     int new_bound =
is_intersect ? (old_bound & other_bound) : (old_bound | other_bound);
     if (new_bound != BitsetType::kNone) {
-      int i = type->IndexInUnion(new_bound, result, old_size);
+      int i = type->IndexInUnion(new_bound, result, size);
       if (i == -1) {
         i = size++;
       } else if (result->Get(i)->IsBitset()) {
@@ -888,7 +886,7 @@
       BitsetType::Print(os, SEMANTIC(this->AsBitset()));
     } else if (this->IsClass()) {
os << "Class(" << static_cast<void*>(*this->AsClass()->Map()) << " < ";
-      return BitsetType::New(BitsetType::Lub(this))->PrintTo(os, dim);
+      BitsetType::New(BitsetType::Lub(this))->PrintTo(os, dim);
       os << ")";
     } else if (this->IsConstant()) {
       os << "Constant(" << static_cast<void*>(*this->AsConstant()->Value())
=======================================
--- /branches/bleeding_edge/test/cctest/test-types.cc Wed Jul 23 11:17:14 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-types.cc Tue Aug 5 11:27:26 2014 UTC
@@ -19,12 +19,6 @@
return !IsBitset(t) && reinterpret_cast<intptr_t>(AsStruct(t)[0]) == tag;
   }
static bool IsBitset(Type* t) { return reinterpret_cast<intptr_t>(t) & 1; }
-  static bool IsClass(Type* t) { return IsStruct(t, 0); }
-  static bool IsConstant(Type* t) { return IsStruct(t, 1); }
-  static bool IsRange(Type* t) { return IsStruct(t, 2); }
-  static bool IsContext(Type* t) { return IsStruct(t, 3); }
-  static bool IsArray(Type* t) { return IsStruct(t, 4); }
-  static bool IsFunction(Type* t) { return IsStruct(t, 5); }
   static bool IsUnion(Type* t) { return IsStruct(t, 6); }

   static Struct* AsStruct(Type* t) {
@@ -33,15 +27,6 @@
   static int AsBitset(Type* t) {
     return static_cast<int>(reinterpret_cast<intptr_t>(t) >> 1);
   }
-  static Map* AsClass(Type* t) {
-    return *static_cast<Map**>(AsStruct(t)[3]);
-  }
-  static Object* AsConstant(Type* t) {
-    return *static_cast<Object**>(AsStruct(t)[3]);
-  }
-  static Type* AsContext(Type* t) {
-    return *static_cast<Type**>(AsStruct(t)[2]);
-  }
   static Struct* AsUnion(Type* t) {
     return AsStruct(t);
   }
@@ -67,25 +52,10 @@
return t->IsFixedArray() && Smi::cast(AsStruct(t)->get(0))->value() == tag;
   }
   static bool IsBitset(Handle<HeapType> t) { return t->IsSmi(); }
-  static bool IsClass(Handle<HeapType> t) {
-    return t->IsMap() || IsStruct(t, 0);
-  }
-  static bool IsConstant(Handle<HeapType> t) { return IsStruct(t, 1); }
-  static bool IsRange(Handle<HeapType> t) { return IsStruct(t, 2); }
-  static bool IsContext(Handle<HeapType> t) { return IsStruct(t, 3); }
-  static bool IsArray(Handle<HeapType> t) { return IsStruct(t, 4); }
-  static bool IsFunction(Handle<HeapType> t) { return IsStruct(t, 5); }
   static bool IsUnion(Handle<HeapType> t) { return IsStruct(t, 6); }

static Struct* AsStruct(Handle<HeapType> t) { return FixedArray::cast(*t); } static int AsBitset(Handle<HeapType> t) { return Smi::cast(*t)->value(); }
-  static Map* AsClass(Handle<HeapType> t) {
-    return t->IsMap() ? Map::cast(*t) : Map::cast(AsStruct(t)->get(2));
-  }
- static Object* AsConstant(Handle<HeapType> t) { return AsStruct(t)->get(2); }
-  static HeapType* AsContext(Handle<HeapType> t) {
-    return HeapType::cast(AsStruct(t)->get(1));
-  }
   static Struct* AsUnion(Handle<HeapType> t) { return AsStruct(t); }
static int Length(Struct* structured) { return structured->length() - 1; }

@@ -217,7 +187,7 @@
   TypeVector types;
   MapVector maps;
   ValueVector values;
-  DoubleVector doubles;
+  DoubleVector doubles;  // Some floating-point values, excluding NaN.

   TypeHandle Of(Handle<i::Object> value) {
     return Type::Of(value, region_);
@@ -361,27 +331,13 @@

   bool Equal(TypeHandle type1, TypeHandle type2) {
     return
-        type1->Is(type2) && type2->Is(type1) &&
+        type1->Equals(type2) &&
         Rep::IsBitset(type1) == Rep::IsBitset(type2) &&
-        Rep::IsClass(type1) == Rep::IsClass(type2) &&
-        Rep::IsConstant(type1) == Rep::IsConstant(type2) &&
-        Rep::IsRange(type1) == Rep::IsRange(type2) &&
-        Rep::IsContext(type1) == Rep::IsContext(type2) &&
-        Rep::IsArray(type1) == Rep::IsArray(type2) &&
-        Rep::IsFunction(type1) == Rep::IsFunction(type2) &&
         Rep::IsUnion(type1) == Rep::IsUnion(type2) &&
         type1->NumClasses() == type2->NumClasses() &&
         type1->NumConstants() == type2->NumConstants() &&
         (!Rep::IsBitset(type1) ||
           Rep::AsBitset(type1) == Rep::AsBitset(type2)) &&
-        (!Rep::IsClass(type1) ||
-          Rep::AsClass(type1) == Rep::AsClass(type2)) &&
-        (!Rep::IsConstant(type1) ||
-          Rep::AsConstant(type1) == Rep::AsConstant(type2)) &&
-        (!Rep::IsRange(type1) ||
-          (type1->AsRange()->Min() == type2->AsRange()->Min() &&
-           type1->AsRange()->Max() == type2->AsRange()->Max())) &&
-          // TODO(rossberg): Check details of arrays, functions, bounds.
         (!Rep::IsUnion(type1) ||
Rep::Length(Rep::AsUnion(type1)) == Rep::Length(Rep::AsUnion(type2)));
   }
@@ -501,7 +457,7 @@
     for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) {
       Handle<i::Map> map = *mt;
       TypeHandle type = T.Class(map);
-      CHECK(this->IsClass(type));
+      CHECK(type->IsClass());
     }

     // Map attribute
@@ -528,7 +484,7 @@
     for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) {
       Handle<i::Object> value = *vt;
       TypeHandle type = T.Constant(value);
-      CHECK(this->IsConstant(type));
+      CHECK(type->IsConstant());
     }

     // Value attribute
@@ -596,7 +552,7 @@
         double min = std::min(*i, *j);
         double max = std::max(*i, *j);
         TypeHandle type = T.Range(min, max);
-        CHECK(this->IsRange(type));
+        CHECK(type->IsRange());
       }
     }

@@ -641,7 +597,7 @@
     for (int i = 0; i < 20; ++i) {
       TypeHandle type = T.Random();
       TypeHandle array = T.Array1(type);
-      CHECK(this->IsArray(array));
+      CHECK(array->IsArray());
     }

     // Attributes

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to