<!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>[208634] trunk/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/208634">208634</a></dd>
<dt>Author</dt> <dd>keith_miller@apple.com</dd>
<dt>Date</dt> <dd>2016-11-11 18:25:48 -0800 (Fri, 11 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Relocate wasm tests and actually add them to the test runner
https://bugs.webkit.org/show_bug.cgi?id=164668

Reviewed by Yusuke Suzuki.

This moves the Wasm tests from their current location down a level.
Without relocating, the tests cannot properly be run by the wasm test runner.

* wasm.yaml:
* wasm/Builder.js: Fix typos, yay lazy synatx checking!
* wasm/LowLevelBinary.js: Fix typos, yay lazy synatx checking!
(export.default.LowLevelBinary.prototype.get return):
* wasm/function-tests/add-12.js: Renamed from JSTests/wasm/js-api/function-tests/add-12.js.
* wasm/function-tests/br-if-loop-less-than.js: Renamed from JSTests/wasm/js-api/function-tests/br-if-loop-less-than.js.
* wasm/function-tests/brTableAsIf.js: Renamed from JSTests/wasm/js-api/function-tests/brTableAsIf.js.
* wasm/function-tests/brTableManyValues.js: Renamed from JSTests/wasm/js-api/function-tests/brTableManyValues.js.
* wasm/function-tests/brTableWithLoop.js: Renamed from JSTests/wasm/js-api/function-tests/brTableWithLoop.js.
* wasm/function-tests/dumb-eq-if-then-else.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-eq-if-then-else.js.
* wasm/function-tests/dumb-less-than-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-fallthrough.js.
* wasm/function-tests/dumb-less-than-ite.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-ite.js.
* wasm/function-tests/factorial.js: Renamed from JSTests/wasm/js-api/function-tests/factorial.js.
* wasm/function-tests/float-sub.js: Renamed from JSTests/wasm/js-api/function-tests/float-sub.js.
* wasm/function-tests/i32-load.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load.js.
* wasm/function-tests/i32-load8-s.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load8-s.js.
* wasm/function-tests/if-then-else-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-else-fallthrough.js.
* wasm/function-tests/if-then-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-fallthrough.js.
* wasm/function-tests/loop-mult.js: Renamed from JSTests/wasm/js-api/function-tests/loop-mult.js.
* wasm/function-tests/loop-sum.js: Renamed from JSTests/wasm/js-api/function-tests/loop-sum.js.
* wasm/function-tests/ret5.js: Renamed from JSTests/wasm/js-api/function-tests/ret5.js.
* wasm/self-test/test_BuilderJSON.js: Rebasline</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTestswasmBuilderjs">trunk/JSTests/wasm/Builder.js</a></li>
<li><a href="#trunkJSTestswasmLowLevelBinaryjs">trunk/JSTests/wasm/LowLevelBinary.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_BuilderJSONjs">trunk/JSTests/wasm/self-test/test_BuilderJSON.js</a></li>
<li><a href="#trunkJSTestswasmyaml">trunk/JSTests/wasm.yaml</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/JSTests/wasm/function-tests/</li>
<li><a href="#trunkJSTestswasmfunctiontestsadd12js">trunk/JSTests/wasm/function-tests/add-12.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsbriflooplessthanjs">trunk/JSTests/wasm/function-tests/br-if-loop-less-than.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsbrTableAsIfjs">trunk/JSTests/wasm/function-tests/brTableAsIf.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsbrTableManyValuesjs">trunk/JSTests/wasm/function-tests/brTableManyValues.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsbrTableWithLoopjs">trunk/JSTests/wasm/function-tests/brTableWithLoop.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsdumbeqifthenelsejs">trunk/JSTests/wasm/function-tests/dumb-eq-if-then-else.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsdumblessthanfallthroughjs">trunk/JSTests/wasm/function-tests/dumb-less-than-fallthrough.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsdumblessthanitejs">trunk/JSTests/wasm/function-tests/dumb-less-than-ite.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsfactorialjs">trunk/JSTests/wasm/function-tests/factorial.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsfloatsubjs">trunk/JSTests/wasm/function-tests/float-sub.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsi32loadjs">trunk/JSTests/wasm/function-tests/i32-load.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsi32load8sjs">trunk/JSTests/wasm/function-tests/i32-load8-s.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsifthenelsefallthroughjs">trunk/JSTests/wasm/function-tests/if-then-else-fallthrough.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsifthenfallthroughjs">trunk/JSTests/wasm/function-tests/if-then-fallthrough.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsloopmultjs">trunk/JSTests/wasm/function-tests/loop-mult.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsloopsumjs">trunk/JSTests/wasm/function-tests/loop-sum.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsret5js">trunk/JSTests/wasm/function-tests/ret5.js</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>trunk/JSTests/wasm/js-api/function-tests/</li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (208633 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2016-11-12 01:18:22 UTC (rev 208633)
+++ trunk/JSTests/ChangeLog        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -1,5 +1,38 @@
</span><span class="cx"> 2016-11-11  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Relocate wasm tests and actually add them to the test runner
+        https://bugs.webkit.org/show_bug.cgi?id=164668
+
+        Reviewed by Yusuke Suzuki.
+
+        This moves the Wasm tests from their current location down a level.
+        Without relocating, the tests cannot properly be run by the wasm test runner.
+
+        * wasm.yaml:
+        * wasm/Builder.js: Fix typos, yay lazy synatx checking!
+        * wasm/LowLevelBinary.js: Fix typos, yay lazy synatx checking!
+        (export.default.LowLevelBinary.prototype.get return):
+        * wasm/function-tests/add-12.js: Renamed from JSTests/wasm/js-api/function-tests/add-12.js.
+        * wasm/function-tests/br-if-loop-less-than.js: Renamed from JSTests/wasm/js-api/function-tests/br-if-loop-less-than.js.
+        * wasm/function-tests/brTableAsIf.js: Renamed from JSTests/wasm/js-api/function-tests/brTableAsIf.js.
+        * wasm/function-tests/brTableManyValues.js: Renamed from JSTests/wasm/js-api/function-tests/brTableManyValues.js.
+        * wasm/function-tests/brTableWithLoop.js: Renamed from JSTests/wasm/js-api/function-tests/brTableWithLoop.js.
+        * wasm/function-tests/dumb-eq-if-then-else.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-eq-if-then-else.js.
+        * wasm/function-tests/dumb-less-than-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-fallthrough.js.
+        * wasm/function-tests/dumb-less-than-ite.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-ite.js.
+        * wasm/function-tests/factorial.js: Renamed from JSTests/wasm/js-api/function-tests/factorial.js.
+        * wasm/function-tests/float-sub.js: Renamed from JSTests/wasm/js-api/function-tests/float-sub.js.
+        * wasm/function-tests/i32-load.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load.js.
+        * wasm/function-tests/i32-load8-s.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load8-s.js.
+        * wasm/function-tests/if-then-else-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-else-fallthrough.js.
+        * wasm/function-tests/if-then-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-fallthrough.js.
+        * wasm/function-tests/loop-mult.js: Renamed from JSTests/wasm/js-api/function-tests/loop-mult.js.
+        * wasm/function-tests/loop-sum.js: Renamed from JSTests/wasm/js-api/function-tests/loop-sum.js.
+        * wasm/function-tests/ret5.js: Renamed from JSTests/wasm/js-api/function-tests/ret5.js.
+        * wasm/self-test/test_BuilderJSON.js: Rebasline
+
+2016-11-11  Keith Miller  &lt;keith_miller@apple.com&gt;
+
</ins><span class="cx">         Move Wasm tests to JS
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=164611
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJSTestswasmBuilderjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/Builder.js (208633 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/Builder.js        2016-11-12 01:18:22 UTC (rev 208633)
+++ trunk/JSTests/wasm/Builder.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> const _checkStackArgs = (op, param) =&gt; {
</span><del>-    for (let expect of paramn) {
</del><ins>+    for (let expect of param) {
</ins><span class="cx">         if (WASM.isValidValueType(expect)) {
</span><span class="cx">             // FIXME implement stack checks for arguments. https://bugs.webkit.org/show_bug.cgi?id=163421
</span><span class="cx">         } else {
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-const _checkImms = (op, imms, expectedImms) =&gt; {
</del><ins>+const _checkImms = (op, imms, expectedImms, ret) =&gt; {
</ins><span class="cx">     assert.eq(imms.length, expectedImms.length, `&quot;${op}&quot; expects ${expectedImms.length} immediates, got ${imms.length}`);
</span><span class="cx">     for (let idx = 0; idx !== expectedImms.length; ++idx) {
</span><span class="cx">         const got = imms[idx];
</span><span class="lines">@@ -257,7 +257,7 @@
</span><span class="cx">             const continuation = args[args.length - 1];
</span><span class="cx">             const hasContinuation = typeof(continuation) === &quot;function&quot;;
</span><span class="cx">             const imms = hasContinuation ? args.slice(0, -1) : args; // FIXME: allow passing in stack values, as-if code were a stack machine. Just check for a builder to this function, and drop. https://bugs.webkit.org/show_bug.cgi?id=163422
</span><del>-            checkImms(op, imms, imm);
</del><ins>+            checkImms(op, imms, imm, ret);
</ins><span class="cx">             checkStackArgs(op, param);
</span><span class="cx">             checkStackReturn(op, ret);
</span><span class="cx">             const stackArgs = []; // FIXME https://bugs.webkit.org/show_bug.cgi?id=162706
</span></span></pre></div>
<a id="trunkJSTestswasmLowLevelBinaryjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/LowLevelBinary.js (208633 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/LowLevelBinary.js        2016-11-12 01:18:22 UTC (rev 208633)
+++ trunk/JSTests/wasm/LowLevelBinary.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -80,7 +80,6 @@
</span><span class="cx">     trim() { this._buf = this._buf.slice(0, this._used); }
</span><span class="cx"> 
</span><span class="cx">     hexdump() { return _hexdump(this._buf, this._used); }
</span><del>-    trim() { this._buf = this._buf.slice(0, this._used); }
</del><span class="cx">     _maybeGrow(bytes) {
</span><span class="cx">         const allocated = this._buf.length;
</span><span class="cx">         if (allocated - this._used &lt; bytes) {
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsadd12jsfromrev208633trunkJSTestswasmjsapifunctiontestsadd12js"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/add-12.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/add-12.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/add-12.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/add-12.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .GetLocal(0)
+    .GetLocal(1)
+    .I32Add()
+    .GetLocal(2)
+    .I32Add()
+    .GetLocal(3)
+    .I32Add()
+    .GetLocal(4)
+    .I32Add()
+    .GetLocal(5)
+    .I32Add()
+    .GetLocal(6)
+    .I32Add()
+    .GetLocal(7)
+    .I32Add()
+    .GetLocal(8)
+    .I32Add()
+    .GetLocal(9)
+    .I32Add()
+    .GetLocal(10)
+    .I32Add()
+    .GetLocal(11)
+    .I32Add()
+    .Return()
+    .End()
+
+    .Function({ params: [&quot;i32&quot;], ret: &quot;i32&quot; })
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .GetLocal(0)
+    .Call(0)
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 2,
+                        [[{ type: &quot;i32&quot;, value: 78 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 3 }, { type: &quot;i32&quot;, value: 4 }, { type: &quot;i32&quot;, value: 5 }, { type: &quot;i32&quot;, value: 6 }, { type: &quot;i32&quot;, value: 7 }, { type: &quot;i32&quot;, value: 8 }, { type: &quot;i32&quot;, value: 9 }, { type: &quot;i32&quot;, value: 10 }, { type: &quot;i32&quot;, value: 11 }, { type: &quot;i32&quot;, value: 12 }]],
+                         [{ type: &quot;i32&quot;, value: 166 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 3 }, { type: &quot;i32&quot;, value: 4 }, { type: &quot;i32&quot;, value: 5 }, { type: &quot;i32&quot;, value: 6 }, { type: &quot;i32&quot;, value: 7 }, { type: &quot;i32&quot;, value: 8 }, { type: &quot;i32&quot;, value: 9 }, { type: &quot;i32&quot;, value: 10 }, { type: &quot;i32&quot;, value: 11 }, { type: &quot;i32&quot;, value: 100 }]]
+                        ],
+                        [[{ type: &quot;i32&quot;, value: 12 }, [{ type: &quot;i32&quot;, value: 1 }]],
+                         [{ type: &quot;i32&quot;, value: 1200 }, [{ type: &quot;i32&quot;, value: 100 }]],
+                         [{ type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 0 }]],
+                        ]
+                       );
</ins></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsbriflooplessthanjsfromrev208633trunkJSTestswasmjsapifunctiontestsbriflooplessthanjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/br-if-loop-less-than.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/br-if-loop-less-than.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/br-if-loop-less-than.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/br-if-loop-less-than.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .Loop(&quot;void&quot;)
+    .Block(&quot;void&quot;, b =&gt;
+           b.Block(&quot;void&quot;, b =&gt;
+                   b.GetLocal(0)
+                   .GetLocal(1)
+                   .I32Eq()
+                   .BrIf(0)
+                   .Br(1)
+                  )
+           .I32Const(0)
+           .Return()
+          )
+    .Block(&quot;void&quot;, b =&gt;
+           b.Block(&quot;void&quot;, b =&gt;
+                   b.GetLocal(0)
+                   .I32Const(0)
+                   .I32Eq()
+                   .BrIf(0)
+                   .Br(1)
+                  )
+           .I32Const(1)
+           .Return()
+          )
+    .GetLocal(0)
+    .I32Const(1)
+    .I32Sub()
+    .SetLocal(0)
+    .Br(0)
+    .End()
+    .Unreachable()
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 0 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 6 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 100 }, { type: &quot;i32&quot;, value: 6 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsbrTableAsIfjsfromrev208633trunkJSTestswasmjsapifunctiontestsbrTableAsIfjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/brTableAsIf.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/brTableAsIf.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/brTableAsIf.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/brTableAsIf.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;], ret: &quot;i32&quot; }, [&quot;i32&quot;])
+    .Block(&quot;void&quot;, (b) =&gt;
+           b.Block(&quot;void&quot;, (b) =&gt;
+                   b.GetLocal(0)
+                   .BrTable(1, 0)
+                   .I32Const(21)
+                   .Return()
+                  ).I32Const(20)
+           .Return()
+          ).I32Const(22)
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 22 }, [{ type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 20 }, [{ type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 20 }, [{ type: &quot;i32&quot;, value: 11 }]],
+                                       [{type: &quot;i32&quot;, value: 20 }, [{ type: &quot;i32&quot;, value: -100 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsbrTableManyValuesjsfromrev208633trunkJSTestswasmjsapifunctiontestsbrTableManyValuesjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/brTableManyValues.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/brTableManyValues.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/brTableManyValues.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/brTableManyValues.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;], ret: &quot;i32&quot; }, [&quot;i32&quot;])
+    .Block(&quot;i32&quot;, (b) =&gt;
+           b.Block(&quot;i32&quot;, (b) =&gt;
+                   b.Block(&quot;i32&quot;, (b) =&gt;
+                           b.Block(&quot;i32&quot;, (b) =&gt;
+                                   b.Block(&quot;i32&quot;, (b) =&gt;
+                                           b.I32Const(200)
+                                           .GetLocal(0)
+                                           .BrTable(3, 2, 1, 0, 4)
+                                          ).I32Const(10)
+                                   .I32Add()
+                                   .Return()
+                                  ).I32Const(11)
+                           .I32Add()
+                           .Return()
+                          ).I32Const(12)
+                   .I32Add()
+                   .Return()
+                  ).I32Const(13)
+           .I32Add()
+           .Return()
+          ).I32Const(14)
+    .I32Add()
+    .Return()
+    .End()
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 213 }, [{ type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 212 }, [{ type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 211 }, [{ type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 210 }, [{ type: &quot;i32&quot;, value: 3 }]],
+                                       [{type: &quot;i32&quot;, value: 214 }, [{ type: &quot;i32&quot;, value: 4 }]],
+                                       [{type: &quot;i32&quot;, value: 214 }, [{ type: &quot;i32&quot;, value: 5 }]],
+                                       [{type: &quot;i32&quot;, value: 214 }, [{ type: &quot;i32&quot;, value: -1 }]],
+                                       [{type: &quot;i32&quot;, value: 214 }, [{ type: &quot;i32&quot;, value: -1000 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsbrTableWithLoopjsfromrev208633trunkJSTestswasmjsapifunctiontestsbrTableWithLoopjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/brTableWithLoop.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/brTableWithLoop.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/brTableWithLoop.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/brTableWithLoop.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;], ret: &quot;i32&quot; }, [&quot;i32&quot;])
+    .Loop(&quot;void&quot;)
+    .Block(&quot;void&quot;, (b) =&gt;
+
+           b.GetLocal(0)
+           .GetLocal(1)
+           .I32Const(1)
+           .I32Add()
+           .SetLocal(1)
+           .GetLocal(0)
+           .I32Const(1)
+           .I32Sub()
+           .SetLocal(0)
+           .BrTable(0, 1))
+
+    .End()
+    .GetLocal(1)
+    .End()
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 2 }, [{ type: &quot;i32&quot;, value: 1 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsdumbeqifthenelsejsfromrev208633trunkJSTestswasmjsapifunctiontestsdumbeqifthenelsejs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/dumb-eq-if-then-else.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/dumb-eq-if-then-else.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/dumb-eq-if-then-else.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/dumb-eq-if-then-else.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Memory().InitialMaxPages(1, 1).End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .GetLocal(0)
+    .GetLocal(1)
+    .I32Eq()
+    .If(&quot;void&quot;, b =&gt;
+        b.Br(0)
+        .Else()
+            .I32Const(1)
+        .Return()
+       )
+        .I32Const(0)
+    .Return()
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 0 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 0 }, { type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 6 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 100 }, { type: &quot;i32&quot;, value: 6 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsdumblessthanfallthroughjsfromrev208633trunkJSTestswasmjsapifunctiontestsdumblessthanfallthroughjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/dumb-less-than-fallthrough.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/dumb-less-than-fallthrough.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/dumb-less-than-fallthrough.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/dumb-less-than-fallthrough.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .Loop(&quot;i32&quot;, b =&gt;
+          b.GetLocal(0)
+          .GetLocal(1)
+          .I32Eq()
+          .If(&quot;i32&quot;, b =&gt;
+              b.I32Const(0)
+              .Return()
+              .Else()
+                  .GetLocal(0)
+              .GetLocal(0)
+              .I32Const(1)
+              .I32Sub()
+              .SetLocal(0)
+              .I32Const(0)
+              .I32Ne()
+              .BrIf(1)
+              .I32Const(1)
+          )
+    ).End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 0 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 6 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 100 }, { type: &quot;i32&quot;, value: 6 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsdumblessthanitejsfromrev208633trunkJSTestswasmjsapifunctiontestsdumblessthanitejs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/dumb-less-than-ite.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/dumb-less-than-ite.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/dumb-less-than-ite.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/dumb-less-than-ite.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .Loop(&quot;void&quot;)
+    .GetLocal(0)
+    .GetLocal(1)
+    .I32Eq()
+    .If(&quot;void&quot;, b =&gt;
+        b.I32Const(0)
+        .Return()
+        .Else()
+            .GetLocal(0)
+        .I32Const(0)
+        .I32Eq()
+        .If(&quot;void&quot;, b =&gt;
+            b.I32Const(1)
+            .Return()
+           )
+            )
+        .GetLocal(0)
+    .I32Const(1)
+    .I32Sub()
+    .SetLocal(0)
+    .Br(0)
+    .End()
+    .Unreachable()
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 0 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 1 }, { type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 0 }, { type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 2 }, { type: &quot;i32&quot;, value: 6 }]],
+                                       [{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 100 }, { type: &quot;i32&quot;, value: 6 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsfactorialjsfromrev208633trunkJSTestswasmjsapifunctiontestsfactorialjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/factorial.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/factorial.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/factorial.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/factorial.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .GetLocal(0)
+    .I32Const(0)
+    .I32Eq()
+    .If(&quot;void&quot;, b =&gt;
+        b.I32Const(1)
+        .Return()
+       )
+        .GetLocal(0)
+    .GetLocal(0)
+    .I32Const(1)
+    .I32Sub()
+    .Call(0)
+    .I32Mul()
+    .Return()
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 2 }, [{ type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 24 }, [{ type: &quot;i32&quot;, value: 4 }]],
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsfloatsubjsfromrev208633trunkJSTestswasmjsapifunctiontestsfloatsubjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/float-sub.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/float-sub.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/float-sub.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/float-sub.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;f32&quot;, &quot;f32&quot;], ret: &quot;f32&quot; }, [])
+    .GetLocal(0)
+    .GetLocal(1)
+    .F32Sub()
+    .Return()
+    .End()
+
+    .Function({ params: [&quot;f32&quot;, &quot;f32&quot;], ret: &quot;f32&quot; }, [])
+    .GetLocal(0)
+    .GetLocal(1)
+    .Call(0)
+    .Return()
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 2,
+                        [[{type: &quot;f32&quot;, value: -1.5 }, [{ type: &quot;f32&quot;, value: 0 }, { type: &quot;f32&quot;, value: 1.5 }]],
+                         [{type: &quot;f32&quot;, value: 87.6234 }, [{ type: &quot;f32&quot;, value: 100.1234 }, { type: &quot;f32&quot;, value: 12.5 }]]
+                        ],
+                        [[{type: &quot;f32&quot;, value: -1.5 }, [{ type: &quot;f32&quot;, value: 0 }, { type: &quot;f32&quot;, value: 1.5 }]],
+                         [{type: &quot;f32&quot;, value: 87.6234 }, [{ type: &quot;f32&quot;, value: 100.1234 }, { type: &quot;f32&quot;, value: 12.5 }]]
+                        ]
+                       );
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsi32loadjsfromrev208633trunkJSTestswasmjsapifunctiontestsi32loadjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/i32-load.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/i32-load.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/i32-load.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/i32-load.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Memory().InitialMaxPages(1, 1).End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .GetLocal(1)
+    .GetLocal(0)
+    .I32Store(2, 0)
+    .GetLocal(1)
+    .I32Load(2, 0)
+    .Return()
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 0 }, { type: &quot;i32&quot;, value: 10 }]],
+                                       [{type: &quot;i32&quot;, value: 100 }, [{ type: &quot;i32&quot;, value: 100 }, { type: &quot;i32&quot;, value: 112 }]],
+                                       [{type: &quot;i32&quot;, value: 1000000 }, [{ type: &quot;i32&quot;, value: 1000000 }, { type: &quot;i32&quot;, value: 10 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsi32load8sjsfromrev208633trunkJSTestswasmjsapifunctiontestsi32load8sjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/i32-load8-s.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/i32-load8-s.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/i32-load8-s.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/i32-load8-s.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Memory().InitialMaxPages(1, 1).End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;, &quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .GetLocal(1)
+    .GetLocal(0)
+    .I32Store(2, 0)
+    .GetLocal(1)
+    .I32Load8S(2, 0)
+    .Return()
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 0 }, { type: &quot;i32&quot;, value: 10 }]],
+                                       [{type: &quot;i32&quot;, value: 100 }, [{ type: &quot;i32&quot;, value: 100 }, { type: &quot;i32&quot;, value: 112 }]],
+                                       [{type: &quot;i32&quot;, value: 0x40 }, [{ type: &quot;i32&quot;, value: 1000000 }, { type: &quot;i32&quot;, value: 10 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsifthenelsefallthroughjsfromrev208633trunkJSTestswasmjsapifunctiontestsifthenelsefallthroughjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/if-then-else-fallthrough.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/if-then-else-fallthrough.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/if-then-else-fallthrough.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/if-then-else-fallthrough.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .Block(&quot;i32&quot;, (b) =&gt;
+           b.GetLocal(0)
+           .I32Const(0)
+           .I32Eq()
+           .If(&quot;i32&quot;)
+               .I32Const(1)
+           .Else()
+               .I32Const(2)
+           .Br(1)
+           .End()
+          ).End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 2 }, [{ type: &quot;i32&quot;, value: 1 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsifthenfallthroughjsfromrev208633trunkJSTestswasmjsapifunctiontestsifthenfallthroughjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/if-then-fallthrough.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/if-then-fallthrough.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/if-then-fallthrough.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/if-then-fallthrough.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;], ret: &quot;i32&quot; }, [])
+    .Block(&quot;i32&quot;, (b) =&gt;
+           b.GetLocal(0)
+           .I32Const(0)
+           .I32Eq()
+           .If(&quot;i32&quot;)
+               .I32Const(1)
+           .Else()
+               .I32Const(2)
+           .Br(1)
+           .End()
+          ).End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 2 }, [{ type: &quot;i32&quot;, value: 1 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsloopmultjsfromrev208633trunkJSTestswasmjsapifunctiontestsloopmultjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/loop-mult.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/loop-mult.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/loop-mult.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/loop-mult.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;], ret: &quot;i32&quot; }, [&quot;i32&quot;])
+    .I32Const(0)
+    .SetLocal(1)
+    .Loop(&quot;void&quot;)
+    .Block(&quot;void&quot;, b =&gt;
+           b.GetLocal(0)
+           .I32Const(0)
+           .I32Eq()
+           .BrIf(0)
+           .GetLocal(0)
+           .GetLocal(1)
+           .I32Add()
+           .SetLocal(1)
+           .GetLocal(0)
+           .I32Const(1)
+           .I32Sub()
+           .SetLocal(0)
+           .Br(1)
+          )
+    .End()
+    .GetLocal(1)
+    .Return()
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 3 }, [{ type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 5050 }, [{ type: &quot;i32&quot;, value: 100 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsloopsumjsfromrev208633trunkJSTestswasmjsapifunctiontestsloopsumjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/loop-sum.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/loop-sum.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/loop-sum.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/loop-sum.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+b.Type().End()
+    .Function().End()
+    .Code()
+    .Function({ params: [&quot;i32&quot;], ret: &quot;i32&quot; }, [&quot;i32&quot;])
+    .I32Const(0)
+    .SetLocal(1)
+    .Loop(&quot;void&quot;)
+    .Block(&quot;void&quot;, b =&gt;
+           b.GetLocal(0)
+           .I32Const(0)
+           .I32Eq()
+           .BrIf(0)
+           .GetLocal(0)
+           .GetLocal(1)
+           .I32Add()
+           .SetLocal(1)
+           .GetLocal(0)
+           .I32Const(1)
+           .I32Sub()
+           .SetLocal(0)
+           .Br(1)
+          )
+    .End()
+    .GetLocal(1)
+    .Return()
+    .End()
+
+const bin = b.WebAssembly()
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 0 }, [{ type: &quot;i32&quot;, value: 0 }]],
+                                       [{type: &quot;i32&quot;, value: 1 }, [{ type: &quot;i32&quot;, value: 1 }]],
+                                       [{type: &quot;i32&quot;, value: 3 }, [{ type: &quot;i32&quot;, value: 2 }]],
+                                       [{type: &quot;i32&quot;, value: 5050 }, [{ type: &quot;i32&quot;, value: 100 }]]
+                                      ]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsret5jsfromrev208633trunkJSTestswasmjsapifunctiontestsret5js"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/function-tests/ret5.js (from rev 208633, trunk/JSTests/wasm/js-api/function-tests/ret5.js) (0 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/ret5.js                                (rev 0)
+++ trunk/JSTests/wasm/function-tests/ret5.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+import Builder from '../Builder.js'
+
+const b = new Builder();
+b.setChecked(false);
+let code = b.Type().End()
+    .Function().End()
+    .Code();
+
+code.Function({ params: [], ret: &quot;i32&quot; })
+    .I32Const(5)
+    .Return()
+    .End()
+    .End();
+const bin = b.WebAssembly();
+bin.trim();
+testWasmModuleFunctions(bin.get(), 1, [[{type: &quot;i32&quot;, value: 5 }, []]]);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkJSTestswasmselftesttest_BuilderJSONjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/self-test/test_BuilderJSON.js (208633 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_BuilderJSON.js        2016-11-12 01:18:22 UTC (rev 208633)
+++ trunk/JSTests/wasm/self-test/test_BuilderJSON.js        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -140,12 +140,12 @@
</span><span class="cx"> 
</span><span class="cx"> (function ImportFunctionWithoutTypeSection() {
</span><span class="cx">     const i = (new Builder()).Import();
</span><del>-    assert.throws(() =&gt; i.Function(&quot;foo&quot;, &quot;bar&quot;, 0), Error, `Shouldn't be undefined: Can't use type 0 if a type section isn't present`);
</del><ins>+    assert.throws(() =&gt; i.Function(&quot;foo&quot;, &quot;bar&quot;, 0), Error, `Shouldn't be undefined: Can not use type 0 if a type section is not present`);
</ins><span class="cx"> })();
</span><span class="cx"> 
</span><span class="cx"> (function ImportFunctionWithInvalidType() {
</span><span class="cx">     const i = (new Builder()).Type().End().Import();
</span><del>-    assert.throws(() =&gt; i.Function(&quot;foo&quot;, &quot;bar&quot;, 0), Error, `Shouldn't be undefined: Type 0 doesn't exist in type section`);
</del><ins>+    assert.throws(() =&gt; i.Function(&quot;foo&quot;, &quot;bar&quot;, 0), Error, `Shouldn't be undefined: Type 0 does not exist in type section`);
</ins><span class="cx"> })();
</span><span class="cx"> 
</span><span class="cx"> (function ImportFunction() {
</span><span class="lines">@@ -211,12 +211,12 @@
</span><span class="cx"> 
</span><span class="cx"> (function ExportFunctionWithoutTypeSection() {
</span><span class="cx">     const e = (new Builder()).Export();
</span><del>-    assert.throws(() =&gt; e.Function(&quot;foo&quot;, 0, 0), Error, `Shouldn't be undefined: Can't use type 0 if a type section isn't present`);
</del><ins>+    assert.throws(() =&gt; e.Function(&quot;foo&quot;, 0, 0), Error, `Shouldn't be undefined: Can not use type 0 if a type section is not present`);
</ins><span class="cx"> })();
</span><span class="cx"> 
</span><span class="cx"> (function ExportFunctionWithInvalidType() {
</span><span class="cx">     const e = (new Builder()).Type().End().Export();
</span><del>-    assert.throws(() =&gt; e.Function(&quot;foo&quot;, 0, 0), Error, `Shouldn't be undefined: Type 0 doesn't exist in type section`);
</del><ins>+    assert.throws(() =&gt; e.Function(&quot;foo&quot;, 0, 0), Error, `Shouldn't be undefined: Type 0 does not exist in type section`);
</ins><span class="cx"> })();
</span><span class="cx"> 
</span><span class="cx"> (function ExportAnImport() {
</span></span></pre></div>
<a id="trunkJSTestswasmyaml"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm.yaml (208633 => 208634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm.yaml        2016-11-12 01:18:22 UTC (rev 208633)
+++ trunk/JSTests/wasm.yaml        2016-11-12 02:25:48 UTC (rev 208634)
</span><span class="lines">@@ -25,3 +25,5 @@
</span><span class="cx">   cmd: runWebAssembly
</span><span class="cx"> - path: wasm/js-api/
</span><span class="cx">   cmd: runWebAssembly
</span><ins>+- path: wasm/function-tests
+  cmd: runWebAssembly
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>