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

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

Issue 1219943002: Expose SIMD.Float32x4 type to Javascript. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Back out changes to include/v8.h Created 5 years, 5 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
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/test-heap-profiler.cc » ('j') | 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 98accbc9ff48d54ff0c085c94db63d0f8d7c0636..eba265905a03a8ea5808601c343bcb8ae5e6c0c6 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -239,32 +239,43 @@ TEST(SimdObjects) {
HandleScope sc(isolate);
- Handle<Object> value = factory->NewFloat32x4(1, 2, 3, 4);
+ Handle<Float32x4> value = factory->NewFloat32x4(1, 2, 3, 4);
CHECK(value->IsFloat32x4());
CHECK(value->BooleanValue()); // SIMD values map to true.
-
- Float32x4* float32x4 = *Handle<Float32x4>::cast(value);
- CheckSimdLanes<Float32x4, float, 4>(float32x4);
-
- // Check ToString for SIMD values.
- // TODO(bbudge): Switch to Check* style function to test ToString().
- value = factory->NewFloat32x4(1, 2, 3, 4);
- float32x4 = *Handle<Float32x4>::cast(value);
- std::ostringstream os;
- float32x4->Float32x4Print(os);
- CHECK_EQ("1, 2, 3, 4", os.str());
-
- // Check unusual lane values.
- float32x4->set_lane(0, 0);
- CHECK_EQ(0, float32x4->get_lane(0));
- float32x4->set_lane(1, -0.0);
- CHECK_EQ(-0.0, float32x4->get_lane(1));
+ CHECK_EQ(value->get_lane(0), 1);
+ CHECK_EQ(value->get_lane(1), 2);
+ CHECK_EQ(value->get_lane(2), 3);
+ CHECK_EQ(value->get_lane(3), 4);
+
+ CheckSimdLanes<Float32x4, float, 4>(*value);
+
+ // Check all lanes, and special lane values.
+ value->set_lane(0, 0);
+ CHECK_EQ(0, value->get_lane(0));
+ value->set_lane(1, -0.0);
+ CHECK_EQ(-0.0, value->get_lane(1));
+ CHECK(std::signbit(value->get_lane(1))); // Sign bit is preserved.
float quiet_NaN = std::numeric_limits<float>::quiet_NaN();
float signaling_NaN = std::numeric_limits<float>::signaling_NaN();
- float32x4->set_lane(2, quiet_NaN);
- CHECK(std::isnan(float32x4->get_lane(2)));
- float32x4->set_lane(3, signaling_NaN);
- CHECK(std::isnan(float32x4->get_lane(3)));
+ value->set_lane(2, quiet_NaN);
+ CHECK(std::isnan(value->get_lane(2)));
+ value->set_lane(3, signaling_NaN);
+ CHECK(std::isnan(value->get_lane(3)));
+
+ // Check SIMD value printing.
+ {
+ value = factory->NewFloat32x4(1, 2, 3, 4);
+ std::ostringstream os;
+ value->Float32x4Print(os);
+ CHECK_EQ("1, 2, 3, 4", os.str());
+ }
+ {
+ value = factory->NewFloat32x4(0, -0.0, quiet_NaN, signaling_NaN);
+ std::ostringstream os;
+ value->Float32x4Print(os);
+ // Value printing doesn't preserve signed zeroes.
+ CHECK_EQ("0, 0, NaN, NaN", os.str());
+ }
}
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698