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

Unified Diff: test/cctest/test-heap.cc

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
« src/objects-inl.h ('K') | « test/cctest/cctest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 9e3c80ec39b766ec35892dba25cbe134d2b21cc2..0a60964ee8eb044fec0d8a353cc7c3ebd3d6b9b5 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -59,6 +59,7 @@ TEST(HeapMaps) {
Heap* heap = CcTest::heap();
CheckMap(heap->meta_map(), MAP_TYPE, Map::kSize);
CheckMap(heap->heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize);
+ CheckMap(heap->float32x4_map(), FLOAT32X4_TYPE, Float32x4::kSize);
CheckMap(heap->fixed_array_map(), FIXED_ARRAY_TYPE, kVariableSizeSentinel);
CheckMap(heap->string_map(), STRING_TYPE, kVariableSizeSentinel);
}
@@ -183,6 +184,17 @@ TEST(HeapObjects) {
CHECK_EQ(static_cast<double>(static_cast<uint32_t>(1) << 31),
value->Number());
+ value = factory->NewFloat32x4(1, 2, 3, 4);
titzer 2015/06/03 13:27:15 Can we try some more floating point values, and al
bbudge 2015/06/03 20:31:48 Done.
+ CHECK(value->IsFloat32x4());
+ CHECK(value->BooleanValue()); // SIMD values map to true.
+ Float32x4* float32x4 = *Handle<Float32x4>::cast(value);
+ CHECK_EQ(1, float32x4->get_lane(0));
+ CHECK_EQ(2, float32x4->get_lane(1));
+ CHECK_EQ(3, float32x4->get_lane(2));
+ CHECK_EQ(4, float32x4->get_lane(3));
+ float32x4->set_lane(3, 5);
+ CHECK_EQ(5, float32x4->get_lane(3));
+
// nan oddball checks
CHECK(factory->nan_value()->IsNumber());
CHECK(std::isnan(factory->nan_value()->Number()));
« src/objects-inl.h ('K') | « test/cctest/cctest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698