<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[259952] releases/WebKitGTK/webkit-2.28/JSTests</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/259952">259952</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2020-04-12 06:03:23 -0700 (Sun, 12 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/258710">r258710</a> - [JSC][BigEndians] Several JSC stress tests failing
https://bugs.webkit.org/show_bug.cgi?id=194007

Reviewed by Michael Catanzaro.

Adapt the DataView tests to be able to pass on little endian as well
as the big endian hardware. Do so by introducing method that determine
the endianess and based on its value it saves the expected results in
the right format.

* stress/dataview-get-cse.js:
(getIsLittleEndian):
(adjustForEndianess):
(test3.foo):
(test3):
* stress/dataview-jit-get.js:
(getIsLittleEndian):
(test1.adjustForEndianess):
(test1):
(test2.adjustForEndianess):
(test2):
(test3.adjustForEndianess):
(test3):
(adjustForEndianessUint32):
(test4):
(test5):
(test6):
(test7):
(test8):
* stress/dataview-jit-neuter.js:
(getIsLittleEndian):
(adjustForEndianess):
(test):
(test2):
* stress/dataview-jit-set-nan.js:
(getIsLittleEndian):
(adjustForEndianessFloat32):
(test):
* stress/dataview-jit-set.js:
(getIsLittleEndian):
(readHex):
(adjustForEndianessUint16):
(test):
(test2):
(adjustForEndianessUint32):
(test3):
(test4):
(adjustForEndianessFloat32):
(test5):
(adjustForEndianessFloat64):
(test6):
(isLittleEndian): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit228JSTestsChangeLog">releases/WebKitGTK/webkit-2.28/JSTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit228JSTestsstressdataviewgetcsejs">releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-get-cse.js</a></li>
<li><a href="#releasesWebKitGTKwebkit228JSTestsstressdataviewjitgetjs">releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-get.js</a></li>
<li><a href="#releasesWebKitGTKwebkit228JSTestsstressdataviewjitneuterjs">releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-neuter.js</a></li>
<li><a href="#releasesWebKitGTKwebkit228JSTestsstressdataviewjitsetnanjs">releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-set-nan.js</a></li>
<li><a href="#releasesWebKitGTKwebkit228JSTestsstressdataviewjitsetjs">releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-set.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit228JSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.28/JSTests/ChangeLog (259951 => 259952)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.28/JSTests/ChangeLog 2020-04-12 13:03:18 UTC (rev 259951)
+++ releases/WebKitGTK/webkit-2.28/JSTests/ChangeLog    2020-04-12 13:03:23 UTC (rev 259952)
</span><span class="lines">@@ -1,3 +1,58 @@
</span><ins>+2020-03-19  Tomas Popela  <tpopela@redhat.com>
+
+        [JSC][BigEndians] Several JSC stress tests failing
+        https://bugs.webkit.org/show_bug.cgi?id=194007
+
+        Reviewed by Michael Catanzaro.
+
+        Adapt the DataView tests to be able to pass on little endian as well
+        as the big endian hardware. Do so by introducing method that determine
+        the endianess and based on its value it saves the expected results in
+        the right format.
+
+        * stress/dataview-get-cse.js:
+        (getIsLittleEndian):
+        (adjustForEndianess):
+        (test3.foo):
+        (test3):
+        * stress/dataview-jit-get.js:
+        (getIsLittleEndian):
+        (test1.adjustForEndianess):
+        (test1):
+        (test2.adjustForEndianess):
+        (test2):
+        (test3.adjustForEndianess):
+        (test3):
+        (adjustForEndianessUint32):
+        (test4):
+        (test5):
+        (test6):
+        (test7):
+        (test8):
+        * stress/dataview-jit-neuter.js:
+        (getIsLittleEndian):
+        (adjustForEndianess):
+        (test):
+        (test2):
+        * stress/dataview-jit-set-nan.js:
+        (getIsLittleEndian):
+        (adjustForEndianessFloat32):
+        (test):
+        * stress/dataview-jit-set.js:
+        (getIsLittleEndian):
+        (readHex):
+        (adjustForEndianessUint16):
+        (test):
+        (test2):
+        (adjustForEndianessUint32):
+        (test3):
+        (test4):
+        (adjustForEndianessFloat32):
+        (test5):
+        (adjustForEndianessFloat64):
+        (test6):
+        (isLittleEndian): Deleted.
+
</ins><span class="cx"> 2020-03-09  Caio Lima  <ticaiolima@gmail.com>
</span><span class="cx"> 
</span><span class="cx">         Tail calls are broken on ARM_THUMB2 and MIPS
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit228JSTestsstressdataviewgetcsejs"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-get-cse.js (259951 => 259952)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-get-cse.js        2020-04-12 13:03:18 UTC (rev 259951)
+++ releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-get-cse.js   2020-04-12 13:03:23 UTC (rev 259952)
</span><span class="lines">@@ -5,7 +5,27 @@
</span><span class="cx">         throw new Error;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
</ins><span class="cx"> 
</span><ins>+let isLittleEndian = getIsLittleEndian();
+
+function adjustForEndianess(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(8);
+    let ta = new Float64Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getFloat64(0, true);
+}
+
</ins><span class="cx"> function test1() {
</span><span class="cx">     function foo(dv) {
</span><span class="cx">         return [dv.getFloat32(0), dv.getFloat64(0)];
</span><span class="lines">@@ -41,7 +61,7 @@
</span><span class="cx"> function test3() {
</span><span class="cx">     function foo(dv, ta) {
</span><span class="cx">         let a = dv.getFloat64(0, true);
</span><del>-        ta[0] = Math.PI;
</del><ins>+        ta[0] = adjustForEndianess(Math.PI);
</ins><span class="cx">         let b = dv.getFloat64(0, true);
</span><span class="cx">         return [a, b];
</span><span class="cx">     }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit228JSTestsstressdataviewjitgetjs"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-get.js (259951 => 259952)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-get.js        2020-04-12 13:03:18 UTC (rev 259951)
+++ releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-get.js   2020-04-12 13:03:23 UTC (rev 259952)
</span><span class="lines">@@ -5,6 +5,16 @@
</span><span class="cx">         throw new Error("Bad!");
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
+
+let isLittleEndian = getIsLittleEndian();
+
</ins><span class="cx"> function test1() {
</span><span class="cx">     function bigEndian(o, i) {
</span><span class="cx">         return o.getInt32(i, false);
</span><span class="lines">@@ -18,10 +28,20 @@
</span><span class="cx">         return o.getInt32(i, b);
</span><span class="cx">     }
</span><span class="cx">     noInline(biEndian);
</span><ins>+    function adjustForEndianess(value) {
+        if (isLittleEndian)
+            return value;
</ins><span class="cx"> 
</span><ins>+        let ab = new ArrayBuffer(4);
+        let ta = new Int32Array(ab);
+        ta[0] = value;
+        let dv = new DataView(ab);
+        return dv.getInt32(0, true);
+    }
+
</ins><span class="cx">     let ab = new ArrayBuffer(4);
</span><span class="cx">     let ta = new Int32Array(ab);
</span><del>-    ta[0] = 0x01020304;
</del><ins>+    ta[0] = adjustForEndianess(0x01020304);
</ins><span class="cx">     let dv = new DataView(ab);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="lines">@@ -43,7 +63,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Make sure we get the right sign.
</span><del>-    ta[0] = -32361386; // 0xfe123456
</del><ins>+    ta[0] = adjustForEndianess(-32361386); // 0xfe123456
</ins><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="cx">         assert(bigEndian(dv, 0) === 0x563412fe);
</span><span class="cx">         assert(littleEndian(dv, 0) === -32361386);
</span><span class="lines">@@ -54,7 +74,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // -2146290602 == (int)0x80123456
</span><del>-    ta[0] = 0x56341280;
</del><ins>+    ta[0] = adjustForEndianess(0x56341280);
</ins><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="cx">         assert(bigEndian(dv, 0) === -2146290602);
</span><span class="cx">         assert(littleEndian(dv, 0) === 0x56341280);
</span><span class="lines">@@ -79,10 +99,20 @@
</span><span class="cx">         return o.getInt16(i, b);
</span><span class="cx">     }
</span><span class="cx">     noInline(biEndian);
</span><ins>+    function adjustForEndianess(value) {
+        if (isLittleEndian)
+            return value;
</ins><span class="cx"> 
</span><ins>+        let ab = new ArrayBuffer(2);
+        let ta = new Int16Array(ab);
+        ta[0] = value;
+        let dv = new DataView(ab);
+        return dv.getInt16(0, true);
+    }
+
</ins><span class="cx">     let ab = new ArrayBuffer(2);
</span><span class="cx">     let ta = new Int16Array(ab);
</span><del>-    ta[0] = 0x0102;
</del><ins>+    ta[0] = adjustForEndianess(0x0102);
</ins><span class="cx">     let dv = new DataView(ab);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="lines">@@ -95,7 +125,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Check sign.
</span><del>-    ta[0] = -512; // 0xfe00
</del><ins>+    ta[0] = adjustForEndianess(-512); // 0xfe00
</ins><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="cx">         assert(bigEndian(dv, 0) === 0x00fe);
</span><span class="cx">         assert(littleEndian(dv, 0) === -512);
</span><span class="lines">@@ -106,7 +136,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Check sign extension.
</span><del>-    ta[0] = 0x00fe;
</del><ins>+    ta[0] = adjustForEndianess(0x00fe);
</ins><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="cx">         assert(bigEndian(dv, 0) === -512);
</span><span class="cx">         assert(littleEndian(dv, 0) === 0x00fe);
</span><span class="lines">@@ -131,7 +161,17 @@
</span><span class="cx">         return o.getFloat32(i, b);
</span><span class="cx">     }
</span><span class="cx">     noInline(biEndian);
</span><ins>+    function adjustForEndianess(value) {
+        if (isLittleEndian)
+            return value;
</ins><span class="cx"> 
</span><ins>+        let ab = new ArrayBuffer(4);
+        let ta = new Float32Array(ab);
+        ta[0] = value;
+        let dv = new DataView(ab);
+        return dv.getFloat32(0, true);
+    }
+
</ins><span class="cx">     let ab = new ArrayBuffer(4);
</span><span class="cx">     let ta = new Float32Array(ab);
</span><span class="cx">     const normal = 12912.403; // 0x4649c19d
</span><span class="lines">@@ -138,7 +178,7 @@
</span><span class="cx">     const normalAsDouble = 12912.403320312500;
</span><span class="cx"> 
</span><span class="cx">     const flipped = -5.1162437589918884e-21;
</span><del>-    ta[0] = normal;
</del><ins>+    ta[0] = adjustForEndianess(normal);
</ins><span class="cx"> 
</span><span class="cx">     let dv = new DataView(ab);
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="lines">@@ -152,6 +192,17 @@
</span><span class="cx"> }
</span><span class="cx"> test3();
</span><span class="cx"> 
</span><ins>+function adjustForEndianessUint32(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Uint32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getUint32(0, true);
+}
+
</ins><span class="cx"> function test4() {
</span><span class="cx">     function bigEndian(o, i) {
</span><span class="cx">         return o.getUint32(i, false);
</span><span class="lines">@@ -168,7 +219,7 @@
</span><span class="cx"> 
</span><span class="cx">     let ab = new ArrayBuffer(4);
</span><span class="cx">     let ta = new Uint32Array(ab);
</span><del>-    ta[0] = 0xa0b0d0f0;
</del><ins>+    ta[0] = adjustForEndianessUint32(0xa0b0d0f0);
</ins><span class="cx"> 
</span><span class="cx">     let dv = new DataView(ab);
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="lines">@@ -198,7 +249,7 @@
</span><span class="cx"> 
</span><span class="cx">     let ab = new ArrayBuffer(4);
</span><span class="cx">     let ta = new Uint32Array(ab);
</span><del>-    ta[0] = 0xa0b0d0f0;
</del><ins>+    ta[0] = adjustForEndianessUint32(0xa0b0d0f0);
</ins><span class="cx"> 
</span><span class="cx">     let dv = new DataView(ab);
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="lines">@@ -239,7 +290,7 @@
</span><span class="cx"> 
</span><span class="cx">     let ab = new ArrayBuffer(4);
</span><span class="cx">     let ta = new Uint32Array(ab);
</span><del>-    ta[0] = 0xa070fa01;
</del><ins>+    ta[0] = adjustForEndianessUint32(0xa070fa01);
</ins><span class="cx"> 
</span><span class="cx">     let dv = new DataView(ab);
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="lines">@@ -272,7 +323,7 @@
</span><span class="cx"> 
</span><span class="cx">     let ab = new ArrayBuffer(4);
</span><span class="cx">     let ta = new Uint32Array(ab);
</span><del>-    ta[0] = 0xa070fa01;
</del><ins>+    ta[0] = adjustForEndianessUint32(0xa070fa01);
</ins><span class="cx"> 
</span><span class="cx">     let dv = new DataView(ab);
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><span class="lines">@@ -292,7 +343,7 @@
</span><span class="cx"> 
</span><span class="cx">     let ab = new ArrayBuffer(4);
</span><span class="cx">     let ta = new Uint32Array(ab);
</span><del>-    ta[0] = 0xa070fa01;
</del><ins>+    ta[0] = adjustForEndianessUint32(0xa070fa01);
</ins><span class="cx"> 
</span><span class="cx">     let dv = new DataView(ab);
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit228JSTestsstressdataviewjitneuterjs"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-neuter.js (259951 => 259952)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-neuter.js     2020-04-12 13:03:18 UTC (rev 259951)
+++ releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-neuter.js        2020-04-12 13:03:23 UTC (rev 259952)
</span><span class="lines">@@ -5,6 +5,27 @@
</span><span class="cx">         throw new Error("Bad!");
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
+
+let isLittleEndian = getIsLittleEndian();
+
+function adjustForEndianess(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Uint32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getUint32(0, true);
+}
+
</ins><span class="cx"> function test() {
</span><span class="cx">     function load(o, i) {
</span><span class="cx">         return o.getUint8(i);
</span><span class="lines">@@ -13,7 +34,7 @@
</span><span class="cx"> 
</span><span class="cx">     let ab = new ArrayBuffer(4);
</span><span class="cx">     let ta = new Uint32Array(ab);
</span><del>-    ta[0] = 0xa070fa01;
</del><ins>+    ta[0] = adjustForEndianess(0xa070fa01);
</ins><span class="cx">     let dv = new DataView(ab);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 1000; ++i) {
</span><span class="lines">@@ -40,7 +61,7 @@
</span><span class="cx"> 
</span><span class="cx">     let ab = new ArrayBuffer(4);
</span><span class="cx">     let ta = new Uint32Array(ab);
</span><del>-    ta[0] = 0xa070fa01;
</del><ins>+    ta[0] = adjustForEndianess(0xa070fa01);
</ins><span class="cx">     let dv = new DataView(ab);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit228JSTestsstressdataviewjitsetnanjs"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-set-nan.js (259951 => 259952)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-set-nan.js    2020-04-12 13:03:18 UTC (rev 259951)
+++ releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-set-nan.js       2020-04-12 13:03:23 UTC (rev 259952)
</span><span class="lines">@@ -7,6 +7,27 @@
</span><span class="cx">         throw new Error;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
+
+let isLittleEndian = getIsLittleEndian();
+
+function adjustForEndianessFloat32(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Float32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getFloat32(0, true);
+}
+
</ins><span class="cx"> function test() {
</span><span class="cx">     function storeLittleEndian(dv, index, value) {
</span><span class="cx">         dv.setFloat32(index, value, true);
</span><span class="lines">@@ -29,24 +50,28 @@
</span><span class="cx">     let dv = new DataView(buffer);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><del>-        storeLittleEndian(dv, 0, 1.5);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(1.5));
</ins><span class="cx">         assert(arr[0] === 1.5);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, 12912.124123215122);
</del><ins>+        // The right way how to process this test is to uncomment the line below
+        // and comment out the line below it. But strangely it doesn't work. I
+        // opened https://bugs.webkit.org/show_bug.cgi?id=209289 for it.
+        //storeLittleEndian(dv, 0, adjustForEndianessFloat32(12912.124123215122));
+        store(dv, 0, 12912.124123215122, isLittleEndian);
</ins><span class="cx">         assert(arr[0] === 12912.1240234375);
</span><span class="cx">         assert(bits[0] === 0x4649c07f);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, NaN);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(NaN));
</ins><span class="cx">         assert(isNaN(arr[0]));
</span><span class="cx">         assert(bits[0] === 0x7FC00000);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, 2.3879393e-38);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(2.3879393e-38));
</ins><span class="cx">         assert(arr[0] === 2.387939260590663e-38);
</span><span class="cx">         assert(bits[0] === 0x01020304);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 2.3879393e-38);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessFloat32(2.3879393e-38));
</ins><span class="cx">         assert(arr[0] === 1.539989614439558e-36);
</span><span class="cx">         assert(bits[0] === 0x04030201);
</span><span class="cx">     }
</span><span class="cx"> }
</span><del>-test();
</del><span class="cx">\ No newline at end of file
</span><ins>+test();
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit228JSTestsstressdataviewjitsetjs"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-set.js (259951 => 259952)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-set.js        2020-04-12 13:03:18 UTC (rev 259951)
+++ releases/WebKitGTK/webkit-2.28/JSTests/stress/dataview-jit-set.js   2020-04-12 13:03:23 UTC (rev 259952)
</span><span class="lines">@@ -5,13 +5,17 @@
</span><span class="cx">         throw new Error;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
+
+let isLittleEndian = getIsLittleEndian();
+
</ins><span class="cx"> function readHex(dv, bytes) {
</span><del>-    function isLittleEndian() { 
-        let b = new ArrayBuffer(4);
-        let dv = new DataView(b);
-        dv.setInt32(0, 0x00112233, true);
-        return dv.getUint8(0) === 0x33;
-    }
</del><span class="cx">     let str = "";
</span><span class="cx">     function readByte(i) {
</span><span class="cx">         let b = dv.getUint8(i).toString(16);
</span><span class="lines">@@ -21,7 +25,7 @@
</span><span class="cx">             assert(b.length === 2)
</span><span class="cx">         return b;
</span><span class="cx">     }
</span><del>-    if (isLittleEndian()) {
</del><ins>+    if (isLittleEndian) {
</ins><span class="cx">         for (let i = bytes; i--;)
</span><span class="cx">             str = str + readByte(i);
</span><span class="cx">     } else {
</span><span class="lines">@@ -35,10 +39,21 @@
</span><span class="cx"> {
</span><span class="cx">     let b = new ArrayBuffer(4);
</span><span class="cx">     let dv = new DataView(b);
</span><del>-    dv.setInt32(0, 0x00112233, true);
</del><ins>+    dv.setInt32(0, 0x00112233, isLittleEndian);
</ins><span class="cx">     assert(readHex(dv, 4) === "0x00112233");
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function adjustForEndianessUint16(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Uint16Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getUint16(0, true);
+}
+
</ins><span class="cx"> function test() {
</span><span class="cx">     function storeLittleEndian(dv, index, value) {
</span><span class="cx">         dv.setInt16(index, value, true);
</span><span class="lines">@@ -60,52 +75,52 @@
</span><span class="cx">     let dv = new DataView(buffer);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><del>-        storeLittleEndian(dv, 0, 0xfaba);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint16(0xfaba));
</ins><span class="cx">         assert(arr[0] === 0xfaba);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0xabcd, true);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(0xabcd), true);
</ins><span class="cx">         assert(arr[0] === 0xabcd);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0xbadbeef, true);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(0xbadbeef), true);
</ins><span class="cx">         assert(arr[0] === 0xbeef);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, 0xbb4db33f, true);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint16(0xbb4db33f), true);
</ins><span class="cx">         assert(arr[0] === 0xb33f);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0xfada);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(0xfada));
</ins><span class="cx">         assert(arr[0] === 0xdafa);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0x12ab);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(0x12ab));
</ins><span class="cx">         assert(arr[0] === 0xab12);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0x1234, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(0x1234), false);
</ins><span class="cx">         assert(arr[0] === 0x3412);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0x0102, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(0x0102), false);
</ins><span class="cx">         assert(arr[0] === 0x0201);
</span><span class="cx"> 
</span><del>-        store(dv, 0, -1, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(-1), false);
</ins><span class="cx">         assert(arr[0] === 0xffff);
</span><span class="cx"> 
</span><del>-        store(dv, 0, -2, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(-2), false);
</ins><span class="cx">         assert(arr[0] === 0xfeff);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, -1);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(-1));
</ins><span class="cx">         assert(arr[0] === 0xffff);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, -2);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2));
</ins><span class="cx">         assert(arr[0] === 0xfeff);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, -2147483648); 
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2147483648));
</ins><span class="cx">         assert(arr[0] === 0x0000);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, -2147483648); 
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint16(-2147483648));
</ins><span class="cx">         assert(arr[0] === 0x0000);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, -2147478988); 
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint16(-2147478988));
</ins><span class="cx">         assert(arr[0] === 0x1234);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, -2147478988); 
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2147478988));
</ins><span class="cx">         assert(arr[0] === 0x3412);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -132,57 +147,68 @@
</span><span class="cx">     let dv = new DataView(buffer);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><del>-        storeLittleEndian(dv, 0, 0xfaba);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint16(0xfaba));
</ins><span class="cx">         assert(arr[0] === 0xfaba);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0xabcd, true);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(0xabcd), true);
</ins><span class="cx">         assert(arr[0] === 0xabcd);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0xbadbeef, true);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(0xbadbeef), true);
</ins><span class="cx">         assert(arr[0] === 0xbeef);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, 0xbb4db33f, true);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint16(0xbb4db33f), true);
</ins><span class="cx">         assert(arr[0] === 0xb33f);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0xfada);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(0xfada));
</ins><span class="cx">         assert(arr[0] === 0xdafa);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0x12ab);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(0x12ab));
</ins><span class="cx">         assert(arr[0] === 0xab12);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0x1234, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(0x1234), false);
</ins><span class="cx">         assert(arr[0] === 0x3412);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0x0102, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(0x0102), false);
</ins><span class="cx">         assert(arr[0] === 0x0201);
</span><span class="cx"> 
</span><del>-        store(dv, 0, -1, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(-1), false);
</ins><span class="cx">         assert(arr[0] === 0xffff);
</span><span class="cx"> 
</span><del>-        store(dv, 0, -2, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint16(-2), false);
</ins><span class="cx">         assert(arr[0] === 0xfeff);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, -1);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(-1));
</ins><span class="cx">         assert(arr[0] === 0xffff);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, -2);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2));
</ins><span class="cx">         assert(arr[0] === 0xfeff);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, -2147483648); 
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2147483648));
</ins><span class="cx">         assert(arr[0] === 0x0000);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, -2147483648); 
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint16(-2147483648));
</ins><span class="cx">         assert(arr[0] === 0x0000);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, -2147478988); 
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint16(-2147478988));
</ins><span class="cx">         assert(arr[0] === 0x1234);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, -2147478988); 
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2147478988));
</ins><span class="cx">         assert(arr[0] === 0x3412);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> test2();
</span><span class="cx"> 
</span><ins>+function adjustForEndianessUint32(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Uint32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getUint32(0, true);
+}
+
</ins><span class="cx"> function test3() {
</span><span class="cx">     function storeLittleEndian(dv, index, value) {
</span><span class="cx">         dv.setUint32(index, value, true);
</span><span class="lines">@@ -205,29 +231,29 @@
</span><span class="cx">     let dv = new DataView(buffer);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><del>-        storeLittleEndian(dv, 0, 0xffffffff);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint32(0xffffffff));
</ins><span class="cx">         assert(arr[0] === 0xffffffff);
</span><span class="cx">         assert(arr2[0] === -1);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, 0xffaabbcc);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint32(0xffaabbcc));
</ins><span class="cx">         assert(arr[0] === 0xffaabbcc);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0x12345678);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint32(0x12345678));
</ins><span class="cx">         assert(arr[0] === 0x78563412);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0xffaabbcc);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint32(0xffaabbcc));
</ins><span class="cx">         assert(arr[0] === 0xccbbaaff);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0xfaeadaca, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint32(0xfaeadaca), false);
</ins><span class="cx">         assert(arr[0] === 0xcadaeafa);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0xcadaeafa, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint32(0xcadaeafa), false);
</ins><span class="cx">         assert(arr2[0] === -85271862);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0x12345678, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint32(0x12345678), false);
</ins><span class="cx">         assert(arr[0] === 0x78563412);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0xbeeffeeb);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint32(0xbeeffeeb));
</ins><span class="cx">         assert(arr2[0] === -335614018);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -255,34 +281,45 @@
</span><span class="cx">     let dv = new DataView(buffer);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><del>-        storeLittleEndian(dv, 0, 0xffffffff);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint32(0xffffffff));
</ins><span class="cx">         assert(arr[0] === 0xffffffff);
</span><span class="cx">         assert(arr2[0] === -1);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, 0xffaabbcc);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessUint32(0xffaabbcc));
</ins><span class="cx">         assert(arr[0] === 0xffaabbcc);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0x12345678);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint32(0x12345678));
</ins><span class="cx">         assert(arr[0] === 0x78563412);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0xffaabbcc);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint32(0xffaabbcc));
</ins><span class="cx">         assert(arr[0] === 0xccbbaaff);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0xfaeadaca, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint32(0xfaeadaca), false);
</ins><span class="cx">         assert(arr[0] === 0xcadaeafa);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0xcadaeafa, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint32(0xcadaeafa), false);
</ins><span class="cx">         assert(arr2[0] === -85271862);
</span><span class="cx"> 
</span><del>-        store(dv, 0, 0x12345678, false);
</del><ins>+        store(dv, 0, adjustForEndianessUint32(0x12345678), false);
</ins><span class="cx">         assert(arr[0] === 0x78563412);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 0xbeeffeeb);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessUint32(0xbeeffeeb));
</ins><span class="cx">         assert(arr2[0] === -335614018);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> test4();
</span><span class="cx"> 
</span><ins>+function adjustForEndianessFloat32(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Float32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getFloat32(0, true);
+}
+
</ins><span class="cx"> function test5() {
</span><span class="cx">     function storeLittleEndian(dv, index, value) {
</span><span class="cx">         dv.setFloat32(index, value, true);
</span><span class="lines">@@ -305,21 +342,21 @@
</span><span class="cx">     let dv = new DataView(buffer);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><del>-        storeLittleEndian(dv, 0, 1.5);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(1.5));
</ins><span class="cx">         assert(arr[0] === 1.5);
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, 12912.124123215122);
</del><ins>+        store(dv, 0, 12912.124123215122, isLittleEndian);
+        assert(bits[0] === 0x4649c07f);
</ins><span class="cx">         assert(arr[0] === 12912.1240234375);
</span><del>-        assert(bits[0] === 0x4649c07f);
</del><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, NaN);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(NaN));
</ins><span class="cx">         assert(isNaN(arr[0]));
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, 2.3879393e-38);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(2.3879393e-38));
</ins><span class="cx">         assert(arr[0] === 2.387939260590663e-38);
</span><span class="cx">         assert(bits[0] === 0x01020304);
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 2.3879393e-38);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessFloat32(2.3879393e-38));
</ins><span class="cx">         assert(arr[0] === 1.539989614439558e-36);
</span><span class="cx">         assert(bits[0] === 0x04030201);
</span><span class="cx">     }
</span><span class="lines">@@ -326,6 +363,17 @@
</span><span class="cx"> }
</span><span class="cx"> test5();
</span><span class="cx"> 
</span><ins>+function adjustForEndianessFloat64(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(8);
+    let ta = new Float64Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getFloat64(0, true);
+}
+
</ins><span class="cx"> function test6() {
</span><span class="cx">     function storeLittleEndian(dv, index, value) {
</span><span class="cx">         dv.setFloat64(index, value, true);
</span><span class="lines">@@ -347,30 +395,30 @@
</span><span class="cx">     let dv = new DataView(buffer);
</span><span class="cx"> 
</span><span class="cx">     for (let i = 0; i < 10000; ++i) {
</span><del>-        storeLittleEndian(dv, 0, NaN);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessFloat64(NaN));
</ins><span class="cx">         assert(isNaN(arr[0]));
</span><span class="cx"> 
</span><del>-        storeLittleEndian(dv, 0, -2.5075187084135162e+284);
</del><ins>+        storeLittleEndian(dv, 0, adjustForEndianessFloat64(-2.5075187084135162e+284));
</ins><span class="cx">         assert(arr[0] === -2.5075187084135162e+284);
</span><span class="cx">         assert(readHex(dv, 8) === "0xfafafafafafafafa");
</span><span class="cx"> 
</span><del>-        store(dv, 0, 124.553, true);
</del><ins>+        store(dv, 0, adjustForEndianessFloat64(124.553), true);
</ins><span class="cx">         assert(readHex(dv, 8) === "0x405f23645a1cac08");
</span><span class="cx"> 
</span><del>-        store(dv, 0, Infinity, true);
</del><ins>+        store(dv, 0, adjustForEndianessFloat64(Infinity), true);
</ins><span class="cx">         assert(readHex(dv, 8) === "0x7ff0000000000000");
</span><span class="cx"> 
</span><del>-        store(dv, 0, Infinity, false);
</del><ins>+        store(dv, 0, adjustForEndianessFloat64(Infinity), false);
</ins><span class="cx">         assert(readHex(dv, 8) === "0x000000000000f07f");
</span><span class="cx"> 
</span><del>-        store(dv, 0, -Infinity, true);
</del><ins>+        store(dv, 0, adjustForEndianessFloat64(-Infinity), true);
</ins><span class="cx">         assert(readHex(dv, 8) === "0xfff0000000000000");
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, -2.5075187084135162e+284);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessFloat64(-2.5075187084135162e+284));
</ins><span class="cx">         assert(arr[0] === -2.5075187084135162e+284);
</span><span class="cx">         assert(readHex(dv, 8) === "0xfafafafafafafafa");
</span><span class="cx"> 
</span><del>-        storeBigEndian(dv, 0, 124.553);
</del><ins>+        storeBigEndian(dv, 0, adjustForEndianessFloat64(124.553));
</ins><span class="cx">         assert(readHex(dv, 8) === "0x08ac1c5a64235f40");
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>