Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 9663398ad02bdff4574fc7d91c9c55ab18199187..ee83e3b7a261e6aedce7d333b16e8e7c9f89f0d4 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -113,7 +113,14 @@ |
// - ExternalTwoByteInternalizedString |
// - Symbol |
// - HeapNumber |
-// - Float32x4 |
+// - Simd128Value |
+// - Float32x4 |
+// - Int32x4 |
+// - Bool32x4 |
+// - Int16x8 |
+// - Bool16x8 |
+// - Int8x16 |
+// - Bool8x16 |
// - Cell |
// - PropertyCell |
// - Code |
@@ -370,6 +377,12 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1; |
\ |
V(SYMBOL_TYPE) \ |
V(FLOAT32X4_TYPE) \ |
+ V(INT32X4_TYPE) \ |
+ V(BOOL32X4_TYPE) \ |
+ V(INT16X8_TYPE) \ |
+ V(BOOL16X8_TYPE) \ |
+ V(INT8X16_TYPE) \ |
+ V(BOOL8X16_TYPE) \ |
\ |
V(MAP_TYPE) \ |
V(CODE_TYPE) \ |
@@ -663,12 +676,18 @@ enum InstanceType { |
// objects. |
HEAP_NUMBER_TYPE, |
MUTABLE_HEAP_NUMBER_TYPE, |
- FLOAT32X4_TYPE, // FIRST_SIMD_TYPE, LAST_SIMD_TYPE |
+ FLOAT32X4_TYPE, // FIRST_SIMD_VALUE_TYPE |
+ INT32X4_TYPE, |
+ BOOL32X4_TYPE, |
+ INT16X8_TYPE, |
+ BOOL16X8_TYPE, |
+ INT8X16_TYPE, |
+ BOOL8X16_TYPE, // LAST_SIMD_VALUE_TYPE |
FOREIGN_TYPE, |
BYTE_ARRAY_TYPE, |
BYTECODE_ARRAY_TYPE, |
FREE_SPACE_TYPE, |
- FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE |
+ FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE |
FIXED_UINT8_ARRAY_TYPE, |
FIXED_INT16_ARRAY_TYPE, |
FIXED_UINT16_ARRAY_TYPE, |
@@ -747,9 +766,9 @@ enum InstanceType { |
FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, |
LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, |
FIRST_NONSTRING_TYPE = SYMBOL_TYPE, |
- // Boundaries for testing for a SIMD type. |
- FIRST_SIMD_TYPE = FLOAT32X4_TYPE, |
- LAST_SIMD_TYPE = FLOAT32X4_TYPE, |
+ // Boundaries for testing for a SIMD types. |
+ FIRST_SIMD_VALUE_TYPE = FLOAT32X4_TYPE, |
+ LAST_SIMD_VALUE_TYPE = BOOL8X16_TYPE, |
// Boundaries for testing for a fixed typed array. |
FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, |
LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, |
@@ -882,7 +901,14 @@ template <class C> inline bool Is(Object* obj); |
#define HEAP_OBJECT_TYPE_LIST(V) \ |
V(HeapNumber) \ |
V(MutableHeapNumber) \ |
+ V(Simd128Value) \ |
V(Float32x4) \ |
+ V(Int32x4) \ |
+ V(Bool32x4) \ |
+ V(Int16x8) \ |
+ V(Bool16x8) \ |
+ V(Int8x16) \ |
+ V(Bool8x16) \ |
V(Name) \ |
V(UniqueName) \ |
V(String) \ |
@@ -1578,26 +1604,50 @@ class HeapNumber: public HeapObject { |
}; |
-// The Float32x4 class describes heap allocated SIMD values holding 4 32-bit |
-// IEEE floats. |
-class Float32x4 : public HeapObject { |
+// The SimdValue128 class describes heap allocated 128 bit SIMD values. |
+class Simd128Value : public HeapObject { |
public: |
- inline float get_lane(int lane) const; |
- inline void set_lane(int lane, float value); |
+ DECLARE_CAST(Simd128Value) |
- DECLARE_CAST(Float32x4) |
- |
- // Dispatched behavior. |
- void Float32x4Print(std::ostream& os); // NOLINT |
- DECLARE_VERIFIER(Float32x4) |
+ // Checks that another instance is bit-wise equal. |
+ bool BitwiseEquals(const Simd128Value* other) const; |
+ // Computes a hash from the 128 bit value, viewed as 4 32-bit integers. |
+ uint32_t Hash() const; |
// Layout description. |
static const int kValueOffset = HeapObject::kHeaderSize; |
static const int kSize = kValueOffset + kSimd128Size; |
private: |
- DISALLOW_IMPLICIT_CONSTRUCTORS(Float32x4); |
-}; |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(Simd128Value); |
+}; |
+ |
+ |
+#define SIMD128_TYPES(V) \ |
+ V(Float32x4, float32x4, 4, float) \ |
+ V(Int32x4, int32x4, 4, int32_t) \ |
+ V(Bool32x4, bool32x4, 4, bool) \ |
+ V(Int16x8, int16x8, 8, int16_t) \ |
+ V(Bool16x8, bool16x8, 8, bool) \ |
+ V(Int8x16, int8x16, 16, int8_t) \ |
+ V(Bool8x16, bool8x16, 16, bool) |
+ |
+#define SIMD128_VALUE_CLASS(name, type, lane_count, lane_type) \ |
+ class name : public Simd128Value { \ |
+ public: \ |
+ inline lane_type get_lane(int lane) const; \ |
+ inline void set_lane(int lane, lane_type value); \ |
+ \ |
+ DECLARE_CAST(name) \ |
+ \ |
+ DECLARE_PRINTER(name) \ |
+ DECLARE_VERIFIER(name) \ |
+ \ |
+ private: \ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(name); \ |
+ }; |
+ |
+SIMD128_TYPES(SIMD128_VALUE_CLASS) |
enum EnsureElementsMode { |