Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3662)

Unified Diff: src/objects.h

Issue 1153373003: Add new Float32x4 type for SIMD.js. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: A few more tests. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 526f20dd1893d148c339fe53e86917914adfa0ab..74f6035cb04405933ad062cc6425985ab98743e9 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -121,6 +121,7 @@
// - ExternalTwoByteInternalizedString
// - Symbol
// - HeapNumber
+// - Float32x4
// - Cell
// - PropertyCell
// - Code
@@ -394,6 +395,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
\
V(HEAP_NUMBER_TYPE) \
V(MUTABLE_HEAP_NUMBER_TYPE) \
+ V(FLOAT32X4_TYPE) \
V(FOREIGN_TYPE) \
V(BYTE_ARRAY_TYPE) \
V(FREE_SPACE_TYPE) \
@@ -689,6 +691,7 @@ enum InstanceType {
// objects.
HEAP_NUMBER_TYPE,
MUTABLE_HEAP_NUMBER_TYPE,
+ FLOAT32X4_TYPE, // FIRST_SIMD_TYPE, LAST_SIMD_TYPE
FOREIGN_TYPE,
BYTE_ARRAY_TYPE,
FREE_SPACE_TYPE,
@@ -780,6 +783,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 an external array.
FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_INT8_ARRAY_TYPE,
LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE,
@@ -946,6 +952,7 @@ template <class C> inline bool Is(Object* obj);
V(FixedFloat32Array) \
V(FixedFloat64Array) \
V(FixedUint8ClampedArray) \
+ V(Float32x4) \
V(ByteArray) \
V(FreeSpace) \
V(JSReceiver) \
@@ -1607,6 +1614,44 @@ class HeapNumber: public HeapObject {
};
+// The Float32x4 class describes heap allocated SIMD values holding 4 32-bit
+// IEEE floats.
+class Float32x4 : public HeapObject {
+ public:
+ inline double get_lane(int lane) const;
titzer 2015/06/03 13:27:15 I think we should float here too.
bbudge 2015/06/03 20:31:48 Done.
+ inline void set_lane(int lane, double value);
+
+ DECLARE_CAST(Float32x4)
+
+ // Dispatched behavior.
+ bool Float32x4BooleanValue();
+
+ void Float32x4Print(std::ostream& os); // NOLINT
+ DECLARE_VERIFIER(Float32x4)
+
+ // Layout description.
+ static const int kValueOffset = HeapObject::kHeaderSize;
+#if defined(V8_TARGET_LITTLE_ENDIAN)
titzer 2015/06/03 13:27:15 Can we leave these out of the header to force user
bbudge 2015/06/03 20:31:48 Done (I just deleted them, since they're not used
+ static const int kLane0Offset = kValueOffset;
+ static const int kLane1Offset = kValueOffset + 4;
+ static const int kLane2Offset = kValueOffset + 8;
+ static const int kLane3Offset = kValueOffset + 12;
+#elif defined(V8_TARGET_BIG_ENDIAN)
+ static const int kLane0Offset = kValueOffset + 12;
+ static const int kLane1Offset = kValueOffset + 8;
+ static const int kLane2Offset = kValueOffset + 4;
+ static const int kLane3Offset = kValueOffset;
+#else
+#error Unknown byte ordering
+#endif
+
+ static const int kSize = kValueOffset + kSimd128Size;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(Float32x4);
+};
+
+
enum EnsureElementsMode {
DONT_ALLOW_DOUBLE_ELEMENTS,
ALLOW_COPIED_DOUBLE_ELEMENTS,

Powered by Google App Engine
This is Rietveld 408576698