Bug 947711 - Introduce MIRType_Float32x4, MIRType_Int32x4 and MIRType_Doublex2. r=nbp
authorHaitao Feng <haitao.feng@intel.com>
Tue, 28 Jan 2014 09:12:20 -0500
changeset 165609 2d1fd4b1fdaa6c77df8c7509f36409cc791a7bdd
parent 165608 de0e3bff81d55833e83d841a7f9125e67d999cd5
child 165610 722a19e765170a0eccd413cd4de6c0f8b613ac2f
push id4623
push userryanvm@gmail.com
push dateTue, 28 Jan 2014 21:48:39 +0000
treeherderfx-team@7e79536aca0a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs947711
milestone29.0a1
Bug 947711 - Introduce MIRType_Float32x4, MIRType_Int32x4 and MIRType_Doublex2. r=nbp
js/src/jit/IonTypes.h
--- a/js/src/jit/IonTypes.h
+++ b/js/src/jit/IonTypes.h
@@ -57,40 +57,64 @@ BailoutKindString(BailoutKind kind)
       case Bailout_BaselineInfo:
         return "Bailout_BaselineInfo";
       default:
         MOZ_ASSUME_UNREACHABLE("Invalid BailoutKind");
     }
 }
 #endif
 
+static const uint32_t ELEMENT_TYPE_BITS = 4;
+static const uint32_t ELEMENT_TYPE_SHIFT = 0;
+static const uint32_t ELEMENT_TYPE_MASK = (1 << ELEMENT_TYPE_BITS) - 1;
+static const uint32_t VECTOR_SCALE_BITS = 2;
+static const uint32_t VECTOR_SCALE_SHIFT = ELEMENT_TYPE_BITS + ELEMENT_TYPE_SHIFT;
+static const uint32_t VECTOR_SCALE_MASK = (1 << VECTOR_SCALE_BITS) - 1;
+
 // The ordering of this enumeration is important: Anything < Value is a
 // specialized type. Furthermore, anything < String has trivial conversion to
 // a number.
 enum MIRType
 {
     MIRType_Undefined,
     MIRType_Null,
     MIRType_Boolean,
     MIRType_Int32,
     MIRType_Double,
     MIRType_Float32,
     MIRType_String,
     MIRType_Object,
     MIRType_Magic,
     MIRType_Value,
-    MIRType_None,         // Invalid, used as a placeholder.
-    MIRType_Slots,        // A slots vector
-    MIRType_Elements,     // An elements vector
-    MIRType_Pointer,      // An opaque pointer that receives no special treatment
-    MIRType_Shape,        // A Shape pointer.
-    MIRType_ForkJoinSlice // js::ForkJoinSlice*
+    MIRType_None,          // Invalid, used as a placeholder.
+    MIRType_Slots,         // A slots vector
+    MIRType_Elements,      // An elements vector
+    MIRType_Pointer,       // An opaque pointer that receives no special treatment
+    MIRType_Shape,         // A Shape pointer.
+    MIRType_ForkJoinSlice, // js::ForkJoinSlice*
+    MIRType_Last = MIRType_ForkJoinSlice,
+    MIRType_Float32x4 = MIRType_Float32 | (2 << VECTOR_SCALE_SHIFT),
+    MIRType_Int32x4   = MIRType_Int32   | (2 << VECTOR_SCALE_SHIFT),
+    MIRType_Doublex2  = MIRType_Double  | (1 << VECTOR_SCALE_SHIFT)
 };
 
 static inline MIRType
+ElementType(MIRType type)
+{
+    JS_STATIC_ASSERT(MIRType_Last <= ELEMENT_TYPE_MASK);
+    return static_cast<MIRType>((type >> ELEMENT_TYPE_SHIFT) & ELEMENT_TYPE_MASK);
+}
+
+static inline uint32_t
+VectorSize(MIRType type)
+{
+    return 1 << ((type >> VECTOR_SCALE_SHIFT) & VECTOR_SCALE_MASK);
+}
+
+static inline MIRType
 MIRTypeFromValueType(JSValueType type)
 {
     switch (type) {
       case JSVAL_TYPE_DOUBLE:
         return MIRType_Double;
       case JSVAL_TYPE_INT32:
         return MIRType_Int32;
       case JSVAL_TYPE_UNDEFINED: