<!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>[209866] trunk</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/209866">209866</a></dd>
<dt>Author</dt> <dd>keith_miller@apple.com</dd>
<dt>Date</dt> <dd>2016-12-15 11:17:00 -0800 (Thu, 15 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix 64-bit shift family Wasm opcodes
https://bugs.webkit.org/show_bug.cgi?id=165902

Reviewed by Geoffrey Garen.

JSTests:

Add tests for shift family of instructions. Since
we can't generate i64 values to pass to wasm we only compile
the code for those functions. Attempting to generate any i64
code using these instructions would have been enough to cause
the B3 Validation error anyway.

* wasm/assert.js:
* wasm/function-tests/rotl.js: Added.
* wasm/function-tests/rotr.js: Added.
* wasm/function-tests/shl.js: Added.
* wasm/function-tests/shr-s.js: Added.
* wasm/function-tests/shr-u.js: Added.
* wasm/wasm.json:

Source/JavaScriptCore:

The Int64 versions of the shift family B3 opcodes take an Int32
for the shift value. Wasm, however, takes an i64, so we need to
Trunc the shift value. Also, this fixes a bug where shr_u mapped
to signed shift and shr_s mapped to the unsigned shift.

* wasm/wasm.json:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTestswasmassertjs">trunk/JSTests/wasm/assert.js</a></li>
<li><a href="#trunkJSTestswasmwasmjson">trunk/JSTests/wasm/wasm.json</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmwasmjson">trunk/Source/JavaScriptCore/wasm/wasm.json</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkJSTestswasmfunctiontestsrotljs">trunk/JSTests/wasm/function-tests/rotl.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsrotrjs">trunk/JSTests/wasm/function-tests/rotr.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsshljs">trunk/JSTests/wasm/function-tests/shl.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsshrsjs">trunk/JSTests/wasm/function-tests/shr-s.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsshrujs">trunk/JSTests/wasm/function-tests/shr-u.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (209865 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2016-12-15 18:37:18 UTC (rev 209865)
+++ trunk/JSTests/ChangeLog        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-12-15  Keith Miller  &lt;keith_miller@apple.com&gt;
+
+        Fix 64-bit shift family Wasm opcodes
+        https://bugs.webkit.org/show_bug.cgi?id=165902
+
+        Reviewed by Geoffrey Garen.
+
+        Add tests for shift family of instructions. Since
+        we can't generate i64 values to pass to wasm we only compile
+        the code for those functions. Attempting to generate any i64
+        code using these instructions would have been enough to cause
+        the B3 Validation error anyway.
+
+        * wasm/assert.js:
+        * wasm/function-tests/rotl.js: Added.
+        * wasm/function-tests/rotr.js: Added.
+        * wasm/function-tests/shl.js: Added.
+        * wasm/function-tests/shr-s.js: Added.
+        * wasm/function-tests/shr-u.js: Added.
+        * wasm/wasm.json:
+
</ins><span class="cx"> 2016-12-14  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebAssembly: test_BuilderJSON.js is broken
</span></span></pre></div>
<a id="trunkJSTestswasmassertjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/assert.js (209865 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/assert.js        2016-12-15 18:37:18 UTC (rev 209865)
+++ trunk/JSTests/wasm/assert.js        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -79,6 +79,16 @@
</span><span class="cx">         _fail(`Not the same: &quot;${lhs}&quot; and &quot;${rhs}&quot;`, msg);
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+const canonicalizeI32 = (number) =&gt; {
+    if (Math.round(number) === number &amp;&amp; number &gt;= 2 ** 31)
+        number = number - 2 ** 32;
+    return number;
+}
+
+export const eqI32 = (lhs, rhs, msg) =&gt; {
+    return eq(canonicalizeI32(lhs), canonicalizeI32(rhs), msg);
+};
+
</ins><span class="cx"> export const ge = (lhs, rhs, msg) =&gt; {
</span><span class="cx">     isNotUndef(lhs);
</span><span class="cx">     isNotUndef(rhs);
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsrotljs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/function-tests/rotl.js (0 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/rotl.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/rotl.js        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+import * as assert from '../assert.js';
+import Builder from '../Builder.js';
+
+const builder = (new Builder())
+      .Type().End()
+      .Function().End()
+      .Export()
+          .Function(&quot;i32Rotl&quot;)
+          .Function(&quot;i64Rotl&quot;)
+      .End()
+      .Code()
+          .Function(&quot;i32Rotl&quot;, { params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I32Rotl()
+          .End()
+
+          .Function(&quot;i64Rotl&quot;, { params: [&quot;i64&quot;, &quot;i64&quot;], ret: &quot;i64&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I64Rotl()
+          .End()
+
+      .End();
+
+const bin = builder.WebAssembly().get();
+const module = new WebAssembly.Module(bin);
+const instance = new WebAssembly.Instance(module);
+assert.eqI32(instance.exports.i32Rotl(1, 1), 2);
+assert.eqI32(instance.exports.i32Rotl(1, 2), 4);
+assert.eqI32(instance.exports.i32Rotl(0xf, 2), 0x3c);
+assert.eqI32(instance.exports.i32Rotl(0xf0000000, 1), 0xe0000001);
</ins></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsrotrjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/function-tests/rotr.js (0 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/rotr.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/rotr.js        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+import * as assert from '../assert.js';
+import Builder from '../Builder.js';
+
+const builder = (new Builder())
+      .Type().End()
+      .Function().End()
+      .Export()
+          .Function(&quot;i32Rotr&quot;)
+          .Function(&quot;i64Rotr&quot;)
+      .End()
+      .Code()
+          .Function(&quot;i32Rotr&quot;, { params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I32Rotr()
+          .End()
+
+          .Function(&quot;i64Rotr&quot;, { params: [&quot;i64&quot;, &quot;i64&quot;], ret: &quot;i64&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I64Rotr()
+          .End()
+
+      .End();
+
+const bin = builder.WebAssembly().get();
+const module = new WebAssembly.Module(bin);
+const instance = new WebAssembly.Instance(module);
+assert.eqI32(instance.exports.i32Rotr(1, 1), 0x80000000);
+assert.eqI32(instance.exports.i32Rotr(1, 2), 0x40000000);
+assert.eqI32(instance.exports.i32Rotr(0xf, 2), 0xc0000003);
</ins></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsshljs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/function-tests/shl.js (0 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/shl.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/shl.js        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+import * as assert from '../assert.js';
+import Builder from '../Builder.js';
+
+const builder = (new Builder())
+      .Type().End()
+      .Function().End()
+      .Export()
+          .Function(&quot;i32Shl&quot;)
+          .Function(&quot;i64Shl&quot;)
+      .End()
+      .Code()
+          .Function(&quot;i32Shl&quot;, { params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I32Shl()
+          .End()
+
+          .Function(&quot;i64Shl&quot;, { params: [&quot;i64&quot;, &quot;i64&quot;], ret: &quot;i64&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I64Shl()
+          .End()
+
+      .End();
+
+const bin = builder.WebAssembly().get();
+const module = new WebAssembly.Module(bin);
+const instance = new WebAssembly.Instance(module);
+assert.eqI32(instance.exports.i32Shl(1, 1), 2);
+assert.eqI32(instance.exports.i32Shl(1, 2), 4);
+assert.eqI32(instance.exports.i32Shl(0xf, 2), 0x3c);
+assert.eqI32(instance.exports.i32Shl(0xf0000000, 1), 0xe0000000);
</ins></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsshrsjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/function-tests/shr-s.js (0 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/shr-s.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/shr-s.js        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+import * as assert from '../assert.js';
+import Builder from '../Builder.js';
+
+const builder = (new Builder())
+      .Type().End()
+      .Function().End()
+      .Export()
+          .Function(&quot;i32ShrS&quot;)
+          .Function(&quot;i64ShrS&quot;)
+      .End()
+      .Code()
+          .Function(&quot;i32ShrS&quot;, { params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I32ShrS()
+          .End()
+
+          .Function(&quot;i64ShrS&quot;, { params: [&quot;i64&quot;, &quot;i64&quot;], ret: &quot;i64&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I64ShrS()
+          .End()
+
+      .End();
+
+const bin = builder.WebAssembly().get();
+const module = new WebAssembly.Module(bin);
+const instance = new WebAssembly.Instance(module);
+assert.eqI32(instance.exports.i32ShrS(1, 1), 0);
+assert.eqI32(instance.exports.i32ShrS(1, 2), 0);
+assert.eqI32(instance.exports.i32ShrS(0xf, 2), 0x3);
+assert.eqI32(instance.exports.i32ShrS(0xf0000000, 1), 0xf8000000);
</ins></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsshrujs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/function-tests/shr-u.js (0 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/shr-u.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/shr-u.js        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+import * as assert from '../assert.js';
+import Builder from '../Builder.js';
+
+const builder = (new Builder())
+      .Type().End()
+      .Function().End()
+      .Export()
+          .Function(&quot;i32ShrU&quot;)
+          .Function(&quot;i64ShrU&quot;)
+      .End()
+      .Code()
+          .Function(&quot;i32ShrU&quot;, { params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I32ShrU()
+          .End()
+
+          .Function(&quot;i64ShrU&quot;, { params: [&quot;i64&quot;, &quot;i64&quot;], ret: &quot;i64&quot; })
+              .GetLocal(0)
+              .GetLocal(1)
+              .I64ShrU()
+          .End()
+
+      .End();
+
+const bin = builder.WebAssembly().get();
+const module = new WebAssembly.Module(bin);
+const instance = new WebAssembly.Instance(module);
+assert.eqI32(instance.exports.i32ShrU(1, 1), 0);
+assert.eqI32(instance.exports.i32ShrU(1, 2), 0);
+assert.eqI32(instance.exports.i32ShrU(0xf, 2), 0x3);
+assert.eqI32(instance.exports.i32ShrU(0xf0000000, 1), 0x78000000);
</ins></span></pre></div>
<a id="trunkJSTestswasmwasmjson"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/wasm.json (209865 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/wasm.json        2016-12-15 18:37:18 UTC (rev 209865)
+++ trunk/JSTests/wasm/wasm.json        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -101,8 +101,8 @@
</span><span class="cx">         &quot;i32.or&quot;:              { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 114, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitOr&quot;        },
</span><span class="cx">         &quot;i32.xor&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 115, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitXor&quot;       },
</span><span class="cx">         &quot;i32.shl&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 116, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Shl&quot;          },
</span><del>-        &quot;i32.shr_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 118, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;SShr&quot;         },
-        &quot;i32.shr_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 117, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;ZShr&quot;         },
</del><ins>+        &quot;i32.shr_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 118, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;ZShr&quot;         },
+        &quot;i32.shr_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 117, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;SShr&quot;         },
</ins><span class="cx">         &quot;i32.rotr&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 120, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotR&quot;         },
</span><span class="cx">         &quot;i32.rotl&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 119, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotL&quot;         },
</span><span class="cx">         &quot;i32.eq&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  70, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Equal&quot;        },
</span><span class="lines">@@ -129,11 +129,11 @@
</span><span class="cx">         &quot;i64.and&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 131, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitAnd&quot;       },
</span><span class="cx">         &quot;i64.or&quot;:              { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 132, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitOr&quot;        },
</span><span class="cx">         &quot;i64.xor&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 133, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitXor&quot;       },
</span><del>-        &quot;i64.shl&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 134, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Shl&quot;          },
-        &quot;i64.shr_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 136, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;SShr&quot;         },
-        &quot;i64.shr_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 135, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;ZShr&quot;         },
-        &quot;i64.rotr&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 138, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotR&quot;         },
-        &quot;i64.rotl&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 137, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotL&quot;         },
</del><ins>+        &quot;i64.shl&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 134, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Shl(@0, Trunc(@1))&quot; },
+        &quot;i64.shr_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 136, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;ZShr(@0, Trunc(@1))&quot; },
+        &quot;i64.shr_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 135, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;SShr(@0, Trunc(@1))&quot; },
+        &quot;i64.rotr&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 138, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotR(@0, Trunc(@1))&quot; },
+        &quot;i64.rotl&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 137, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotL(@0, Trunc(@1))&quot; },
</ins><span class="cx">         &quot;i64.eq&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  81, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Equal&quot;        },
</span><span class="cx">         &quot;i64.ne&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  82, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;NotEqual&quot;     },
</span><span class="cx">         &quot;i64.lt_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  83, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;LessThan&quot;     },
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (209865 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-12-15 18:37:18 UTC (rev 209865)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-12-15  Keith Miller  &lt;keith_miller@apple.com&gt;
+
+        Fix 64-bit shift family Wasm opcodes
+        https://bugs.webkit.org/show_bug.cgi?id=165902
+
+        Reviewed by Geoffrey Garen.
+
+        The Int64 versions of the shift family B3 opcodes take an Int32
+        for the shift value. Wasm, however, takes an i64, so we need to
+        Trunc the shift value. Also, this fixes a bug where shr_u mapped
+        to signed shift and shr_s mapped to the unsigned shift.
+
+        * wasm/wasm.json:
+
</ins><span class="cx"> 2016-12-14  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Wasm should decode constants correctly
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmwasmjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/wasm.json (209865 => 209866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/wasm.json        2016-12-15 18:37:18 UTC (rev 209865)
+++ trunk/Source/JavaScriptCore/wasm/wasm.json        2016-12-15 19:17:00 UTC (rev 209866)
</span><span class="lines">@@ -101,8 +101,8 @@
</span><span class="cx">         &quot;i32.or&quot;:              { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 114, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitOr&quot;        },
</span><span class="cx">         &quot;i32.xor&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 115, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitXor&quot;       },
</span><span class="cx">         &quot;i32.shl&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 116, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Shl&quot;          },
</span><del>-        &quot;i32.shr_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 118, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;SShr&quot;         },
-        &quot;i32.shr_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 117, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;ZShr&quot;         },
</del><ins>+        &quot;i32.shr_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 118, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;ZShr&quot;         },
+        &quot;i32.shr_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 117, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;SShr&quot;         },
</ins><span class="cx">         &quot;i32.rotr&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 120, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotR&quot;         },
</span><span class="cx">         &quot;i32.rotl&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 119, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotL&quot;         },
</span><span class="cx">         &quot;i32.eq&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  70, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Equal&quot;        },
</span><span class="lines">@@ -129,11 +129,11 @@
</span><span class="cx">         &quot;i64.and&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 131, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitAnd&quot;       },
</span><span class="cx">         &quot;i64.or&quot;:              { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 132, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitOr&quot;        },
</span><span class="cx">         &quot;i64.xor&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 133, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitXor&quot;       },
</span><del>-        &quot;i64.shl&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 134, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Shl&quot;          },
-        &quot;i64.shr_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 136, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;SShr&quot;         },
-        &quot;i64.shr_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 135, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;ZShr&quot;         },
-        &quot;i64.rotr&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 138, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotR&quot;         },
-        &quot;i64.rotl&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 137, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotL&quot;         },
</del><ins>+        &quot;i64.shl&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 134, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Shl(@0, Trunc(@1))&quot; },
+        &quot;i64.shr_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 136, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;ZShr(@0, Trunc(@1))&quot; },
+        &quot;i64.shr_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 135, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;SShr(@0, Trunc(@1))&quot; },
+        &quot;i64.rotr&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 138, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotR(@0, Trunc(@1))&quot; },
+        &quot;i64.rotl&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 137, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;RotL(@0, Trunc(@1))&quot; },
</ins><span class="cx">         &quot;i64.eq&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  81, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Equal&quot;        },
</span><span class="cx">         &quot;i64.ne&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  82, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;NotEqual&quot;     },
</span><span class="cx">         &quot;i64.lt_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  83, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;LessThan&quot;     },
</span></span></pre>
</div>
</div>

</body>
</html>