Title: [236684] trunk/JSTests
Revision
236684
Author
[email protected]
Date
2018-10-01 12:40:49 -0700 (Mon, 01 Oct 2018)

Log Message

Split NaN-check into separate test
https://bugs.webkit.org/show_bug.cgi?id=190010

Patch by Dominik Infuehr <[email protected]> on 2018-10-01
Reviewed by Saam Barati.

DataView exposes NaN-representation, which is not necessarily the same on each
architecture. Therefore move the check of the NaN-representation into its own
file such that we can disable this test on MIPS where NaN-representation can be
different on older CPUs.

* stress/dataview-jit-set-nan.js: Added.
(assert):
(test.storeLittleEndian):
(test.storeBigEndian):
(test.store):
(test):
* stress/dataview-jit-set.js:
(test5):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (236683 => 236684)


--- trunk/JSTests/ChangeLog	2018-10-01 19:17:27 UTC (rev 236683)
+++ trunk/JSTests/ChangeLog	2018-10-01 19:40:49 UTC (rev 236684)
@@ -1,3 +1,24 @@
+2018-10-01  Dominik Infuehr  <[email protected]>
+
+        Split NaN-check into separate test
+        https://bugs.webkit.org/show_bug.cgi?id=190010
+
+        Reviewed by Saam Barati.
+
+        DataView exposes NaN-representation, which is not necessarily the same on each
+        architecture. Therefore move the check of the NaN-representation into its own
+        file such that we can disable this test on MIPS where NaN-representation can be
+        different on older CPUs.
+
+        * stress/dataview-jit-set-nan.js: Added.
+        (assert):
+        (test.storeLittleEndian):
+        (test.storeBigEndian):
+        (test.store):
+        (test):
+        * stress/dataview-jit-set.js:
+        (test5):
+
 2018-10-01  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r236647.

Added: trunk/JSTests/stress/dataview-jit-set-nan.js (0 => 236684)


--- trunk/JSTests/stress/dataview-jit-set-nan.js	                        (rev 0)
+++ trunk/JSTests/stress/dataview-jit-set-nan.js	2018-10-01 19:40:49 UTC (rev 236684)
@@ -0,0 +1,52 @@
+//@ skip if $architecture == "mips"
+
+"use strict";
+
+function assert(b) {
+    if (!b)
+        throw new Error;
+}
+
+function test() {
+    function storeLittleEndian(dv, index, value) {
+        dv.setFloat32(index, value, true);
+    }
+    noInline(storeLittleEndian);
+
+    function storeBigEndian(dv, index, value) {
+        dv.setFloat32(index, value, false);
+    }
+    noInline(storeBigEndian);
+
+    function store(dv, index, value, littleEndian) {
+        dv.setFloat32(index, value, littleEndian);
+    }
+    noInline(store);
+
+    let buffer = new ArrayBuffer(4);
+    let arr = new Float32Array(buffer);
+    let bits = new Uint32Array(buffer);
+    let dv = new DataView(buffer);
+
+    for (let i = 0; i < 10000; ++i) {
+        storeLittleEndian(dv, 0, 1.5);
+        assert(arr[0] === 1.5);
+
+        storeLittleEndian(dv, 0, 12912.124123215122);
+        assert(arr[0] === 12912.1240234375);
+        assert(bits[0] === 0x4649c07f);
+
+        storeLittleEndian(dv, 0, NaN);
+        assert(isNaN(arr[0]));
+        assert(bits[0] === 0x7FC00000);
+
+        storeLittleEndian(dv, 0, 2.3879393e-38);
+        assert(arr[0] === 2.387939260590663e-38);
+        assert(bits[0] === 0x01020304);
+
+        storeBigEndian(dv, 0, 2.3879393e-38);
+        assert(arr[0] === 1.539989614439558e-36);
+        assert(bits[0] === 0x04030201);
+    }
+}
+test();
\ No newline at end of file

Modified: trunk/JSTests/stress/dataview-jit-set.js (236683 => 236684)


--- trunk/JSTests/stress/dataview-jit-set.js	2018-10-01 19:17:27 UTC (rev 236683)
+++ trunk/JSTests/stress/dataview-jit-set.js	2018-10-01 19:40:49 UTC (rev 236684)
@@ -314,7 +314,6 @@
 
         storeLittleEndian(dv, 0, NaN);
         assert(isNaN(arr[0]));
-        assert(bits[0] === 0x7FC00000);
 
         storeLittleEndian(dv, 0, 2.3879393e-38);
         assert(arr[0] === 2.387939260590663e-38);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to