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

Unified Diff: src/objects-inl.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-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 4a4b896381066414008ebf673f2672a0abcdd00e..cf42552e28539177f26d372393341847f4089607 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -170,6 +170,7 @@ bool Object::IsHeapObject() const {
TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE)
TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE)
+TYPE_CHECKER(Float32x4, FLOAT32X4_TYPE)
TYPE_CHECKER(Symbol, SYMBOL_TYPE)
@@ -1320,6 +1321,12 @@ MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy,
#define WRITE_INT32_FIELD(p, offset, value) \
(*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)) = value)
+#define READ_FLOAT_FIELD(p, offset) \
+ (*reinterpret_cast<const float*>(FIELD_ADDR_CONST(p, offset)))
+
+#define WRITE_FLOAT_FIELD(p, offset, value) \
+ (*reinterpret_cast<float*>(FIELD_ADDR(p, offset)) = value)
+
#define READ_UINT64_FIELD(p, offset) \
(*reinterpret_cast<const uint64_t*>(FIELD_ADDR_CONST(p, offset)))
@@ -1576,6 +1583,18 @@ int HeapNumber::get_sign() {
}
+double Float32x4::get_lane(int lane) const {
+ DCHECK(lane < 4 && lane >= 0);
titzer 2015/06/03 13:27:15 Looks like we are only supporting little endian fo
bbudge 2015/06/03 20:31:48 I guess there aren't any big-endian media instruct
+ return READ_FLOAT_FIELD(this, kValueOffset + lane * 4);
+}
+
+
+void Float32x4::set_lane(int lane, double value) {
+ DCHECK(lane < 4 && lane >= 0);
+ WRITE_FLOAT_FIELD(this, kValueOffset + lane * 4, DoubleToFloat32(value));
+}
+
+
ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset)
@@ -2433,6 +2452,7 @@ AllocationAlignment HeapObject::RequiredAlignment() {
return kDoubleAligned;
}
if (IsHeapNumber()) return kDoubleUnaligned;
+ if (IsFloat32x4()) return kSimd128Unaligned;
#endif // V8_HOST_ARCH_32_BIT
return kWordAligned;
}
@@ -2973,6 +2993,7 @@ CAST_ACCESSOR(FixedArray)
CAST_ACCESSOR(FixedArrayBase)
CAST_ACCESSOR(FixedDoubleArray)
CAST_ACCESSOR(FixedTypedArrayBase)
+CAST_ACCESSOR(Float32x4)
CAST_ACCESSOR(Foreign)
CAST_ACCESSOR(GlobalDictionary)
CAST_ACCESSOR(GlobalObject)

Powered by Google App Engine
This is Rietveld 408576698