Revision: 18389
Author:   jkumme...@chromium.org
Date:     Fri Dec 20 13:33:20 2013 UTC
Log:      Delete unused TypeInfo class

R=rossb...@chromium.org

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

Modified:
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/arm/macro-assembler-arm.cc
 /branches/bleeding_edge/src/ast.h
 /branches/bleeding_edge/src/codegen.h
 /branches/bleeding_edge/src/conversions.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/ic.h
 /branches/bleeding_edge/src/mips/macro-assembler-mips.cc
 /branches/bleeding_edge/src/property-details.h
 /branches/bleeding_edge/src/stub-cache.cc
 /branches/bleeding_edge/src/type-info.cc
 /branches/bleeding_edge/src/type-info.h
 /branches/bleeding_edge/src/v8conversions.h
 /branches/bleeding_edge/src/v8globals.h
 /branches/bleeding_edge/src/x64/code-stubs-x64.h

=======================================
--- /branches/bleeding_edge/src/api.cc  Fri Dec 20 11:35:53 2013 UTC
+++ /branches/bleeding_edge/src/api.cc  Fri Dec 20 13:33:20 2013 UTC
@@ -2487,13 +2487,7 @@
   i::Handle<i::Object> obj = Utils::OpenHandle(this);
   if (obj->IsSmi()) return true;
   if (obj->IsNumber()) {
-    double value = obj->Number();
-    static const i::DoubleRepresentation minus_zero(-0.0);
-    i::DoubleRepresentation rep(value);
-    if (rep.bits == minus_zero.bits) {
-      return false;
-    }
-    return i::FastI2D(i::FastD2I(value)) == value;
+    return i::IsInt32Double(obj->Number());
   }
   return false;
 }
@@ -2504,12 +2498,10 @@
   if (obj->IsSmi()) return i::Smi::cast(*obj)->value() >= 0;
   if (obj->IsNumber()) {
     double value = obj->Number();
-    static const i::DoubleRepresentation minus_zero(-0.0);
-    i::DoubleRepresentation rep(value);
-    if (rep.bits == minus_zero.bits) {
-      return false;
-    }
-    return i::FastUI2D(i::FastD2UI(value)) == value;
+    return !i::IsMinusZero(value) &&
+           value >= 0 &&
+           value <= i::kMaxUInt32 &&
+           value == i::FastUI2D(i::FastD2UI(value));
   }
   return false;
 }
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Fri Nov 29 20:49:15 2013 UTC +++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Fri Dec 20 13:33:20 2013 UTC
@@ -815,11 +815,11 @@
                           const Register scratch) {
   static const DoubleRepresentation minus_zero(-0.0);
   static const DoubleRepresentation zero(0.0);
-  DoubleRepresentation value(imm);
+  DoubleRepresentation value_rep(imm);
   // Handle special values first.
-  if (value.bits == zero.bits) {
+  if (value_rep == zero) {
     vmov(dst, kDoubleRegZero);
-  } else if (value.bits == minus_zero.bits) {
+  } else if (value_rep == minus_zero) {
     vneg(dst, kDoubleRegZero);
   } else {
     vmov(dst, imm, scratch);
=======================================
--- /branches/bleeding_edge/src/ast.h   Wed Dec 18 11:58:58 2013 UTC
+++ /branches/bleeding_edge/src/ast.h   Fri Dec 20 13:33:20 2013 UTC
@@ -39,7 +39,6 @@
 #include "small-pointer-list.h"
 #include "smart-pointers.h"
 #include "token.h"
-#include "type-info.h" // TODO(rossberg): this should eventually be removed
 #include "types.h"
 #include "utils.h"
 #include "variables.h"
=======================================
--- /branches/bleeding_edge/src/codegen.h       Wed Dec 18 10:40:26 2013 UTC
+++ /branches/bleeding_edge/src/codegen.h       Fri Dec 20 13:33:20 2013 UTC
@@ -30,7 +30,6 @@

 #include "code-stubs.h"
 #include "runtime.h"
-#include "type-info.h"

 // Include the declaration of the architecture defined class CodeGenerator.
// The contract to the shared code is that the the CodeGenerator is a subclass
=======================================
--- /branches/bleeding_edge/src/conversions.h   Fri Jul 19 09:57:35 2013 UTC
+++ /branches/bleeding_edge/src/conversions.h   Fri Dec 20 13:33:20 2013 UTC
@@ -72,7 +72,7 @@
 // The result is unspecified if x is infinite or NaN, or if the rounded
 // integer value is outside the range of type int.
 inline int FastD2I(double x) {
-  return static_cast<int>(x);
+  return static_cast<int32_t>(x);
 }

 inline unsigned int FastD2UI(double x);
=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Dec 18 21:23:56 2013 UTC
+++ /branches/bleeding_edge/src/heap.cc Fri Dec 20 13:33:20 2013 UTC
@@ -49,6 +49,7 @@
 #include "snapshot.h"
 #include "store-buffer.h"
 #include "utils/random-number-generator.h"
+#include "v8conversions.h"
 #include "v8threads.h"
 #include "v8utils.h"
 #include "vm-state-inl.h"
@@ -3688,6 +3689,7 @@
       return kUndefinedValueRootIndex;
   }
 }
+

 Heap::RootListIndex Heap::RootIndexForEmptyExternalArray(
     ElementsKind elementsKind) {
@@ -3723,16 +3725,11 @@
 }


-
-
MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) {
   // We need to distinguish the minus zero value and this cannot be
   // done after conversion to int. Doing this by comparing bit
   // patterns is faster than using fpclassify() et al.
-  static const DoubleRepresentation minus_zero(-0.0);
-
-  DoubleRepresentation rep(value);
-  if (rep.bits == minus_zero.bits) {
+  if (IsMinusZero(value)) {
     return AllocateHeapNumber(-0.0, pretenure);
   }

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Dec 18 17:16:25 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Fri Dec 20 13:33:20 2013 UTC
@@ -1377,7 +1377,7 @@
     HConstant* c = HConstant::cast(value);
     if (c->HasNumberValue()) {
       double double_res = c->DoubleValue();
-      if (TypeInfo::IsInt32Double(double_res)) {
+      if (IsInt32Double(double_res)) {
         return HConstant::New(zone, context,
                               static_cast<int32_t>(double_res),
                               required_representation);
@@ -3794,7 +3794,7 @@
HConstant* c_right = HConstant::cast(right); \ if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \ double double_res = c_left->DoubleValue() op c_right->DoubleValue(); \ - if (TypeInfo::IsInt32Double(double_res)) { \ + if (IsInt32Double(double_res)) { \ return H_CONSTANT_INT(double_res); \ } \ return H_CONSTANT_DOUBLE(double_res); \
@@ -3990,7 +3990,7 @@
     if ((c_left->HasNumberValue() && c_right->HasNumberValue())) {
       if (c_right->DoubleValue() != 0) {
         double double_res = c_left->DoubleValue() / c_right->DoubleValue();
-        if (TypeInfo::IsInt32Double(double_res)) {
+        if (IsInt32Double(double_res)) {
           return H_CONSTANT_INT(double_res);
         }
         return H_CONSTANT_DOUBLE(double_res);
=======================================
--- /branches/bleeding_edge/src/ic.cc   Fri Dec  6 09:52:40 2013 UTC
+++ /branches/bleeding_edge/src/ic.cc   Fri Dec 20 13:33:20 2013 UTC
@@ -35,6 +35,7 @@
 #include "ic-inl.h"
 #include "runtime.h"
 #include "stub-cache.h"
+#include "v8conversions.h"

 namespace v8 {
 namespace internal {
@@ -2674,7 +2675,7 @@
     new_kind = SMI;
   } else if (object->IsHeapNumber()) {
     double value = Handle<HeapNumber>::cast(object)->value();
-    new_kind = TypeInfo::IsInt32Double(value) ? INT32 : NUMBER;
+    new_kind = IsInt32Double(value) ? INT32 : NUMBER;
   } else if (object->IsString() && op() == Token::ADD) {
     new_kind = STRING;
   }
=======================================
--- /branches/bleeding_edge/src/ic.h    Wed Dec  4 09:27:48 2013 UTC
+++ /branches/bleeding_edge/src/ic.h    Fri Dec 20 13:33:20 2013 UTC
@@ -29,12 +29,14 @@
 #define V8_IC_H_

 #include "macro-assembler.h"
-#include "type-info.h"

 namespace v8 {
 namespace internal {


+const int kMaxKeyedPolymorphism = 4;
+
+
 // IC_UTIL_LIST defines all utility functions called from generated
// inline caching code. The argument for the macro, ICU, is the function name.
 #define IC_UTIL_LIST(ICU)                             \
@@ -296,6 +298,12 @@
 };


+enum StringStubFeedback {
+  DEFAULT_STRING_STUB = 0,
+  STRING_INDEX_OUT_OF_BOUNDS = 1
+};
+
+
 class CallICBase: public IC {
  public:
   // ExtraICState bits
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Fri Dec 6 16:23:49 2013 UTC +++ /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Fri Dec 20 13:33:20 2013 UTC
@@ -1228,12 +1228,12 @@
 void MacroAssembler::Move(FPURegister dst, double imm) {
   static const DoubleRepresentation minus_zero(-0.0);
   static const DoubleRepresentation zero(0.0);
-  DoubleRepresentation value(imm);
+  DoubleRepresentation value_rep(imm);
   // Handle special values first.
   bool force_load = dst.is(kDoubleRegZero);
-  if (value.bits == zero.bits && !force_load) {
+  if (value_rep == zero && !force_load) {
     mov_d(dst, kDoubleRegZero);
-  } else if (value.bits == minus_zero.bits && !force_load) {
+  } else if (value_rep == minus_zero && !force_load) {
     neg_d(dst, kDoubleRegZero);
   } else {
     uint32_t lo, hi;
=======================================
--- /branches/bleeding_edge/src/property-details.h Mon Nov 25 14:41:46 2013 UTC +++ /branches/bleeding_edge/src/property-details.h Fri Dec 20 13:33:20 2013 UTC
@@ -113,8 +113,6 @@

static Representation FromKind(Kind kind) { return Representation(kind); }

-  // TODO(rossberg): this should die eventually.
-  static Representation FromType(TypeInfo info);
   static Representation FromType(Handle<Type> type);

   bool Equals(const Representation& other) const {
=======================================
--- /branches/bleeding_edge/src/stub-cache.cc   Fri Dec 13 10:27:19 2013 UTC
+++ /branches/bleeding_edge/src/stub-cache.cc   Fri Dec 20 13:33:20 2013 UTC
@@ -35,6 +35,7 @@
 #include "gdb-jit.h"
 #include "ic-inl.h"
 #include "stub-cache.h"
+#include "type-info.h"
 #include "vm-state-inl.h"

 namespace v8 {
=======================================
--- /branches/bleeding_edge/src/type-info.cc    Wed Dec 18 11:58:58 2013 UTC
+++ /branches/bleeding_edge/src/type-info.cc    Fri Dec 20 13:33:20 2013 UTC
@@ -42,20 +42,6 @@
 namespace internal {


-TypeInfo TypeInfo::FromValue(Handle<Object> value) {
-  if (value->IsSmi()) {
-    return TypeInfo::Smi();
-  } else if (value->IsHeapNumber()) {
-    return TypeInfo::IsInt32Double(HeapNumber::cast(*value)->value())
-        ? TypeInfo::Integer32()
-        : TypeInfo::Double();
-  } else if (value->IsString()) {
-    return TypeInfo::String();
-  }
-  return TypeInfo::Unknown();
-}
-
-
 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code,
                                        Handle<Context> native_context,
                                        Isolate* isolate,
@@ -584,16 +570,6 @@
   ASSERT(*dictionary_ == result);
 #endif
 }
-
-
-Representation Representation::FromType(TypeInfo info) {
-  if (info.IsUninitialized()) return Representation::None();
-  if (info.IsSmi()) return Representation::Smi();
-  if (info.IsInteger32()) return Representation::Integer32();
-  if (info.IsDouble()) return Representation::Double();
-  if (info.IsNumber()) return Representation::Double();
-  return Representation::Tagged();
-}


 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/type-info.h     Wed Dec 18 11:58:58 2013 UTC
+++ /branches/bleeding_edge/src/type-info.h     Fri Dec 20 13:33:20 2013 UTC
@@ -36,189 +36,7 @@
 namespace v8 {
 namespace internal {

-const int kMaxKeyedPolymorphism = 4;
-
-//         Unknown
-//           |   \____________
-//           |                |
-//      Primitive       Non-primitive
-//           |   \_______     |
-//           |           |    |
-//        Number       String |
-//         /   \         |    |
-//    Double  Integer32  |   /
-//        |      |      /   /
-//        |     Smi    /   /
-//        |      |    / __/
-//        Uninitialized.
-
-class TypeInfo {
- public:
-  TypeInfo() : type_(kUninitialized) { }
-
-  static TypeInfo Unknown() { return TypeInfo(kUnknown); }
-  // We know it's a primitive type.
-  static TypeInfo Primitive() { return TypeInfo(kPrimitive); }
-  // We know it's a number of some sort.
-  static TypeInfo Number() { return TypeInfo(kNumber); }
-  // We know it's a signed 32 bit integer.
-  static TypeInfo Integer32() { return TypeInfo(kInteger32); }
-  // We know it's a Smi.
-  static TypeInfo Smi() { return TypeInfo(kSmi); }
-  // We know it's a heap number.
-  static TypeInfo Double() { return TypeInfo(kDouble); }
-  // We know it's a string.
-  static TypeInfo String() { return TypeInfo(kString); }
-  // We know it's an internalized string.
- static TypeInfo InternalizedString() { return TypeInfo(kInternalizedString); }
-  // We know it's a non-primitive (object) type.
-  static TypeInfo NonPrimitive() { return TypeInfo(kNonPrimitive); }
-  // We haven't started collecting info yet.
-  static TypeInfo Uninitialized() { return TypeInfo(kUninitialized); }
-
-  int ToInt() {
-    return type_;
-  }
-
-  static TypeInfo FromInt(int bit_representation) {
-    Type t = static_cast<Type>(bit_representation);
-    ASSERT(t == kUnknown ||
-           t == kPrimitive ||
-           t == kNumber ||
-           t == kInteger32 ||
-           t == kSmi ||
-           t == kDouble ||
-           t == kString ||
-           t == kNonPrimitive);
-    return TypeInfo(t);
-  }
-
-  // Return the weakest (least precise) common type.
-  static TypeInfo Combine(TypeInfo a, TypeInfo b) {
-    return TypeInfo(static_cast<Type>(a.type_ & b.type_));
-  }
-
-
-  // Integer32 is an integer that can be represented as a signed
-  // 32-bit integer. It has to be
-  // in the range [-2^31, 2^31 - 1]. We also have to check for negative 0
-  // as it is not an Integer32.
-  static inline bool IsInt32Double(double value) {
-    const DoubleRepresentation minus_zero(-0.0);
-    DoubleRepresentation rep(value);
-    if (rep.bits == minus_zero.bits) return false;
-    if (value >= kMinInt && value <= kMaxInt &&
-        value == static_cast<int32_t>(value)) {
-      return true;
-    }
-    return false;
-  }
-
-  static TypeInfo FromValue(Handle<Object> value);
-
-  bool Equals(const TypeInfo& other) {
-    return type_ == other.type_;
-  }
-
-  inline bool IsUnknown() {
-    ASSERT(type_ != kUninitialized);
-    return type_ == kUnknown;
-  }
-
-  inline bool IsPrimitive() {
-    ASSERT(type_ != kUninitialized);
-    return ((type_ & kPrimitive) == kPrimitive);
-  }
-
-  inline bool IsNumber() {
-    ASSERT(type_ != kUninitialized);
-    return ((type_ & kNumber) == kNumber);
-  }
-
-  inline bool IsSmi() {
-    ASSERT(type_ != kUninitialized);
-    return ((type_ & kSmi) == kSmi);
-  }
-
-  inline bool IsInternalizedString() {
-    ASSERT(type_ != kUninitialized);
-    return ((type_ & kInternalizedString) == kInternalizedString);
-  }
-
-  inline bool IsNonInternalizedString() {
-    ASSERT(type_ != kUninitialized);
-    return ((type_ & kInternalizedString) == kString);
-  }
-
-  inline bool IsInteger32() {
-    ASSERT(type_ != kUninitialized);
-    return ((type_ & kInteger32) == kInteger32);
-  }
-
-  inline bool IsDouble() {
-    ASSERT(type_ != kUninitialized);
-    return ((type_ & kDouble) == kDouble);
-  }
-
-  inline bool IsString() {
-    ASSERT(type_ != kUninitialized);
-    return ((type_ & kString) == kString);
-  }
-
-  inline bool IsNonPrimitive() {
-    ASSERT(type_ != kUninitialized);
-    return ((type_ & kNonPrimitive) == kNonPrimitive);
-  }
-
-  inline bool IsUninitialized() {
-    return type_ == kUninitialized;
-  }
-
-  const char* ToString() {
-    switch (type_) {
-      case kUnknown: return "Unknown";
-      case kPrimitive: return "Primitive";
-      case kNumber: return "Number";
-      case kInteger32: return "Integer32";
-      case kSmi: return "Smi";
-      case kInternalizedString: return "InternalizedString";
-      case kDouble: return "Double";
-      case kString: return "String";
-      case kNonPrimitive: return "Object";
-      case kUninitialized: return "Uninitialized";
-    }
-    UNREACHABLE();
-    return "Unreachable code";
-  }
-
- private:
-  enum Type {
-    kUnknown = 0,                // 0000000
-    kPrimitive = 0x10,           // 0010000
-    kNumber = 0x11,              // 0010001
-    kInteger32 = 0x13,           // 0010011
-    kSmi = 0x17,                 // 0010111
-    kDouble = 0x19,              // 0011001
-    kString = 0x30,              // 0110000
-    kInternalizedString = 0x32,  // 0110010
-    kNonPrimitive = 0x40,        // 1000000
-    kUninitialized = 0x7f        // 1111111
-  };
-
-  explicit inline TypeInfo(Type t) : type_(t) { }
-
-  Type type_;
-};
-
-
-enum StringStubFeedback {
-  DEFAULT_STRING_STUB = 0,
-  STRING_INDEX_OUT_OF_BOUNDS = 1
-};
-
-
 // Forward declarations.
-class CompilationInfo;
 class ICStub;
 class SmallMapList;

=======================================
--- /branches/bleeding_edge/src/v8conversions.h Mon Nov 18 15:27:14 2013 UTC
+++ /branches/bleeding_edge/src/v8conversions.h Fri Dec 20 13:33:20 2013 UTC
@@ -33,6 +33,24 @@
 namespace v8 {
 namespace internal {

+
+static inline bool IsMinusZero(double value) {
+  static const DoubleRepresentation minus_zero(-0.0);
+  return DoubleRepresentation(value) == minus_zero;
+}
+
+
+// Integer32 is an integer that can be represented as a signed 32-bit
+// integer. It has to be in the range [-2^31, 2^31 - 1].
+// We also have to check for negative 0 as it is not an Integer32.
+static inline bool IsInt32Double(double value) {
+  return !IsMinusZero(value) &&
+         value >= kMinInt &&
+         value <= kMaxInt &&
+         value == FastI2D(FastD2I(value));
+}
+
+
 // Convert from Number object to C integer.
 inline int32_t NumberToInt32(Object* number) {
   if (number->IsSmi()) return Smi::cast(number)->value();
=======================================
--- /branches/bleeding_edge/src/v8globals.h     Tue Nov  5 11:47:11 2013 UTC
+++ /branches/bleeding_edge/src/v8globals.h     Fri Dec 20 13:33:20 2013 UTC
@@ -322,6 +322,9 @@
   double  value;
   int64_t bits;
   DoubleRepresentation(double x) { value = x; }
+  bool operator==(const DoubleRepresentation& other) const {
+    return bits == other.bits;
+  }
 };


=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.h Wed Dec 18 10:40:26 2013 UTC +++ /branches/bleeding_edge/src/x64/code-stubs-x64.h Fri Dec 20 13:33:20 2013 UTC
@@ -29,7 +29,6 @@
 #define V8_X64_CODE_STUBS_X64_H_

 #include "ic-inl.h"
-#include "type-info.h"

 namespace v8 {
 namespace internal {

--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to