<!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>[207363] 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/207363">207363</a></dd>
<dt>Author</dt> <dd>jfbastien@apple.com</dd>
<dt>Date</dt> <dd>2016-10-14 17:10:31 -0700 (Fri, 14 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Basic WebAssembly testing

Create a small DSL in JavaScript which can build WebAssembly binary modules based on the JSON description of the format as described in:
https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md

This DSL can then be used to write small text description of valid and invalid WebAssembly binaries, making testing the JSC implementation much easier.

Details and example in README.md.

Basic WebAssembly testing
https://bugs.webkit.org/show_bug.cgi?id=163267

Reviewed by Keith Miller.

JSTests:

* stress/wasm/wasm.json: Removed.
* wasm.yaml: Added.
* wasm/Builder.js: Added.
(const._isValidValue):
(const._BuildWebAssemblyBinary):
(export.default.Builder):
(export.default.Builder.prototype.setChecked):
(export.default.Builder.prototype.setPreamble):
(export.default.Builder.prototype._registerSectionBuilders.switch.case.string_appeared_here.this.section):
(export.default.Builder.prototype._registerSectionBuilders.this.Unknown):
(export.default.Builder.prototype._registerSectionBuilders):
(export.default.Builder.prototype._addSection):
(export.default.Builder.prototype.optimize):
(export.default.Builder.prototype.json):
(export.default.Builder.prototype.AsmJS):
(export.default.Builder.prototype.WebAssembly):
* wasm/LowLevelBinary.js: Added.
(const._getterRangeCheck):
(const._hexdump):
(export.default.LowLevelBinary):
(export.default.LowLevelBinary.prototype.newPatchable):
(export.default.LowLevelBinary.prototype.hexdump):
(export.default.LowLevelBinary.prototype._maybeGrow):
(export.default.LowLevelBinary.prototype._push8):
(export.default.LowLevelBinary.prototype.uint8):
(export.default.LowLevelBinary.prototype.uint16):
(export.default.LowLevelBinary.prototype.uint32):
(export.default.LowLevelBinary.prototype.varuint):
(export.default.LowLevelBinary.prototype.varint):
(export.default.LowLevelBinary.prototype.varuint7):
(export.default.LowLevelBinary.prototype.string):
(export.default.LowLevelBinary.prototype.getSize):
(export.default.LowLevelBinary.prototype.getUint8):
(export.default.LowLevelBinary.prototype.getUint16):
(export.default.LowLevelBinary.prototype.getUint32):
(export.default.LowLevelBinary.prototype.getVaruint):
(export.default.LowLevelBinary.prototype.getVarint):
(export.default.LowLevelBinary.prototype.getVaruint7):
(export.default.LowLevelBinary.prototype.getString):
(PatchableLowLevelBinary):
(PatchableLowLevelBinary.prototype._push8):
(PatchableLowLevelBinary.prototype.apply):
* wasm/README.md: Added.
* wasm/WASM.js: Added.
* wasm/assert.js: Added.
(export.const.notUndef):
(export.const.eq):
(export.const.ge):
(export.const.throwsError):
(export.const.throwsRangeError):
* wasm/generate-wasmops-header.js: Renamed from JSTests/stress/wasm/generate-wasmops-header.js.
* wasm/self-test/test_BuilderJSON.js: Added.
(const.assertOpThrows):
(EmptyModule):
(CustomMagicNumber):
(CustomVersion):
(CustomSection):
(CustomSectionAllBytes):
(CustomSectionInvalidByte):
(TwoCustomSections):
(EmptyCodeSection):
(CodeSectionWithEmptyFunction):
(CodeSectionWithEmptyFunctionWithParameters):
(InvalidFunctionParameters):
(SimpleFunction):
(TwoSimpleFunctions):
(TwoBuildersAtTheSameTime):
(CheckedOpcodeArgumentsTooMany):
(CheckedOpcodeArgumentsNotEnough):
(CallNoArguments):
(CallInvalid):
(I32ConstInvalid):
(F32ConstInvalid):
(F64ConstInvalid):
(CallManyFromStack):
(OpcodeAdd):
(OpcodeUnreachable):
(OpcodeUnreachableCombinations):
(OpcodeSelect):
* wasm/self-test/test_BuilderWebAssembly.js: Added.
(EmptyModule):
(CustomSection):
(Basic):
* wasm/self-test/test_LowLevelBinary_encode.js: Added.
* wasm/self-test/test_LowLevelBinary_string.js: Added.
* wasm/self-test/test_LowLevelBinary_uint16.js: Added.
* wasm/self-test/test_LowLevelBinary_uint32.js: Added.
* wasm/self-test/test_LowLevelBinary_uint8.js: Added.
* wasm/self-test/test_LowLevelBinary_varint.js: Added.
* wasm/self-test/test_LowLevelBinary_varuint.js: Added.
* wasm/self-test/test_LowLevelBinary_varuint7.js: Added.
* wasm/self-test/test_WASM.js: Added.
* wasm/test.sh: Added.
* wasm/utilities.js: Added.
(const._read.filename.switch):
(const._load.filename.switch):
(const._json.filename.switch):
* wasm/wasm.json: Added.

Tools:

* Scripts/run-javascriptcore-tests:
(runJSCStressTests): run wasm.yaml tests
* Scripts/run-jsc-stress-tests: add a WebAssembly-specific runner</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsrunjavascriptcoretests">trunk/Tools/Scripts/run-javascriptcore-tests</a></li>
<li><a href="#trunkToolsScriptsrunjscstresstests">trunk/Tools/Scripts/run-jsc-stress-tests</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/JSTests/wasm/</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="#trunkJSTestswasmREADMEmd">trunk/JSTests/wasm/README.md</a></li>
<li><a href="#trunkJSTestswasmWASMjs">trunk/JSTests/wasm/WASM.js</a></li>
<li><a href="#trunkJSTestswasmassertjs">trunk/JSTests/wasm/assert.js</a></li>
<li><a href="#trunkJSTestswasmgeneratewasmopsheaderjs">trunk/JSTests/wasm/generate-wasmops-header.js</a></li>
<li>trunk/JSTests/wasm/self-test/</li>
<li><a href="#trunkJSTestswasmselftesttest_BuilderJSONjs">trunk/JSTests/wasm/self-test/test_BuilderJSON.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_BuilderWebAssemblyjs">trunk/JSTests/wasm/self-test/test_BuilderWebAssembly.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_LowLevelBinary_encodejs">trunk/JSTests/wasm/self-test/test_LowLevelBinary_encode.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_LowLevelBinary_stringjs">trunk/JSTests/wasm/self-test/test_LowLevelBinary_string.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_LowLevelBinary_uint16js">trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint16.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_LowLevelBinary_uint32js">trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint32.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_LowLevelBinary_uint8js">trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint8.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_LowLevelBinary_varintjs">trunk/JSTests/wasm/self-test/test_LowLevelBinary_varint.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_LowLevelBinary_varuintjs">trunk/JSTests/wasm/self-test/test_LowLevelBinary_varuint.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_LowLevelBinary_varuint7js">trunk/JSTests/wasm/self-test/test_LowLevelBinary_varuint7.js</a></li>
<li><a href="#trunkJSTestswasmselftesttest_WASMjs">trunk/JSTests/wasm/self-test/test_WASM.js</a></li>
<li><a href="#trunkJSTestswasmtestsh">trunk/JSTests/wasm/test.sh</a></li>
<li><a href="#trunkJSTestswasmutilitiesjs">trunk/JSTests/wasm/utilities.js</a></li>
<li><a href="#trunkJSTestswasmwasmjson">trunk/JSTests/wasm/wasm.json</a></li>
<li><a href="#trunkJSTestswasmyaml">trunk/JSTests/wasm.yaml</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>trunk/JSTests/stress/wasm/</li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (207362 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2016-10-14 23:56:00 UTC (rev 207362)
+++ trunk/JSTests/ChangeLog        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -1,3 +1,118 @@
</span><ins>+2016-10-14  JF Bastien  &lt;jfbastien@apple.com&gt;
+
+        Basic WebAssembly testing
+
+        Create a small DSL in JavaScript which can build WebAssembly binary modules based on the JSON description of the format as described in:
+        https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md
+
+        This DSL can then be used to write small text description of valid and invalid WebAssembly binaries, making testing the JSC implementation much easier.
+
+        Details and example in README.md.
+
+        Basic WebAssembly testing
+        https://bugs.webkit.org/show_bug.cgi?id=163267
+
+        Reviewed by Keith Miller.
+
+        * stress/wasm/wasm.json: Removed.
+        * wasm.yaml: Added.
+        * wasm/Builder.js: Added.
+        (const._isValidValue):
+        (const._BuildWebAssemblyBinary):
+        (export.default.Builder):
+        (export.default.Builder.prototype.setChecked):
+        (export.default.Builder.prototype.setPreamble):
+        (export.default.Builder.prototype._registerSectionBuilders.switch.case.string_appeared_here.this.section):
+        (export.default.Builder.prototype._registerSectionBuilders.this.Unknown):
+        (export.default.Builder.prototype._registerSectionBuilders):
+        (export.default.Builder.prototype._addSection):
+        (export.default.Builder.prototype.optimize):
+        (export.default.Builder.prototype.json):
+        (export.default.Builder.prototype.AsmJS):
+        (export.default.Builder.prototype.WebAssembly):
+        * wasm/LowLevelBinary.js: Added.
+        (const._getterRangeCheck):
+        (const._hexdump):
+        (export.default.LowLevelBinary):
+        (export.default.LowLevelBinary.prototype.newPatchable):
+        (export.default.LowLevelBinary.prototype.hexdump):
+        (export.default.LowLevelBinary.prototype._maybeGrow):
+        (export.default.LowLevelBinary.prototype._push8):
+        (export.default.LowLevelBinary.prototype.uint8):
+        (export.default.LowLevelBinary.prototype.uint16):
+        (export.default.LowLevelBinary.prototype.uint32):
+        (export.default.LowLevelBinary.prototype.varuint):
+        (export.default.LowLevelBinary.prototype.varint):
+        (export.default.LowLevelBinary.prototype.varuint7):
+        (export.default.LowLevelBinary.prototype.string):
+        (export.default.LowLevelBinary.prototype.getSize):
+        (export.default.LowLevelBinary.prototype.getUint8):
+        (export.default.LowLevelBinary.prototype.getUint16):
+        (export.default.LowLevelBinary.prototype.getUint32):
+        (export.default.LowLevelBinary.prototype.getVaruint):
+        (export.default.LowLevelBinary.prototype.getVarint):
+        (export.default.LowLevelBinary.prototype.getVaruint7):
+        (export.default.LowLevelBinary.prototype.getString):
+        (PatchableLowLevelBinary):
+        (PatchableLowLevelBinary.prototype._push8):
+        (PatchableLowLevelBinary.prototype.apply):
+        * wasm/README.md: Added.
+        * wasm/WASM.js: Added.
+        * wasm/assert.js: Added.
+        (export.const.notUndef):
+        (export.const.eq):
+        (export.const.ge):
+        (export.const.throwsError):
+        (export.const.throwsRangeError):
+        * wasm/generate-wasmops-header.js: Renamed from JSTests/stress/wasm/generate-wasmops-header.js.
+        * wasm/self-test/test_BuilderJSON.js: Added.
+        (const.assertOpThrows):
+        (EmptyModule):
+        (CustomMagicNumber):
+        (CustomVersion):
+        (CustomSection):
+        (CustomSectionAllBytes):
+        (CustomSectionInvalidByte):
+        (TwoCustomSections):
+        (EmptyCodeSection):
+        (CodeSectionWithEmptyFunction):
+        (CodeSectionWithEmptyFunctionWithParameters):
+        (InvalidFunctionParameters):
+        (SimpleFunction):
+        (TwoSimpleFunctions):
+        (TwoBuildersAtTheSameTime):
+        (CheckedOpcodeArgumentsTooMany):
+        (CheckedOpcodeArgumentsNotEnough):
+        (CallNoArguments):
+        (CallInvalid):
+        (I32ConstInvalid):
+        (F32ConstInvalid):
+        (F64ConstInvalid):
+        (CallManyFromStack):
+        (OpcodeAdd):
+        (OpcodeUnreachable):
+        (OpcodeUnreachableCombinations):
+        (OpcodeSelect):
+        * wasm/self-test/test_BuilderWebAssembly.js: Added.
+        (EmptyModule):
+        (CustomSection):
+        (Basic):
+        * wasm/self-test/test_LowLevelBinary_encode.js: Added.
+        * wasm/self-test/test_LowLevelBinary_string.js: Added.
+        * wasm/self-test/test_LowLevelBinary_uint16.js: Added.
+        * wasm/self-test/test_LowLevelBinary_uint32.js: Added.
+        * wasm/self-test/test_LowLevelBinary_uint8.js: Added.
+        * wasm/self-test/test_LowLevelBinary_varint.js: Added.
+        * wasm/self-test/test_LowLevelBinary_varuint.js: Added.
+        * wasm/self-test/test_LowLevelBinary_varuint7.js: Added.
+        * wasm/self-test/test_WASM.js: Added.
+        * wasm/test.sh: Added.
+        * wasm/utilities.js: Added.
+        (const._read.filename.switch):
+        (const._load.filename.switch):
+        (const._json.filename.switch):
+        * wasm/wasm.json: Added.
+
</ins><span class="cx"> 2016-10-14  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         test262: @isConstructor incorrectly thinks Math.cos is a constructor
</span></span></pre></div>
<a id="trunkJSTestswasmBuilderjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/Builder.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/Builder.js                                (rev 0)
+++ trunk/JSTests/wasm/Builder.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,258 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import LowLevelBinary from 'LowLevelBinary.js';
+import * as WASM from 'WASM.js';
+
+const _toJavaScriptName = name =&gt; {
+    const camelCase = name.replace(/([^a-z0-9].)/g, c =&gt; c[1].toUpperCase());
+    const CamelCase = camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
+    return CamelCase;
+};
+
+const _isValidValue = (value, type) =&gt; {
+    switch (type) {
+    case &quot;i32&quot;: return ((value &amp; 0xFFFFFFFF) &gt;&gt;&gt; 0) === value;
+    case &quot;i64&quot;: throw new Error(`Unimplemented: value check for ${type}`); // FIXME https://bugs.webkit.org/show_bug.cgi?id=163420 64-bit values
+    case &quot;f32&quot;: return typeof(value) === &quot;number&quot; &amp;&amp; isFinite(value);
+    case &quot;f64&quot;: return typeof(value) === &quot;number&quot; &amp;&amp; isFinite(value);
+    default: throw new Error(`Implementation problem: unknown type ${type}`);
+    }
+};
+const _unknownSectionId = 0;
+
+const _BuildWebAssemblyBinary = (preamble, sections) =&gt; {
+    let wasmBin = new LowLevelBinary();
+    const put = (bin, type, value) =&gt; bin[type](value);
+    for (const p of WASM.description.preamble)
+        put(wasmBin, p.type, preamble[p.name]);
+    for (const section of sections) {
+        put(wasmBin, WASM.sectionEncodingType, section.id);
+        let sectionBin = wasmBin.newPatchable(&quot;varuint&quot;);
+        switch (section.name) {
+        case &quot;Type&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        case &quot;Import&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        case &quot;Function&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        case &quot;Table&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        case &quot;Memory&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        case &quot;Global&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        case &quot;Export&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        case &quot;Start&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        case &quot;Element&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        case &quot;Code&quot;:
+            const numberOfFunctionBodies = section.data.length;
+            put(sectionBin, &quot;varuint&quot;, numberOfFunctionBodies);
+            for (const func of section.data) {
+                let funcBin = sectionBin.newPatchable(&quot;varuint&quot;);
+                const localCount = func.locals.length;
+                put(funcBin, &quot;varuint&quot;, localCount);
+                if (localCount !== 0) throw new Error(`Unimplemented: locals`); // FIXME https://bugs.webkit.org/show_bug.cgi?id=162706
+                for (const op of func.code) {
+                    put(funcBin, &quot;uint8&quot;, op.value);
+                    if (op.arguments.length !== 0) throw new Error(`Unimplemented: arguments`); // FIXME https://bugs.webkit.org/show_bug.cgi?id=162706
+                    if (op.immediates.length !== 0) throw new Error(`Unimplemented: immediates`); // FIXME https://bugs.webkit.org/show_bug.cgi?id=162706
+                }
+                funcBin.apply();
+            }
+            break;
+        case &quot;Data&quot;: throw new Error(`Unimplemented: section type &quot;${section.name}&quot;`);
+        default:
+            if (section.id !== _unknownSectionId) throw new Error(`Unknown section &quot;${section.name}&quot; with number ${section.id}`);
+            put(sectionBin, &quot;string&quot;, section.name);
+            for (const byte of section.data)
+                put(sectionBin, &quot;uint8&quot;, byte);
+            break;
+        }
+        sectionBin.apply();
+    }
+    return wasmBin;
+};
+
+export default class Builder {
+    constructor() {
+        this.setChecked(true);
+        let preamble = {};
+        for (const p of WASM.description.preamble)
+            preamble[p.name] = p.value;
+        this.setPreamble(preamble);
+        this._sections = [];
+        this._registerSectionBuilders();
+    }
+    setChecked(checked) {
+        this._checked = checked;
+        return this;
+    }
+    setPreamble(p) {
+        this._preamble = Object.assign(this._preamble || {}, p);
+        return this;
+    }
+    _registerSectionBuilders() {
+        for (const section in WASM.description.section) {
+            switch (section) {
+            case &quot;Code&quot;:
+                this[section] = function() {
+                    const s = this._addSection(section);
+                    const builder = this;
+                    const codeBuilder =  {
+                        End: () =&gt; builder,
+                        Function: parameters =&gt; {
+                            parameters = parameters || [];
+                            const invalidParameterTypes = parameters.filter(p =&gt; !WASM.isValidValueType(p));
+                            if (invalidParameterTypes.length !== 0) throw new Error(`Function declared with parameters [${parameters}], invalid: [${invalidParameterTypes}]`);
+                            const func = {
+                                locals: parameters, // Parameters are the first locals.
+                                parameterCount: parameters.length,
+                                code: []
+                            };
+                            s.data.push(func);
+                            let functionBuilder = {};
+                            for (const op in WASM.description.opcode) {
+                                const name = _toJavaScriptName(op);
+                                const value = WASM.description.opcode[op].value;
+                                const ret = WASM.description.opcode[op][&quot;return&quot;];
+                                const param = WASM.description.opcode[op].parameter;
+                                const imm = WASM.description.opcode[op].immediate;
+                                const checkStackArgs = builder._checked ? op =&gt; {
+                                    for (let expect of param) {
+                                        if (WASM.isValidValueType(expect)) {
+                                            // FIXME implement stack checks for arguments. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                        } else {
+                                            // Handle our own meta-types.
+                                            switch (expect) {
+                                            case &quot;addr&quot;: break; // FIXME implement addr. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;any&quot;: break; // FIXME implement any. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;bool&quot;: break; // FIXME implement bool. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;call&quot;: break; // FIXME implement call stack argument checks based on function signature. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;global&quot;: break; // FIXME implement global. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;local&quot;: break; // FIXME implement local. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;prev&quot;: break; // FIXME implement prev, checking for whetever the previous value was. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;size&quot;: break; // FIXME implement size. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            default: throw new Error(`Implementation problem: unhandled meta-type &quot;${expect}&quot; on &quot;${op}&quot;`);
+                                            }
+                                        }
+                                    }
+                                } : () =&gt; {};
+                                const checkStackReturn = builder._checked ? op =&gt; {
+                                    for (let expect of ret) {
+                                        if (WASM.isValidValueType(expect)) {
+                                            // FIXME implement stack checks for return. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                        } else {
+                                            // Handle our own meta-types.
+                                            switch (expect) {
+                                            case &quot;bool&quot;: break; // FIXME implement bool. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;call&quot;: break; // FIXME implement call stack return check based on function signature. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;control&quot;: break; // FIXME implement control. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;global&quot;: break; // FIXME implement global. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;local&quot;: break; // FIXME implement local. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;prev&quot;: break; // FIXME implement prev, checking for whetever the parameter type was. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            case &quot;size&quot;: break; // FIXME implement size. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            default: throw new Error(`Implementation problem: unhandled meta-type &quot;${expect}&quot; on &quot;${op}&quot;`);
+                                            }
+                                        }
+                                    }
+                                } : () =&gt; {};
+                                const checkImms = builder._checked ? (op, imms) =&gt; {
+                                    if (imms.length != imm.length) throw new Error(`&quot;${op}&quot; expects ${imm.length} immediates, got ${imms.length}`);
+                                    for (let idx = 0; idx !== imm.length; ++idx) {
+                                        const got = imms[idx];
+                                        const expect = imm[idx];
+                                        switch (expect.name) {
+                                        case &quot;function_index&quot;:
+                                            if (!_isValidValue(got, &quot;i32&quot;)) throw new Error(`Invalid value on ${op}: got &quot;${got}&quot;, expected i32`);
+                                            // FIXME check function indices. https://bugs.webkit.org/show_bug.cgi?id=163421
+                                            break;
+                                        case &quot;local_index&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        case &quot;global_index&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        case &quot;type_index&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        case &quot;value&quot;: if (!_isValidValue(got, ret[0])) throw new Error(`Invalid value on ${op}: got &quot;${got}&quot;, expected ${ret[0]}`); break;
+                                        case &quot;flags&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        case &quot;offset&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        // Control:
+                                        case &quot;default_target&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        case &quot;relative_depth&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        case &quot;sig&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        case &quot;target_count&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        case &quot;target_table&quot;: throw new Error(`Unimplemented: &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        default: throw new Error(`Implementation problem: unhandled immediate &quot;${expect.name}&quot; on &quot;${op}&quot;`);
+                                        }
+                                    }
+                                } : () =&gt; {};
+                                const nextBuilder = name === &quot;End&quot; ? codeBuilder : functionBuilder;
+                                functionBuilder[name] = (...args) =&gt; {
+                                    const imms = 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
+                                    checkImms(op, imms);
+                                    checkStackArgs(op);
+                                    checkStackReturn(op);
+                                    const stackArgs = []; // FIXME https://bugs.webkit.org/show_bug.cgi?id=162706
+                                    func.code.push({ name: op, value: value, arguments: stackArgs, immediates: imms });
+                                    return nextBuilder;
+                                };
+                            }
+                            return functionBuilder;
+                        }
+                    };
+                    return codeBuilder;
+                };
+                break;
+            default:
+                this[section] = () =&gt; { throw new Error(`Unimplemented: section type &quot;${section}&quot;`); };
+                break;
+            }
+        }
+        this.Unknown = function(name) {
+            const s = this._addSection(name);
+            const builder = this;
+            const unknownBuilder =  {
+                End: () =&gt; builder,
+                Byte: b =&gt; { if ((b &amp; 0xFF) !== b) throw new RangeError(`Unknown section expected byte, got: &quot;${b}&quot;`); s.data.push(b); return unknownBuilder; }
+            };
+            return unknownBuilder;
+        };
+    }
+    _addSection(nameOrNumber, extraObject) {
+        const name = typeof(nameOrNumber) === &quot;string&quot; ? nameOrNumber : &quot;&quot;;
+        const number = typeof(nameOrNumber) === &quot;number&quot; ? nameOrNumber : (WASM.description.section[name] ? WASM.description.section[name].value : _unknownSectionId);
+        const s = Object.assign({ name: name, id: number, data: [] }, extraObject || {});
+        this._sections.push(s);
+        return s;
+    }
+    optimize() {
+        // FIXME Add more optimizations. https://bugs.webkit.org/show_bug.cgi?id=163424
+        return this;
+    }
+    json() {
+        const obj = {
+            preamble: this._preamble,
+            section: this._sections
+        };
+        return JSON.stringify(obj);
+    }
+    AsmJS() {
+        &quot;use asm&quot;; // For speed.
+        // FIXME Create an asm.js equivalent string which can be eval'd. https://bugs.webkit.org/show_bug.cgi?id=163425
+        throw new Error(&quot;asm.js not implemented yet&quot;);
+    }
+    WebAssembly() { return _BuildWebAssemblyBinary(this._preamble, this._sections); }
+};
</ins></span></pre></div>
<a id="trunkJSTestswasmLowLevelBinaryjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/LowLevelBinary.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/LowLevelBinary.js                                (rev 0)
+++ trunk/JSTests/wasm/LowLevelBinary.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,215 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+const _initialAllocationSize = 1024;
+const _growAllocationSize = allocated =&gt; allocated * 2;
+
+export const varuintMin = 0;
+export const varuint7Max = 0b1111111;
+export const varuintMax = ((((1 &lt;&lt; 31) &gt;&gt;&gt; 0) - 1) * 2) + 1;
+export const varintMin = -((1 &lt;&lt; 31) &gt;&gt;&gt; 0);
+export const varintMax = ((1 &lt;&lt; 31) - 1) &gt;&gt;&gt; 0;
+export const varBitsMax = 5;
+
+const _getterRangeCheck = (llb, at, size) =&gt; {
+    if (0 &gt; at || at + size &gt; llb._used)
+        throw new RangeError(`[${at}, ${at + size}) is out of buffer range [0, ${llb._used})`);
+};
+
+const _hexdump = (buf, size) =&gt; {
+    let s = &quot;&quot;;
+    const width = 16;
+    const base = 16;
+    for (let row = 0; row * width &lt; size; ++row) {
+        const address = (row * width).toString(base);
+        s += &quot;0&quot;.repeat(8 - address.length) + address;
+        let chars = &quot;&quot;;
+        for (let col = 0; col !== width; ++col) {
+            const idx = row * width + col;
+            if (idx &lt; size) {
+                const byte = buf[idx];
+                const bytestr = byte.toString(base);
+                s += &quot; &quot; + (bytestr.length === 1 ? &quot;0&quot; + bytestr : bytestr);
+                chars += 0x20 &lt;= byte &amp;&amp; byte &lt; 0x7F ? String.fromCharCode(byte) : &quot;·&quot;;
+            } else {
+                s += &quot;   &quot;;
+                chars += &quot; &quot;;
+            }
+        }
+        s+= &quot;  |&quot; + chars + &quot;|\n&quot;;
+    }
+    return s;
+};
+
+export default class LowLevelBinary {
+    constructor() {
+        this._buf = new Uint8Array(_initialAllocationSize);
+        this._used = 0;
+    }
+
+    newPatchable(type) { return new PatchableLowLevelBinary(type, this); }
+
+    // Utilities.
+    hexdump() { return _hexdump(this._buf, this._used); }
+    _maybeGrow(bytes) {
+        const allocated = this._buf.length;
+        if (allocated - this._used &lt; bytes) {
+            let buf = new Uint8Array(_growAllocationSize(allocated));
+            buf.set(this._buf);
+            this._buf = buf;
+        }
+    }
+    _push8(v) { this._buf[this._used] = v &amp; 0xFF; this._used += 1; }
+
+    // Data types.
+    uint8(v) {
+        if ((v &amp; 0xFF) &gt;&gt;&gt; 0 !== v)
+            throw new RangeError(`Invalid uint8 ${v}`);
+        this._maybeGrow(1);
+        this._push8(v);
+    }
+    uint16(v) {
+        if ((v &amp; 0xFFFF) &gt;&gt;&gt; 0 !== v)
+            throw new RangeError(`Invalid uint16 ${v}`);
+        this._maybeGrow(2);
+        this._push8(v);
+        this._push8(v &gt;&gt;&gt; 8);
+    }
+    uint32(v) {
+        if ((v &amp; 0xFFFFFFFF) &gt;&gt;&gt; 0 !== v)
+            throw new RangeError(`Invalid uint32 ${v}`);
+        this._maybeGrow(4);
+        this._push8(v);
+        this._push8(v &gt;&gt;&gt; 8);
+        this._push8(v &gt;&gt;&gt; 16);
+        this._push8(v &gt;&gt;&gt; 24);
+    }
+    varuint(v) {
+        if (v &lt; varuintMin || varuintMax &lt; v)
+            throw new RangeError(`Invalid varuint ${v} range is [${varuintMin}, ${varuintMax}]`);
+        while (v &gt;= 0x80) {
+            this.uint8(0x80 | (v &amp; 0x7F));
+            v &gt;&gt;&gt;= 7;
+        }
+        this.uint8(v);
+    }
+    varint(v) {
+        if (v &lt; varintMin || varintMax &lt; v)
+            throw new RangeError(`Invalid varint ${v} range is [${varintMin}, ${varintMax}]`);
+        do {
+            const b = v &amp; 0x7F;
+            v &gt;&gt;= 7;
+            if ((v === 0 &amp;&amp; ((b &amp; 0x40) === 0)) || (v === -1 &amp;&amp; ((b &amp; 0x40) === 0x40))) {
+                this.uint8(b &amp; 0x7F);
+                break;
+            }
+            this.uint8(0x80 | b);
+        } while (true);
+    }
+    varuint7(v) {
+        if (v &lt; varuintMin || varuint7Max &lt; v)
+            throw new RangeError(`Invalid varuint7 ${v} range is [${varuintMin}, ${varuint7Max}]`);
+        this.varuint(v);
+    }
+    string(str) {
+        let patch = this.newPatchable(&quot;varuint&quot;);
+        for (const char of str)
+            patch.uint16(char.charCodeAt());
+        patch.apply();
+    }
+
+    // Getters.
+    getSize() { return this._used; }
+    getUint8(at) {
+        _getterRangeCheck(this, at, 1);
+        return this._buf[at];
+    }
+    getUint16(at) {
+        _getterRangeCheck(this, at, 2);
+        return this._buf[at] | (this._buf[at + 1] &lt;&lt; 8);
+    }
+    getUint32(at) {
+        _getterRangeCheck(this, at, 4);
+        return (this._buf[at] | (this._buf[at + 1] &lt;&lt; 8) | (this._buf[at + 2] &lt;&lt; 16) | (this._buf[at + 3] &lt;&lt; 24)) &gt;&gt;&gt; 0;
+    }
+    getVaruint(at) {
+        let v = 0;
+        let shift = 0;
+        let byte = 0;
+        do {
+            byte = this.getUint8(at++);
+            ++read;
+            v = (v | ((byte &amp; 0x7F) &lt;&lt; shift) &gt;&gt;&gt; 0) &gt;&gt;&gt; 0;
+            shift += 7;
+        } while ((byte &amp; 0x80) !== 0);
+        if (shift - 7 &gt; 32) throw new RangeError(`Shifting too much at ${at}`);
+        if ((shift == 35) &amp;&amp; ((byte &amp; 0xF0) != 0)) throw new Error(`Unexpected non-significant varuint bits in last byte 0x${byte.toString(16)}`);
+        return { value: v, next: at };
+    }
+    getVarint(at) {
+        let v = 0;
+        let shift = 0;
+        let byte = 0;
+        do {
+            byte = this.getUint8(at++);
+            v = (v | ((byte &amp; 0x7F) &lt;&lt; shift) &gt;&gt;&gt; 0) &gt;&gt;&gt; 0;
+            shift += 7;
+        } while ((byte &amp; 0x80) !== 0);
+        if (shift - 7 &gt; 32) throw new RangeError(`Shifting too much at ${at}`);
+        if ((shift == 35) &amp;&amp; (((byte &lt;&lt; 26) &gt;&gt; 30) != ((byte &lt;&lt; 25) &gt;&gt; 31))) throw new Error(`Unexpected non-significant varint bits in last byte 0x${byte.toString(16)}`);
+        if ((byte &amp; 0x40) === 0x40) {
+            const sext = shift &lt; 32 ? 32 - shift : 0;
+            v = (v &lt;&lt; sext) &gt;&gt; sext;
+        }
+        return { value: v, next: at };
+    }
+    getVaruint7(at) {
+        const res = this.getVaruint(at);
+        if (res.value &gt; varuint7Max) throw new Error(`Expected a varuint7, got value ${res.value}`);
+        return res;
+    }
+    getString(at) {
+        const size = this.getVaruint(at);
+        let str = &quot;&quot;;
+        for (let i = size.next; i !== size.next + size.value; i += 2)
+            str += String.fromCharCode(this.getUint16(i));
+        return str;
+    }
+};
+
+class PatchableLowLevelBinary extends LowLevelBinary {
+    constructor(type, lowLevelBinary) {
+        super();
+        this.type = type;
+        this.target = lowLevelBinary;
+        this._buffered_bytes = 0;
+    }
+    _push8(v) { ++this._buffered_bytes; super._push8(v); }
+    apply() {
+        this.target[this.type](this._buffered_bytes);
+        for (let i = 0; i &lt; this._buffered_bytes; ++i)
+            this.target.uint8(this._buf[i]);
+    }
+};
</ins></span></pre></div>
<a id="trunkJSTestswasmREADMEmd"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/README.md (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/README.md                                (rev 0)
+++ trunk/JSTests/wasm/README.md        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+# `wasmjs`: JavaScript tooling for WebAssembly
+
+`wasmjs` is a self-contained collection of JavaScript tools which can manipulate
+WebAssembly. At its core is `wasm.json`, a JSON decription of the WebAssembly
+format and other interesting facts about WebAssembly as used by the Webkit
+project (such as the names of associated JavaScriptCore opcodes).
+
+`wasmjs` requires modern JavaScript features such as ES6 modules, which is
+acceptable because WebAssembly is itself contemporary to these other features.
+
+
+# `Builder` API
+
+The current core API of `wasmjs` is the `Builder` API from `Builder.js`. It is
+used to build WebAssembly modules.
+
+A simple example:
+
+```javascript
+import Builder from 'Builder.js';
+
+const builder = new Builder();
+
+// Construct the equivalent of: (module (func (nop) (nop)))
+builder
+    .Code()
+        .Function()
+            .Nop()
+            .Nop()
+        .End()
+    .End();
+
+// Create an ArrayBuffer which is a valid WebAssembly `.wasm` file.
+const binary = builder.WebAssembly();
+```
+
+Code such as the above can then be used with JavaScript's `WebAssembly` global
+object.
+
+
+# Testing
+
+Tests can be executed using:
+
+```bash
+JSSHELL=/path/to/my/js-shell test.sh
+```
+
+They can also be executed by using WebKit's `run-javascriptcore-tests` tool:
+
+```bash
+./Tools/Scripts/run-javascriptcore-tests --release --filter wasm -arch x86_64
+```
+
+The `self-test` folder contains tests for `wasmjs` itself. Future additions will
+also test the JavaScript engine's WebAssembly implementation (both JavaScript
+API and usage of that API to compile and execute WebAssembly modules).
</ins></span></pre></div>
<a id="trunkJSTestswasmWASMjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/WASM.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/WASM.js                                (rev 0)
+++ trunk/JSTests/wasm/WASM.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import * as utilities from 'utilities.js';
+
+export const description = utilities.json(&quot;wasm.json&quot;);
+export const valueType = Object.keys(description.value_type);
+const _valueTypeSet = new Set(valueType);
+export const isValidValueType = v =&gt; _valueTypeSet.has(v);
+export const sections = Object.keys(description.section);
+export const sectionEncodingType = description.section[sections[0]].type;
</ins></span></pre></div>
<a id="trunkJSTestswasmassertjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/assert.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/assert.js                                (rev 0)
+++ trunk/JSTests/wasm/assert.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+export const notUndef = (v) =&gt; {
+    if (v === undefined)
+        throw new Error(&quot;Shouldn't be undefined&quot;);
+};
+
+export const eq = (lhs, rhs) =&gt; {
+    if (lhs !== rhs)
+        throw new Error(`Not the same: &quot;${lhs}&quot; and &quot;${rhs}&quot;`);
+};
+
+export const ge = (lhs, rhs) =&gt; {
+    notUndef(lhs);
+    notUndef(rhs);
+    if (!(lhs &gt;= rhs))
+        throw new Error(`Expected: &quot;${lhs}&quot; &lt; &quot;${rhs}&quot;`);
+};
+
+export const throwsError = (opFn, message, ...args) =&gt; {
+    if (message)
+        message = &quot; for &quot; + message;
+
+    try {
+        opFn(...args);
+    } catch (e) {
+        if (e instanceof Error)
+            return;
+        throw new Error(`Expected an Error${message}, got ${e}`);
+    }
+    throw new Error(`Expected to throw an Error${message}`);
+};
+
+export const throwsRangeError = (opFn, message, ...args) =&gt; {
+    if (message)
+        message = &quot; for &quot; + message;
+
+    try {
+        opFn(...args);
+    } catch (e) {
+        if (e instanceof RangeError)
+            return;
+        throw new Error(`Expected a RangeError${message}, got ${e}`);
+    }
+    throw new Error(`Expected to throw a RangeError${message}`);
+};
</ins></span></pre></div>
<a id="trunkJSTestswasmgeneratewasmopsheaderjsfromrev207362trunkJSTestsstresswasmgeneratewasmopsheaderjs"></a>
<div class="copfile"><h4>Copied: trunk/JSTests/wasm/generate-wasmops-header.js (from rev 207362, trunk/JSTests/stress/wasm/generate-wasmops-header.js) (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/generate-wasmops-header.js                                (rev 0)
+++ trunk/JSTests/wasm/generate-wasmops-header.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,141 @@
</span><ins>+// Use the JSON description of WebAssembly to generate the JavaScriptCore's WASMOps.h.
+
+const jsonFile = 'wasm.json';
+const wasm = JSON.parse(read(jsonFile));
+const opcodes = wasm.opcode;
+
+// Iterate through opcodes which match filter, and on each iteration yield ret.
+const opcodeIterator = (filter, ret = op =&gt; { return {name: op, opcode: opcodes[op]}; }) =&gt; {
+    return function*() {
+        for (let op in opcodes)
+            if (filter(opcodes[op]))
+                yield ret(op);
+    };
+};
+
+// WebAssembly opcode name to C++ name suitable for JSC.
+const toCpp = name =&gt; {
+    const camelCase = name.replace(/([^a-z0-9].)/g, c =&gt; c[1].toUpperCase());
+    const CamelCase = camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
+    return CamelCase;
+};
+
+const cppMacro = (wasmOpcode, value, b3Opcode) =&gt; &quot; \\\n    macro(&quot; + toCpp(wasmOpcode) + &quot;, 0x&quot; + parseInt(value).toString(16) + &quot;, &quot; + b3Opcode + &quot;)&quot;;
+
+function* opcodeMacroizer(filter) {
+    for (let op of opcodeIterator(filter)())
+        yield cppMacro(op.name, op.opcode.value, op.opcode.b3op || &quot;Oops&quot;);
+}
+
+const defines = [
+    &quot;#define FOR_EACH_WASM_SPECIAL_OP(macro)&quot;,
+    ...opcodeMacroizer(op =&gt; op.category === &quot;special&quot;),
+    &quot;\n\n#define FOR_EACH_WASM_CONTROL_FLOW_OP(macro)&quot;,
+    ...opcodeMacroizer(op =&gt; op.category === &quot;control&quot;),
+    &quot;\n\n#define FOR_EACH_WASM_UNARY_OP(macro)&quot;,
+    ...opcodeMacroizer(op =&gt; op.category === &quot;arithmetic&quot; &amp;&amp; op.parameter.length === 1),
+    &quot;\n\n#define FOR_EACH_WASM_BINARY_OP(macro)&quot;,
+    ...opcodeMacroizer(op =&gt; (op.category === &quot;arithmetic&quot; || op.category === &quot;comparison&quot;) &amp;&amp; op.parameter.length === 2),
+    &quot;\n\n&quot;].join(&quot;&quot;);
+
+const opValueSet = new Set(opcodeIterator(op =&gt; true, op =&gt; opcodes[op].value)());
+const maxOpValue = Math.max(...opValueSet);
+const validOps = (() =&gt; {
+    // Create a bitset of valid ops.
+    let v = &quot;&quot;;
+    for (let i = 0; i &lt; maxOpValue / 8; ++i) {
+        let entry = 0;
+        for (let j = 0; j &lt; 8; ++j)
+            if (opValueSet.has(i * 8 + j))
+                entry |= 1 &lt;&lt; j;
+        v += (i ? &quot;, &quot; : &quot;&quot;) + &quot;0x&quot; + entry.toString(16);
+    }
+    return v;
+})();
+
+const template = `/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. \`\`AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This file is auto-generated using ${jsonFile}.
+
+#pragma once
+
+#if ENABLE(WEBASSEMBLY)
+
+#include &lt;cstdint&gt;
+
+namespace JSC { namespace WASM {
+
+${defines}
+
+#define FOR_EACH_WASM_OP(macro) \\
+    FOR_EACH_WASM_SPECIAL_OP(macro) \\
+    FOR_EACH_WASM_CONTROL_FLOW_OP(macro) \\
+    FOR_EACH_WASM_UNARY_OP(macro) \\
+    FOR_EACH_WASM_BINARY_OP(macro)
+
+#define CREATE_ENUM_VALUE(name, id, b3op) name = id,
+
+enum OpType : uint8_t {
+    FOR_EACH_WASM_OP(CREATE_ENUM_VALUE)
+};
+
+template&lt;typename Int&gt;
+inline bool isValidOpType(Int i)
+{
+    // Bitset of valid ops.
+    static const uint8_t valid[] = { ${validOps} };
+    return 0 &lt;= i &amp;&amp; i &lt;= ${maxOpValue} &amp;&amp; (valid[i / 8] &amp; (1 &lt;&lt; (i % 8)));
+}
+
+enum class BinaryOpType : uint8_t {
+    FOR_EACH_WASM_BINARY_OP(CREATE_ENUM_VALUE)
+};
+
+enum class UnaryOpType : uint8_t {
+    FOR_EACH_WASM_UNARY_OP(CREATE_ENUM_VALUE)
+};
+
+#undef CREATE_ENUM_VALUE
+
+inline bool isControlOp(OpType op)
+{
+    switch (op) {
+#define CREATE_CASE(name, id, b3op) case OpType::name:
+    FOR_EACH_WASM_CONTROL_FLOW_OP(CREATE_CASE)
+        return true;
+#undef CREATE_CASE
+    default:
+        break;
+    }
+    return false;
+}
+
+} } // namespace JSC::WASM
+
+#endif // ENABLE(WEBASSEMBLY)
+`;
+
+print(template);
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_BuilderJSONjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_BuilderJSON.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_BuilderJSON.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_BuilderJSON.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,362 @@
</span><ins>+import * as assert from '../assert.js';
+import Builder from '../Builder.js';
+
+const assertOpThrows = (opFn, message = &quot;&quot;) =&gt; {
+    let f = (new Builder()).Code().Function();
+    assert.throwsError(opFn, message, f);
+};
+
+(function EmptyModule() {
+    const b = new Builder();
+    const j = JSON.parse(b.json());
+    assert.notUndef(j.preamble);
+    assert.notUndef(j.preamble[&quot;magic number&quot;]);
+    assert.notUndef(j.preamble.version);
+    assert.notUndef(j.section);
+    assert.eq(j.section.length, 0);
+})();
+
+(function CustomMagicNumber() {
+    const b = (new Builder()).setPreamble({ &quot;magic number&quot;: 1337 });
+    const j = JSON.parse(b.json());
+    assert.eq(j.preamble[&quot;magic number&quot;], 1337);
+    assert.notUndef(j.preamble.version);
+})();
+
+(function CustomVersion() {
+    const b = (new Builder()).setPreamble({ &quot;version&quot;: 1337 });
+    const j = JSON.parse(b.json());
+    assert.eq(j.preamble[&quot;version&quot;], 1337);
+    assert.notUndef(j.preamble.version);
+})();
+
+(function CustomSection() {
+    const b = new Builder();
+    b.Unknown(&quot;custom section&quot;)
+        .Byte(0x00)
+        .Byte(0x42)
+        .Byte(0xFF);
+    const j = JSON.parse(b.json());
+    assert.eq(j.section.length, 1);
+    assert.eq(j.section[0].name, &quot;custom section&quot;);
+    assert.eq(j.section[0].data.length, 3);
+    assert.eq(j.section[0].data[0], 0x00);
+    assert.eq(j.section[0].data[1], 0x42);
+    assert.eq(j.section[0].data[2], 0xFF);
+})();
+
+(function CustomSectionAllBytes() {
+    const b = new Builder();
+    let u = b.Unknown(&quot;custom section&quot;);
+    for (let i = 0; i !== 0xFF + 1; ++i)
+        u.Byte(i);
+    const j = JSON.parse(b.json());
+    assert.eq(j.section[0].data.length, 256);
+    for (let i = 0; i !== 0xFF + 1; ++i)
+        assert.eq(j.section[0].data[i], i);
+})();
+
+(function CustomSectionInvalidByte() {
+    const b = new Builder();
+    let u = b.Unknown(&quot;custom section&quot;);
+    try {
+        u.Byte(0xFF + 1);
+    } catch (e) {
+        if (e instanceof RangeError) { return; }
+        throw new Error(`Expected a RangeError, got ${e}`);
+    }
+    throw new Error(`Expected to throw a RangeError`);
+})();
+
+(function TwoCustomSections() {
+    const b = new Builder();
+    b.Unknown(&quot;custom section&quot;)
+        .Byte(0x00)
+        .Byte(0x42)
+        .Byte(0xFF)
+    .End()
+    .Unknown(&quot;☃&quot;)
+        .Byte(0x11);
+    const j = JSON.parse(b.json());
+    assert.eq(j.section.length, 2);
+    assert.eq(j.section[0].name, &quot;custom section&quot;);
+    assert.eq(j.section[0].data.length, 3);
+    assert.eq(j.section[1].name, &quot;☃&quot;);
+    assert.eq(j.section[1].data.length, 1);
+    assert.eq(j.section[1].data[0], 0x11);
+})();
+
+(function EmptyCodeSection() {
+    const b = new Builder();
+    b.Code();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section.length, 1);
+    assert.eq(j.section[0].name, &quot;Code&quot;);
+    assert.eq(j.section[0].data.length, 0);
+})();
+
+(function CodeSectionWithEmptyFunction() {
+    const b = new Builder();
+    b.Code()
+        .Function();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section.length, 1);
+    assert.eq(j.section[0].name, &quot;Code&quot;);
+    assert.eq(j.section[0].data.length, 1);
+    assert.eq(j.section[0].data[0].parameterCount, 0);
+    assert.eq(j.section[0].data[0].locals.length, 0);
+    assert.eq(j.section[0].data[0].code.length, 0);
+})();
+
+(function CodeSectionWithEmptyFunctionWithParameters() {
+    const b = new Builder();
+    b.Code()
+        .Function([&quot;i32&quot;, &quot;i64&quot;, &quot;f32&quot;, &quot;f64&quot;]);
+    const j = JSON.parse(b.json());
+    assert.eq(j.section.length, 1);
+    assert.eq(j.section[0].name, &quot;Code&quot;);
+    assert.eq(j.section[0].data.length, 1);
+    assert.eq(j.section[0].data[0].parameterCount, 4);
+    assert.eq(j.section[0].data[0].locals[0], &quot;i32&quot;);
+    assert.eq(j.section[0].data[0].locals[1], &quot;i64&quot;);
+    assert.eq(j.section[0].data[0].locals[2], &quot;f32&quot;);
+    assert.eq(j.section[0].data[0].locals[3], &quot;f64&quot;);
+    assert.eq(j.section[0].data[0].code.length, 0);
+})();
+
+(function InvalidFunctionParameters() {
+    for (let invalid in [&quot;&quot;, &quot;void&quot;, &quot;bool&quot;, &quot;any&quot;, &quot;struct&quot;]) {
+        const c = (new Builder()).Code();
+        try {
+            c.Function([invalid]);
+        } catch (e) {
+            if (e instanceof Error) { continue; }
+            throw new Error(`Expected an Error, got ${e}`);
+        }
+        throw new Error(`Expected to throw an Error for ${invalid}`);
+    }
+})();
+
+(function SimpleFunction() {
+    const b = new Builder();
+    b.Code()
+        .Function()
+            .Nop()
+            .Nop()
+        .End();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section[0].data.length, 1);
+    assert.eq(j.section[0].data[0].locals.length, 0);
+    assert.eq(j.section[0].data[0].code.length, 3);
+    assert.eq(j.section[0].data[0].code[0].name, &quot;nop&quot;);
+    assert.eq(j.section[0].data[0].code[1].name, &quot;nop&quot;);
+    assert.eq(j.section[0].data[0].code[2].name, &quot;end&quot;);
+})();
+
+(function TwoSimpleFunctions() {
+    const b = new Builder();
+    b.Code()
+        .Function()
+            .Nop()
+            .Nop()
+        .End()
+        .Function()
+            .Return()
+        .End();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section[0].data.length, 2);
+    assert.eq(j.section[0].data[0].locals.length, 0);
+    assert.eq(j.section[0].data[0].code.length, 3);
+    assert.eq(j.section[0].data[0].code[0].name, &quot;nop&quot;);
+    assert.eq(j.section[0].data[0].code[1].name, &quot;nop&quot;);
+    assert.eq(j.section[0].data[0].code[2].name, &quot;end&quot;);
+    assert.eq(j.section[0].data[1].locals.length, 0);
+    assert.eq(j.section[0].data[1].code.length, 2);
+    assert.eq(j.section[0].data[1].code[0].name, &quot;return&quot;);
+    assert.eq(j.section[0].data[1].code[1].name, &quot;end&quot;);
+})();
+
+(function TwoBuildersAtTheSameTime() {
+    const b = [new Builder(), new Builder()];
+    const f = b.map(builder =&gt; builder.Code().Function());
+    f[0].Nop();
+    f[1].Return().End().End();
+    f[0].Nop().End().End();
+    const j = b.map(builder =&gt; JSON.parse(builder.json()));
+    assert.eq(j[0].section[0].data[0].code.length, 3);
+    assert.eq(j[0].section[0].data[0].code[0].name, &quot;nop&quot;);
+    assert.eq(j[0].section[0].data[0].code[1].name, &quot;nop&quot;);
+    assert.eq(j[0].section[0].data[0].code[2].name, &quot;end&quot;);
+    assert.eq(j[1].section[0].data[0].code.length, 2);
+    assert.eq(j[1].section[0].data[0].code[0].name, &quot;return&quot;);
+    assert.eq(j[1].section[0].data[0].code[1].name, &quot;end&quot;);
+})();
+
+(function CheckedOpcodeArgumentsTooMany() {
+    assertOpThrows(f =&gt; f.Nop(&quot;uh-oh!&quot;));
+})();
+
+(function UncheckedOpcodeArgumentsTooMany() {
+    (new Builder()).setChecked(false).Code().Function().Nop(&quot;This is fine.&quot;, &quot;I'm OK with the events that are unfolding currently.&quot;);
+})();
+
+(function CheckedOpcodeArgumentsNotEnough() {
+    assertOpThrows(f =&gt; f.I32Const());
+})();
+
+(function UncheckedOpcodeArgumentsNotEnough() {
+    (new Builder()).setChecked(false).Code().Function().I32Const();
+})();
+
+(function CallNoArguments() {
+    const b = (new Builder()).Code().Function().Call(0).End().End();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section[0].data[0].code.length, 2);
+    assert.eq(j.section[0].data[0].code[0].name, &quot;call&quot;);
+    assert.eq(j.section[0].data[0].code[0].arguments.length, 0);
+    assert.eq(j.section[0].data[0].code[0].immediates.length, 1);
+    assert.eq(j.section[0].data[0].code[0].immediates[0], 0);
+    assert.eq(j.section[0].data[0].code[1].name, &quot;end&quot;);
+})();
+
+(function CallInvalid() {
+    for (let c of [-1, 0x100000000, &quot;0&quot;, {}, Infinity, -Infinity, NaN, -NaN, null])
+        assertOpThrows(f =&gt; f.Call(c), c);
+})();
+
+(function I32ConstValid() {
+    for (let c of [0, 1, 2, 42, 1337, 0xFF, 0xFFFF, 0x7FFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF]) {
+        const b = (new Builder()).Code().Function().I32Const(c).Return().End().End();
+        const j = JSON.parse(b.json());
+        assert.eq(j.section[0].data[0].code[0].name, &quot;i32.const&quot;);
+        assert.eq(j.section[0].data[0].code[0].arguments.length, 0);
+        assert.eq(j.section[0].data[0].code[0].immediates.length, 1);
+        assert.eq(j.section[0].data[0].code[0].immediates[0], c);
+    }
+})();
+
+(function I32ConstInvalid() {
+    for (let c of [-1, 0x100000000, 0.1, -0.1, &quot;0&quot;, {}, Infinity, null])
+        assertOpThrows(f =&gt; f.I32Const(c), c);
+})();
+
+// FIXME: test i64. https://bugs.webkit.org/show_bug.cgi?id=163420
+
+(function F32ConstValid() {
+    for (let c of [0, -0., 0.2, Math.PI, 0x100000000]) {
+        const b = (new Builder()).Code().Function().F32Const(c).Return().End().End();
+        const j = JSON.parse(b.json());
+        assert.eq(j.section[0].data[0].code[0].name, &quot;f32.const&quot;);
+        assert.eq(j.section[0].data[0].code[0].arguments.length, 0);
+        assert.eq(j.section[0].data[0].code[0].immediates.length, 1);
+        assert.eq(j.section[0].data[0].code[0].immediates[0], c);
+    }
+})();
+
+(function F32ConstInvalid() {
+    for (let c of [&quot;0&quot;, {}, Infinity, -Infinity, NaN, -NaN, null])
+        assertOpThrows(f =&gt; f.F32Const(c), c);
+})();
+
+(function F64ConstValid() {
+    for (let c of [0, -0., 0.2, Math.PI, 0x100000000]) {
+        const b = (new Builder()).Code().Function().F64Const(c).Return().End().End();
+        const j = JSON.parse(b.json());
+        assert.eq(j.section[0].data[0].code[0].name, &quot;f64.const&quot;);
+        assert.eq(j.section[0].data[0].code[0].arguments.length, 0);
+        assert.eq(j.section[0].data[0].code[0].immediates.length, 1);
+        assert.eq(j.section[0].data[0].code[0].immediates[0], c);
+    }
+})();
+
+(function F64ConstInvalid() {
+    for (let c of [&quot;0&quot;, {}, Infinity, -Infinity, NaN, -NaN, null])
+        assertOpThrows(f =&gt; f.F64Const(c), c);
+})();
+
+(function CallOneFromStack() {
+    const b = (new Builder()).Code()
+        .Function([&quot;i32&quot;])
+            .I32Const(42)
+            .Call(0)
+        .End()
+    .End();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section[0].data[0].code.length, 3);
+    assert.eq(j.section[0].data[0].code[0].name, &quot;i32.const&quot;);
+    assert.eq(j.section[0].data[0].code[0].immediates[0], 42);
+    assert.eq(j.section[0].data[0].code[1].name, &quot;call&quot;);
+    // FIXME: assert.eq(j.section[0].data[0].code[1].arguments.length, 1); https://bugs.webkit.org/show_bug.cgi?id=163267
+    assert.eq(j.section[0].data[0].code[1].immediates.length, 1);
+    assert.eq(j.section[0].data[0].code[1].immediates[0], 0);
+    assert.eq(j.section[0].data[0].code[2].name, &quot;end&quot;);
+})();
+
+// FIXME https://bugs.webkit.org/show_bug.cgi?id=163267 all of these:
+//  test too many pops.
+//  test not enough pops (function has non-empty stack at the end).
+//  test mismatched pop types.
+//  test mismatched function signature (calling with wrong arg types).
+//  test invalid function index.
+//  test function names (both setting and calling them).
+
+(function CallManyFromStack() {
+    const b = (new Builder()).Code()
+          .Function([&quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;, &quot;i32&quot;])
+              .I32Const(42).I32Const(1337).I32Const(0xBEEF).I32Const(0xFFFF)
+              .Call(0)
+        .End()
+    .End();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section[0].data[0].code.length, 6);
+    assert.eq(j.section[0].data[0].code[4].name, &quot;call&quot;);
+    // FIXME: assert.eq(j.section[0].data[0].code[4].arguments.length, 4); https://bugs.webkit.org/show_bug.cgi?id=163267
+    assert.eq(j.section[0].data[0].code[4].immediates.length, 1);
+    assert.eq(j.section[0].data[0].code[4].immediates[0], 0);
+})();
+
+(function OpcodeAdd() {
+    const b = (new Builder()).Code()
+          .Function()
+              .I32Const(42).I32Const(1337)
+              .I32Add()
+              .Return()
+        .End()
+    .End();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section[0].data[0].code.length, 5);
+    assert.eq(j.section[0].data[0].code[2].name, &quot;i32.add&quot;);
+    // FIXME: assert.eq(j.section[0].data[0].code[2].arguments.length, 2); https://bugs.webkit.org/show_bug.cgi?id=163267
+    assert.eq(j.section[0].data[0].code[3].name, &quot;return&quot;);
+    // FIXME check return. https://bugs.webkit.org/show_bug.cgi?id=163267
+})();
+
+(function OpcodeUnreachable() {
+    const b = (new Builder()).Code().Function().Unreachable().End().End();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section[0].data[0].code.length, 2);
+    assert.eq(j.section[0].data[0].code[0].name, &quot;unreachable&quot;);
+})();
+
+(function OpcodeUnreachableCombinations() {
+    (new Builder()).Code().Function().Nop().Unreachable().End().End();
+    (new Builder()).Code().Function().Unreachable().Nop().End().End();
+    (new Builder()).Code().Function().Return().Unreachable().End().End();
+    (new Builder()).Code().Function().Unreachable().Return().End().End();
+    (new Builder()).Code().Function().Call(0).Unreachable().End().End();
+    (new Builder()).Code().Function().Unreachable().Call(0).End().End();
+})();
+
+(function OpcodeSelect() {
+    const b = (new Builder()).Code().Function()
+        .I32Const(1).I32Const(2).I32Const(0)
+        .Select()
+        .Return()
+      .End()
+    .End();
+    const j = JSON.parse(b.json());
+    assert.eq(j.section[0].data[0].code.length, 6);
+    assert.eq(j.section[0].data[0].code[3].name, &quot;select&quot;);
+})();
+
+// FIXME test type mismatch with select. https://bugs.webkit.org/show_bug.cgi?id=163267
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_BuilderWebAssemblyjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_BuilderWebAssembly.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_BuilderWebAssembly.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_BuilderWebAssembly.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+import * as assert from '../assert.js';
+import Builder from '../Builder.js';
+
+(function EmptyModule() {
+    const builder = new Builder();
+    const bin = builder.WebAssembly();
+    // Note: this will change as we update version number.
+    assert.eq(bin.hexdump().trim(),
+              &quot;00000000 00 61 73 6d 0c 00 00 00                          |·asm····        |&quot;);
+})();
+
+(function EmptyModule() {
+    const bin = (new Builder())
+          .setPreamble({ &quot;magic number&quot;: 0x45464F43, version: 0xFFFFFFFF })
+          .WebAssembly();
+    assert.eq(bin.hexdump().trim(),
+              &quot;00000000 43 4f 46 45 ff ff ff ff                          |COFE····        |&quot;);
+})();
+
+(function CustomSection() {
+    const bin = (new Builder())
+        .Unknown(&quot;OHHAI&quot;)
+            .Byte(0xDE)
+            .Byte(0xAD)
+            .Byte(0xC0)
+            .Byte(0xFE)
+        .End()
+        .WebAssembly();
+    assert.eq(bin.hexdump().trim(),
+              [&quot;00000000 00 61 73 6d 0c 00 00 00 00 0f 0a 4f 00 48 00 48  |·asm·······O·H·H|&quot;,
+               &quot;00000010 00 41 00 49 00 de ad c0 fe                       |·A·I·····       |&quot;].join(&quot;\n&quot;));
+})();
+
+(function Basic() {
+    const bin = (new Builder())
+        .Code()
+            .Function()
+                .Nop()
+                .Nop()
+            .End()
+        .End()
+        .WebAssembly();
+    assert.eq(bin.hexdump().trim(),
+              &quot;00000000 00 61 73 6d 0c 00 00 00 0a 06 01 04 00 0a 0a 0f  |·asm············|&quot;);
+})();
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_LowLevelBinary_encodejs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_LowLevelBinary_encode.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_LowLevelBinary_encode.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_LowLevelBinary_encode.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+import LowLevelBinary from '../LowLevelBinary.js';
+
+let b = new LowLevelBinary();
+
+for (let i = 0; i !== 1024 * 3; ++i)
+    b.uint32(i);
+for (let i = 0; i !== 1024 * 3; ++i) {
+    let v = b.getUint32(i * 4);
+    if (v !== i)
+        throw new Error(`Wrote &quot;${i}&quot; and read back &quot;${v}&quot;`);
+}
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_LowLevelBinary_stringjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_LowLevelBinary_string.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_LowLevelBinary_string.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_LowLevelBinary_string.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+import LowLevelBinary from '../LowLevelBinary.js';
+
+const values = [
+    &quot;&quot;,
+    &quot;0&quot;,
+    &quot;Hello, World!&quot;,
+    &quot;Il dit non avec la tête, mais il dit oui avec le cœur&quot;,
+    &quot;焼きたて!! ジャぱん&quot;,
+    &quot;(╯°□°)╯︵ ┻━┻&quot;,
+    &quot;�&quot;,
+    // Should we use code points instead of UTF-16?
+    //        The following doesn't work: &quot;👨‍❤️‍💋‍👨&quot;,
+];
+
+for (const i of values) {
+    let b = new LowLevelBinary();
+    b.string(i);
+    const v = b.getString(0);
+    if (v !== i)
+        throw new Error(`Wrote &quot;${i}&quot; and read back &quot;${v}&quot;`);
+}
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_LowLevelBinary_uint16js"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint16.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint16.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint16.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+import LowLevelBinary from '../LowLevelBinary.js';
+
+let values = [];
+for (let i = 0; i !== 0xFFFF; ++i) values.push(i);
+
+for (const i of values) {
+    let b = new LowLevelBinary();
+    b.uint16(i);
+    const v = b.getUint16(0);
+    if (v !== i)
+        throw new Error(`Wrote &quot;${i}&quot; and read back &quot;${v}&quot;`);
+}
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_LowLevelBinary_uint32js"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint32.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint32.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint32.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+import LowLevelBinary from '../LowLevelBinary.js';
+
+let values = [];
+for (let i = 0; i !== 0xFFFF + 1; ++i) values.push(i);
+for (let i = 0xFFFFFFFF; i !== 0xFFFFFFFF - 0xFFFF - 1; --i) values.push(i);
+
+for (const i of values) {
+    let b = new LowLevelBinary();
+    b.uint32(i);
+    const v = b.getUint32(0);
+    if (v !== i)
+        throw new Error(`Wrote &quot;${i}&quot; and read back &quot;${v}&quot;`);
+}
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_LowLevelBinary_uint8js"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint8.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint8.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_LowLevelBinary_uint8.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+import LowLevelBinary from '../LowLevelBinary.js';
+
+let values = [];
+for (let i = 0; i !== 0xFF; ++i) values.push(i);
+
+for (const i of values) {
+    let b = new LowLevelBinary();
+    b.uint8(i);
+    const v = b.getUint8(0);
+    if (v !== i)
+        throw new Error(`Wrote &quot;${i}&quot; and read back &quot;${v}&quot;`);
+}
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_LowLevelBinary_varintjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_LowLevelBinary_varint.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_LowLevelBinary_varint.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_LowLevelBinary_varint.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+import LowLevelBinary, * as LLB from '../LowLevelBinary.js';
+import * as assert from '../assert.js';
+
+let values = [];
+for (let i = LLB.varintMin; i !== LLB.varintMin + 1024; ++i) values.push(i);
+for (let i = -2048; i !== 2048; ++i) values.push(i);
+for (let i = LLB.varintMax; i !== LLB.varintMax - 1024; --i) values.push(i);
+
+for (const i of values) {
+    let b = new LowLevelBinary();
+    b.varint(i);
+    const v = b.getVarint(0);
+    if (v.value !== i)
+        throw new Error(`Wrote &quot;${i}&quot; and read back &quot;${v}&quot;`);
+    if (v.next !== b.getSize())
+        throw new Error(`Size ${v.next}, expected ${b.getSize()}`);
+}
+
+for (let i = 0; i &lt; LLB.varBitsMax + 1; ++i) {
+    let b = new LowLevelBinary();
+    for (let j = 0; j &lt; i; ++j)
+        b.uint8(0x80);
+    assert.throwsRangeError(() =&gt; b.getVarint(0));
+}
+
+let b = new LowLevelBinary();
+for (let i = 0; i &lt; LLB.varBitsMax; ++i)
+    b.uint8(0x80);
+b.uint8(0x00);
+assert.throwsRangeError(() =&gt; b.getVarint(0));
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_LowLevelBinary_varuintjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_LowLevelBinary_varuint.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_LowLevelBinary_varuint.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_LowLevelBinary_varuint.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+import LowLevelBinary, * as LLB from '../LowLevelBinary.js';
+import * as assert from '../assert.js';
+
+let values = [];
+for (let i = LLB.varuintMin; i !== LLB.varuintMin + 1024; ++i) values.push(i);
+for (let i = LLB.varuintMax; i !== LLB.varuintMax - 1024; --i) values.push(i);
+
+for (const i of values) {
+    let b = new LowLevelBinary();
+    b.varuint(i);
+    const v = b.getVaruint(0);
+    if (v.value !== i)
+        throw new Error(`Wrote &quot;${i}&quot; and read back &quot;${v}&quot;`);
+    if (v.next !== b.getSize())
+        throw new Error(`Size ${v.next}, expected ${b.getSize()}`);
+}
+
+for (let i = 0; i &lt; LLB.varBitsMax + 1; ++i) {
+    let b = new LowLevelBinary();
+    for (let j = 0; j &lt; i; ++j)
+        b.uint8(0x80);
+    assert.throwsRangeError(() =&gt; b.getVaruint(0));
+}
+
+let b = new LowLevelBinary();
+for (let i = 0; i &lt; LLB.varBitsMax; ++i)
+    b.uint8(0x80);
+b.uint8(0x00);
+assert.throwsRangeError(() =&gt; b.getVaruint(0));
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_LowLevelBinary_varuint7js"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_LowLevelBinary_varuint7.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_LowLevelBinary_varuint7.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_LowLevelBinary_varuint7.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+import LowLevelBinary, * as LLB from '../LowLevelBinary.js';
+
+let values = [];
+for (let i = LLB.varuintMin; i &lt;= LLB.varuint7Max; ++i) values.push(i);
+
+for (const i of values) {
+    let b = new LowLevelBinary();
+    b.varuint7(i);
+    const v = b.getVaruint7(0);
+    if (v.value !== i)
+        throw new Error(`Wrote &quot;${i}&quot; and read back &quot;${v}&quot;`);
+    if (v.next !== b.getSize())
+        throw new Error(`Size ${v.next}, expected ${b.getSize()}`);
+}
</ins></span></pre></div>
<a id="trunkJSTestswasmselftesttest_WASMjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/self-test/test_WASM.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/self-test/test_WASM.js                                (rev 0)
+++ trunk/JSTests/wasm/self-test/test_WASM.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+import * as assert from '../assert.js';
+import * as WASM from '../WASM.js';
+
+assert.notUndef(WASM.description);
+assert.notUndef(WASM.valueType);
+assert.ge(WASM.valueType.length, 4);
+
+for (const v of WASM.valueType)
+    if (!WASM.isValidValueType(v))
+        throw new Error(`Expected value ${v} to be a valid value type`);
+
+const expectedFields = [
+    &quot;preamble&quot;,
+    &quot;value_type&quot;,
+    &quot;inline_signature_type&quot;,
+    &quot;external_kind&quot;,
+    &quot;section&quot;,
+    &quot;opcode&quot;,
+];
+for (const e of expectedFields) {
+    assert.notUndef(WASM.description[e]);
+    if (typeof(WASM.description[e]) !== &quot;object&quot;)
+        throw new Error(`Expected description to contain field &quot;${e}&quot;`);
+}
+
+const expectedOpFields = [
+    &quot;category&quot;,
+    &quot;value&quot;,
+    &quot;return&quot;,
+    &quot;parameter&quot;,
+    &quot;immediate&quot;,
+];
+for (const op in WASM.description.opcode)
+    for (const e of expectedOpFields)
+        assert.notUndef(WASM.description.opcode[op][e]);
+
+// FIXME: test for field &quot;b3op&quot; when all arithmetic/ comparison ops have them. https://bugs.webkit.org/show_bug.cgi?id=146064
+
+assert.notUndef(WASM.sections);
+assert.notUndef(WASM.sectionEncodingType);
+for (const section of WASM.sections)
+    assert.eq(WASM.sectionEncodingType, WASM.description.section[section].type);
</ins></span></pre></div>
<a id="trunkJSTestswasmtestsh"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/test.sh (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/test.sh                                (rev 0)
+++ trunk/JSTests/wasm/test.sh        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+#!/bin/bash
+
+set -e
+set -u
+set -x
+
+JSSHELL=&quot;${JSSHELL:-jsc}&quot;
+find . -name &quot;test_*.js&quot; -type f | sort | \
+    xargs -n1 -t -I{} &quot;$JSSHELL&quot; -m {}
+
+&quot;$JSSHELL&quot; -m generate-wasmops-header.js &gt; /dev/null
+
+echo &quot;All tests passed&quot;
</ins><span class="cx">Property changes on: trunk/JSTests/wasm/test.sh
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<ins>+*
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkJSTestswasmutilitiesjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/utilities.js (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/utilities.js                                (rev 0)
+++ trunk/JSTests/wasm/utilities.js        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Portable environment: one of [&quot;node&quot;, &quot;web&quot;, &quot;worker&quot;, &quot;shell&quot;].
+const _environment =
+    ((typeof process === &quot;object&quot; &amp;&amp; typeof require === &quot;function&quot;) ? &quot;node&quot;
+     : (typeof window === &quot;object&quot; ? &quot;web&quot;
+        : (typeof importScripts === &quot;function&quot; ? &quot;worker&quot;
+           : &quot;shell&quot;)));
+
+const _eval = x =&gt; eval.call(null, x);
+
+const _read = filename =&gt; {
+    switch (_environment) {
+    case &quot;node&quot;:   return read(filename);
+    case &quot;web&quot;:    // fallthrough
+    case &quot;worker&quot;: let xhr = new XMLHttpRequest(); xhr.open(&quot;GET&quot;, filename, /*async=*/false); return xhr.responseText;
+    case &quot;shell&quot;:  return read(filename);
+    }
+}
+
+const _load = filename =&gt; {
+    switch (_environment) {
+    case &quot;node&quot;:   // fallthrough
+    case &quot;web&quot;:    // fallthrough
+    case &quot;shell&quot;:  return _eval(_read(filename));
+    case &quot;worker&quot;: return importScripts(filename);
+    }
+}
+
+const _json = filename =&gt; {
+    switch (_environment) {
+    case &quot;node&quot;:   // fallthrough
+    case &quot;shell&quot;:  return JSON.parse(_read(filename));
+    case &quot;web&quot;:    // fallthrough
+    case &quot;worker&quot;: let xhr = new XMLHttpRequest(); xhr.overrideMimeType(&quot;application/json&quot;); xhr.open(&quot;GET&quot;, filename, /*async=*/false); return xhr.response;
+    }
+}
+
+// Use underscore names to avoid clashing with builtin names.
+export { _eval as eval, _read as read, _load as load, _json as json };
</ins></span></pre></div>
<a id="trunkJSTestswasmwasmjson"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/wasm.json (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/wasm.json                                (rev 0)
+++ trunk/JSTests/wasm/wasm.json        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,219 @@
</span><ins>+{
+    &quot;comments&quot;: [&quot;This file describes the WebAssembly ISA.&quot;,
+                 &quot;Scripts in this folder auto-generate C++ code for JavaScriptCore as well as the testing DSL which WebKit's WebAssembly tests use.&quot;,
+                 &quot;When you update this file you need to re-generate the C++ code: jsc ./JSTests/stress/wasm/generate-wasmops-header.js &gt; ./Source/JavaScriptCore/wasm/WASMOps.h&quot;
+                ],
+    &quot;preamble&quot;: [
+        { &quot;name&quot;: &quot;magic number&quot;, &quot;type&quot;: &quot;uint32&quot;, &quot;value&quot;: 1836278016, &quot;description&quot;: &quot;NULL character followed by 'asm'&quot; },
+        { &quot;name&quot;: &quot;version&quot;,      &quot;type&quot;: &quot;uint32&quot;, &quot;value&quot;:         12, &quot;description&quot;: &quot;Version number, will be reset to 1 for MVP&quot; }
+    ],
+    &quot;value_type&quot; : {
+        &quot;i32&quot;: { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 1 },
+        &quot;i64&quot;: { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 2 },
+        &quot;f32&quot;: { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 3 },
+        &quot;f64&quot;: { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 4 }
+    },
+    &quot;inline_signature_type&quot; : {
+        &quot;void&quot;: { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 0 },
+        &quot;i32&quot;:  { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 1 },
+        &quot;i64&quot;:  { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 2 },
+        &quot;f32&quot;:  { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 3 },
+        &quot;f64&quot;:  { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 4 }
+    },
+    &quot;external_kind&quot;: {
+        &quot;Function&quot;: { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 0 },
+        &quot;Table&quot;:    { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 1 },
+        &quot;Memory&quot;:   { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 2 },
+        &quot;Global&quot;:   { &quot;type&quot;: &quot;uint8&quot;, &quot;value&quot;: 3 }
+    },
+    &quot;section&quot; : {
+        &quot;Type&quot;:     { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;:  1, &quot;description&quot;: &quot;Function signature declarations&quot; },
+        &quot;Import&quot;:   { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;:  2, &quot;description&quot;: &quot;Import declarations&quot; },
+        &quot;Function&quot;: { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;:  3, &quot;description&quot;: &quot;Function declarations&quot; },
+        &quot;Table&quot;:    { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;:  4, &quot;description&quot;: &quot;Indirect function table and other tables&quot; },
+        &quot;Memory&quot;:   { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;:  5, &quot;description&quot;: &quot;Memory attributes&quot; },
+        &quot;Global&quot;:   { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;:  6, &quot;description&quot;: &quot;Global declarations&quot; },
+        &quot;Export&quot;:   { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;:  7, &quot;description&quot;: &quot;Exports&quot; },
+        &quot;Start&quot;:    { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;:  8, &quot;description&quot;: &quot;Start function declaration&quot; },
+        &quot;Element&quot;:  { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;:  9, &quot;description&quot;: &quot;Elements section&quot; },
+        &quot;Code&quot;:     { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;: 10, &quot;description&quot;: &quot;Function bodies (code)&quot; },
+        &quot;Data&quot;:     { &quot;type&quot;: &quot;varuint7&quot;, &quot;value&quot;: 11, &quot;description&quot;: &quot;Data segments&quot; }
+    },
+    &quot;opcode&quot;: {
+        &quot;unreachable&quot;:         { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   0, &quot;return&quot;: [],           &quot;parameter&quot;: [],                      &quot;immediate&quot;: [],                                                                                         &quot;description&quot;: &quot;trap immediately&quot; },
+        &quot;block&quot;:               { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   1, &quot;return&quot;: [&quot;control&quot;],  &quot;parameter&quot;: [],                      &quot;immediate&quot;: [{&quot;name&quot;: &quot;sig&quot;, &quot;type&quot;: &quot;inline_signature_type&quot;}],                                         &quot;description&quot;: &quot;begin a sequence of expressions, yielding 0 or 1 values&quot; },
+        &quot;loop&quot;:                { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   2, &quot;return&quot;: [&quot;control&quot;],  &quot;parameter&quot;: [],                      &quot;immediate&quot;: [{&quot;name&quot;: &quot;sig&quot;, &quot;type&quot;: &quot;inline_signature_type&quot;}],                                         &quot;description&quot;: &quot;begin a block which can also form control flow loops&quot; },
+        &quot;if&quot;:                  { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   3, &quot;return&quot;: [&quot;control&quot;],  &quot;parameter&quot;: [&quot;bool&quot;],                &quot;immediate&quot;: [{&quot;name&quot;: &quot;sig&quot;, &quot;type&quot;: &quot;inline_signature_type&quot;}],                                         &quot;description&quot;: &quot;begin if expression&quot; },
+        &quot;else&quot;:                { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   4, &quot;return&quot;: [&quot;control&quot;],  &quot;parameter&quot;: [],                      &quot;immediate&quot;: [],                                                                                         &quot;description&quot;: &quot;begin else expression of if&quot; },
+        &quot;select&quot;:              { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   5, &quot;return&quot;: [&quot;prev&quot;],     &quot;parameter&quot;: [&quot;any&quot;, &quot;prev&quot;, &quot;bool&quot;], &quot;immediate&quot;: [],                                                                                         &quot;description&quot;: &quot;select one of two values based on condition&quot; },
+        &quot;br&quot;:                  { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   6, &quot;return&quot;: [],           &quot;parameter&quot;: [],                      &quot;immediate&quot;: [{&quot;name&quot;: &quot;relative_depth&quot;, &quot;type&quot;: &quot;varuint32&quot;}],                                          &quot;description&quot;: &quot;break that targets an outer nested block&quot; },
+        &quot;br_if&quot;:               { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   7, &quot;return&quot;: [],           &quot;parameter&quot;: [],                      &quot;immediate&quot;: [{&quot;name&quot;: &quot;relative_depth&quot;, &quot;type&quot;: &quot;varuint32&quot;}],                                          &quot;description&quot;: &quot;conditional break that targets an outer nested block&quot; },
+        &quot;br_table&quot;:            { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   8, &quot;return&quot;: [],           &quot;parameter&quot;: [],                      &quot;immediate&quot;: [{&quot;name&quot;: &quot;target_count&quot;,   &quot;type&quot;: &quot;varuint32&quot;,                                            &quot;description&quot;: &quot;number of entries in the target_table&quot;},
+                                                                                                                                                     {&quot;name&quot;: &quot;target_table&quot;,   &quot;type&quot;: &quot;varuint32*&quot;,                                           &quot;description&quot;: &quot;target entries that indicate an outer block or loop to which to break&quot;},
+                                                                                                                                                     {&quot;name&quot;: &quot;default_target&quot;, &quot;type&quot;: &quot;varuint32&quot;,                                            &quot;description&quot;: &quot;an outer block or loop to which to break in the default case&quot;}],
+                                                                                                                                                                                                                                                &quot;description&quot;: &quot;branch table control flow construct&quot; },
+        &quot;return&quot;:              { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:   9, &quot;return&quot;: [],           &quot;parameter&quot;: [],                       &quot;immediate&quot;: [],                                                                                         &quot;description&quot;: &quot;return zero or one value from this function&quot; },
+        &quot;drop&quot;:                { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:  11, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;any&quot;],                  &quot;immediate&quot;: [],                                                                                         &quot;description&quot;: &quot;ignore value&quot; },
+        &quot;nop&quot;:                 { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:  10, &quot;return&quot;: [],           &quot;parameter&quot;: [],                       &quot;immediate&quot;: [],                                                                                         &quot;description&quot;: &quot;no operation&quot; },
+        &quot;end&quot;:                 { &quot;category&quot;: &quot;control&quot;,    &quot;value&quot;:  15, &quot;return&quot;: [],           &quot;parameter&quot;: [],                       &quot;immediate&quot;: [],                                                                                         &quot;description&quot;: &quot;end a block, loop, or if&quot; },
+        &quot;i32.const&quot;:           { &quot;category&quot;: &quot;special&quot;,    &quot;value&quot;:  16, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [],                       &quot;immediate&quot;: [{&quot;name&quot;: &quot;value&quot;,          &quot;type&quot;: &quot;varint32&quot;}],                                           &quot;description&quot;: &quot;a constant value interpreted as i32&quot; },
+        &quot;i64.const&quot;:           { &quot;category&quot;: &quot;special&quot;,    &quot;value&quot;:  17, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [],                       &quot;immediate&quot;: [{&quot;name&quot;: &quot;value&quot;,          &quot;type&quot;: &quot;varint64&quot;}],                                           &quot;description&quot;: &quot;a constant value interpreted as i64&quot; },
+        &quot;f64.const&quot;:           { &quot;category&quot;: &quot;special&quot;,    &quot;value&quot;:  18, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [],                       &quot;immediate&quot;: [{&quot;name&quot;: &quot;value&quot;,          &quot;type&quot;: &quot;uint64&quot;}],                                             &quot;description&quot;: &quot;a constant value interpreted as f64&quot; },
+        &quot;f32.const&quot;:           { &quot;category&quot;: &quot;special&quot;,    &quot;value&quot;:  19, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [],                       &quot;immediate&quot;: [{&quot;name&quot;: &quot;value&quot;,          &quot;type&quot;: &quot;uint32&quot;}],                                             &quot;description&quot;: &quot;a constant value interpreted as f32&quot; },
+        &quot;get_local&quot;:           { &quot;category&quot;: &quot;special&quot;,    &quot;value&quot;:  20, &quot;return&quot;: [&quot;local&quot;],    &quot;parameter&quot;: [],                       &quot;immediate&quot;: [{&quot;name&quot;: &quot;local_index&quot;,    &quot;type&quot;: &quot;varuint32&quot;}],                                          &quot;description&quot;: &quot;read a local variable or parameter&quot; },
+        &quot;set_local&quot;:           { &quot;category&quot;: &quot;special&quot;,    &quot;value&quot;:  21, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;local&quot;],                &quot;immediate&quot;: [{&quot;name&quot;: &quot;local_index&quot;,    &quot;type&quot;: &quot;varuint32&quot;}],                                          &quot;description&quot;: &quot;write a local variable or parameter&quot; },
+        &quot;tee_local&quot;:           { &quot;category&quot;: &quot;special&quot;,    &quot;value&quot;:  25, &quot;return&quot;: [&quot;prev&quot;],     &quot;parameter&quot;: [&quot;any&quot;],                  &quot;immediate&quot;: [{&quot;name&quot;: &quot;local_index&quot;,    &quot;type&quot;: &quot;varuint32&quot;}],                                          &quot;description&quot;: &quot;write a local variable or parameter and return the same value&quot; },
+        &quot;get_global&quot;:          { &quot;category&quot;: &quot;special&quot;,    &quot;value&quot;: 187, &quot;return&quot;: [&quot;global&quot;],   &quot;parameter&quot;: [],                       &quot;immediate&quot;: [{&quot;name&quot;: &quot;global_index&quot;,   &quot;type&quot;: &quot;varuint32&quot;}],                                          &quot;description&quot;: &quot;read a global variable&quot; },
+        &quot;set_global&quot;:          { &quot;category&quot;: &quot;special&quot;,    &quot;value&quot;: 188, &quot;return&quot;: [&quot;&quot;],         &quot;parameter&quot;: [&quot;global&quot;],               &quot;immediate&quot;: [{&quot;name&quot;: &quot;global_index&quot;,   &quot;type&quot;: &quot;varuint32&quot;}],                                          &quot;description&quot;: &quot;write a global variable&quot; },
+        &quot;call&quot;:                { &quot;category&quot;: &quot;call&quot;,       &quot;value&quot;:  22, &quot;return&quot;: [&quot;call&quot;],     &quot;parameter&quot;: [&quot;call&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;function_index&quot;, &quot;type&quot;: &quot;varuint32&quot;}],                                          &quot;description&quot;: &quot;call a function by its index&quot; },
+        &quot;call_indirect&quot;:       { &quot;category&quot;: &quot;call&quot;,       &quot;value&quot;:  23, &quot;return&quot;: [&quot;call&quot;],     &quot;parameter&quot;: [&quot;call&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;type_index&quot;,     &quot;type&quot;: &quot;varuint32&quot;}],                                          &quot;description&quot;: &quot;call a function indirect with an expected signature&quot; },
+        &quot;i32.load8_s&quot;:         { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  32, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i32.load8_u&quot;:         { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  33, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i32.load16_s&quot;:        { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  34, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i32.load16_u&quot;:        { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  35, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i64.load8_s&quot;:         { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  36, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i64.load8_u&quot;:         { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  37, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i64.load16_s&quot;:        { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  38, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i64.load16_u&quot;:        { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  39, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i64.load32_s&quot;:        { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  40, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i64.load32_u&quot;:        { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  41, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i32.load&quot;:            { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  42, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i64.load&quot;:            { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  43, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;f32.load&quot;:            { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  44, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;f64.load&quot;:            { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  45, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;addr&quot;],                 &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;load from memory&quot; },
+        &quot;i32.store8&quot;:          { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  46, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;addr&quot;, &quot;i32&quot;],          &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;store to memory&quot; },
+        &quot;i32.store16&quot;:         { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  47, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;addr&quot;, &quot;i32&quot;],          &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;store to memory&quot; },
+        &quot;i64.store8&quot;:          { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  48, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;addr&quot;, &quot;i64&quot;],          &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;store to memory&quot; },
+        &quot;i64.store16&quot;:         { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  49, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;addr&quot;, &quot;i64&quot;],          &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;store to memory&quot; },
+        &quot;i64.store32&quot;:         { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  50, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;addr&quot;, &quot;i64&quot;],          &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;store to memory&quot; },
+        &quot;i32.store&quot;:           { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  51, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;addr&quot;, &quot;i32&quot;],          &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;store to memory&quot; },
+        &quot;i64.store&quot;:           { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  52, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;addr&quot;, &quot;i64&quot;],          &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;store to memory&quot; },
+        &quot;f32.store&quot;:           { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  53, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;addr&quot;, &quot;f32&quot;],          &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;store to memory&quot; },
+        &quot;f64.store&quot;:           { &quot;category&quot;: &quot;memory&quot;,     &quot;value&quot;:  54, &quot;return&quot;: [],           &quot;parameter&quot;: [&quot;addr&quot;, &quot;f64&quot;],          &quot;immediate&quot;: [{&quot;name&quot;: &quot;flags&quot;,          &quot;type&quot;: &quot;varuint32&quot;}, {&quot;name&quot;: &quot;offset&quot;, &quot;type&quot;: &quot;varuint32&quot;}], &quot;description&quot;: &quot;store to memory&quot; },
+        &quot;current_memory&quot;:      { &quot;category&quot;: &quot;operation&quot;,  &quot;value&quot;:  59, &quot;return&quot;: [&quot;size&quot;],     &quot;parameter&quot;: [],                       &quot;immediate&quot;: [],                                                                                         &quot;description&quot;: &quot;query the size of memory&quot; },
+        &quot;grow_memory&quot;:         { &quot;category&quot;: &quot;operation&quot;,  &quot;value&quot;:  57, &quot;return&quot;: [&quot;size&quot;],     &quot;parameter&quot;: [&quot;size&quot;],                 &quot;immediate&quot;: [],                                                                                         &quot;description&quot;: &quot;grow the size of memory&quot; },
+        &quot;i32.add&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  64, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Add&quot;          },
+        &quot;i32.sub&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  65, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Sub&quot;          },
+        &quot;i32.mul&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  66, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Mul&quot;          },
+        &quot;i32.div_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  67, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Div&quot;          },
+        &quot;i32.div_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  68, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;i32.rem_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  69, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Mod&quot;          },
+        &quot;i32.rem_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  70, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;i32.and&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  71, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitAnd&quot;       },
+        &quot;i32.or&quot;:              { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  72, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitOr&quot;        },
+        &quot;i32.xor&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  73, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitXor&quot;       },
+        &quot;i32.shl&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  74, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Shl&quot;          },
+        &quot;i32.shr_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  75, &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;:  76, &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.rotr&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 182, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;i32.rotl&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 183, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;i32.eq&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  77, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Equal&quot;        },
+        &quot;i32.ne&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  78, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;NotEqual&quot;     },
+        &quot;i32.lt_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  79, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;LessThan&quot;     },
+        &quot;i32.le_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  80, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;LessEqual&quot;    },
+        &quot;i32.lt_u&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  81, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Below&quot;        },
+        &quot;i32.le_u&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  82, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BelowEqual&quot;   },
+        &quot;i32.gt_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  83, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;GreaterThan&quot;  },
+        &quot;i32.ge_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  84, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;GreaterEqual&quot; },
+        &quot;i32.gt_u&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  85, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Above&quot;        },
+        &quot;i32.ge_u&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  86, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;, &quot;i32&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;AboveEqual&quot;   },
+        &quot;i32.clz&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  87, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Clz&quot;          },
+        &quot;i32.ctz&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  88, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i32.popcnt&quot;:          { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  89, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i32.eqz&quot;:             { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;:  90, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.add&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  91, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Add&quot;          },
+        &quot;i64.sub&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  92, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Sub&quot;          },
+        &quot;i64.mul&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  93, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Mul&quot;          },
+        &quot;i64.div_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  94, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Div&quot;          },
+        &quot;i64.div_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  95, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;i64.rem_s&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  96, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Mod&quot;          },
+        &quot;i64.rem_u&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  97, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;i64.and&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  98, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitAnd&quot;       },
+        &quot;i64.or&quot;:              { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;:  99, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitOr&quot;        },
+        &quot;i64.xor&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 100, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BitXor&quot;       },
+        &quot;i64.shl&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 101, &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;: 102, &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;: 103, &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;: 184, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;i64.rotl&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 185, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;i64.eq&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 104, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Equal&quot;        },
+        &quot;i64.ne&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 105, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;NotEqual&quot;     },
+        &quot;i64.lt_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 106, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;LessThan&quot;     },
+        &quot;i64.le_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 107, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;LessEqual&quot;    },
+        &quot;i64.lt_u&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 108, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Below&quot;        },
+        &quot;i64.le_u&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 109, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;BelowEqual&quot;   },
+        &quot;i64.gt_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 110, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;GreaterThan&quot;  },
+        &quot;i64.ge_s&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 111, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;GreaterEqual&quot; },
+        &quot;i64.gt_u&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 112, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Above&quot;        },
+        &quot;i64.ge_u&quot;:            { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 113, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;, &quot;i64&quot;],           &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;AboveEqual&quot;   },
+        &quot;i64.clz&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 114, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: [], &quot;b3op&quot;: &quot;Clz&quot;          },
+        &quot;i64.ctz&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 115, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.popcnt&quot;:          { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 116, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.eqz&quot;:             { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 186, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.add&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 117, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.sub&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 118, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.mul&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 119, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.div&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 120, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.min&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 121, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.max&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 122, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.abs&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 123, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.neg&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 124, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.copysign&quot;:        { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 125, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.ceil&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 126, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.floor&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 127, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.trunc&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 128, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.nearest&quot;:         { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 129, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.sqrt&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 130, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.eq&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 131, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.ne&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 132, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.lt&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 133, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.le&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 134, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.gt&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 135, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f32.ge&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 136, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f32&quot;, &quot;f32&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.add&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 137, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.sub&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 138, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.mul&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 139, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.div&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 140, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.min&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 141, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.max&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 142, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.abs&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 143, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.neg&quot;:             { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 144, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.copysign&quot;:        { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 145, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.ceil&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 146, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.floor&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 147, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.trunc&quot;:           { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 148, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.nearest&quot;:         { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 149, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.sqrt&quot;:            { &quot;category&quot;: &quot;arithmetic&quot;, &quot;value&quot;: 150, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.eq&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 151, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.ne&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 152, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.lt&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 153, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.le&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 154, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.gt&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 155, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;f64.ge&quot;:              { &quot;category&quot;: &quot;comparison&quot;, &quot;value&quot;: 156, &quot;return&quot;: [&quot;bool&quot;],     &quot;parameter&quot;: [&quot;f64&quot;, &quot;f64&quot;],           &quot;immediate&quot;: []                         },
+        &quot;i32.trunc_s/f32&quot;:     { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 157, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i32.trunc_s/f64&quot;:     { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 158, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i32.trunc_u/f32&quot;:     { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 159, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i32.trunc_u/f64&quot;:     { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 160, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i32.wrap/i64&quot;:        { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 161, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.trunc_s/f32&quot;:     { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 162, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.trunc_s/f64&quot;:     { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 163, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.trunc_u/f32&quot;:     { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 164, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.trunc_u/f64&quot;:     { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 165, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.extend_s/i32&quot;:    { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 166, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.extend_u/i32&quot;:    { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 167, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.convert_s/i32&quot;:   { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 168, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.convert_u/i32&quot;:   { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 169, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.convert_s/i64&quot;:   { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 170, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.convert_u/i64&quot;:   { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 171, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.demote/f64&quot;:      { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 172, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f32.reinterpret/i32&quot;: { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 173, &quot;return&quot;: [&quot;f32&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.convert_s/i32&quot;:   { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 174, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.convert_u/i32&quot;:   { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 175, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;i32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.convert_s/i64&quot;:   { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 176, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.convert_u/i64&quot;:   { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 177, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.promote/f32&quot;:     { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 178, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;f64.reinterpret/i64&quot;: { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 179, &quot;return&quot;: [&quot;f64&quot;],      &quot;parameter&quot;: [&quot;i64&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i32.reinterpret/f32&quot;: { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 180, &quot;return&quot;: [&quot;i32&quot;],      &quot;parameter&quot;: [&quot;f32&quot;],                  &quot;immediate&quot;: []                         },
+        &quot;i64.reinterpret/f64&quot;: { &quot;category&quot;: &quot;conversion&quot;, &quot;value&quot;: 181, &quot;return&quot;: [&quot;i64&quot;],      &quot;parameter&quot;: [&quot;f64&quot;],                  &quot;immediate&quot;: []                         }
+    }
+}
</ins></span></pre></div>
<a id="trunkJSTestswasmyaml"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm.yaml (0 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm.yaml                                (rev 0)
+++ trunk/JSTests/wasm.yaml        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+# Copyright (C) 2016 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer. 
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution. 
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+- path: wasm/self-test/
+  cmd: runWebAssembly
</ins></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (207362 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-10-14 23:56:00 UTC (rev 207362)
+++ trunk/Tools/ChangeLog        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-10-14  JF Bastien  &lt;jfbastien@apple.com&gt;
+
+        Basic WebAssembly testing
+
+        Create a small DSL in JavaScript which can build WebAssembly binary modules based on the JSON description of the format as described in:
+        https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md
+
+        This DSL can then be used to write small text description of valid and invalid WebAssembly binaries, making testing the JSC implementation much easier.
+
+        Details and example in README.md.
+
+        Basic WebAssembly testing
+        https://bugs.webkit.org/show_bug.cgi?id=163267
+
+        Reviewed by Keith Miller.
+
+        * Scripts/run-javascriptcore-tests:
+        (runJSCStressTests): run wasm.yaml tests
+        * Scripts/run-jsc-stress-tests: add a WebAssembly-specific runner
+
</ins><span class="cx"> 2016-10-14  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Annotate bots in contributors.json and don't show them on webkit.org/team
</span></span></pre></div>
<a id="trunkToolsScriptsrunjavascriptcoretests"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/run-javascriptcore-tests (207362 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/run-javascriptcore-tests        2016-10-14 23:56:00 UTC (rev 207362)
+++ trunk/Tools/Scripts/run-javascriptcore-tests        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -282,7 +282,8 @@
</span><span class="cx">             &quot;JSTests/controlFlowProfiler.yaml&quot;,
</span><span class="cx">             &quot;JSTests/es6.yaml&quot;,
</span><span class="cx">             &quot;JSTests/modules.yaml&quot;,
</span><del>-            &quot;JSTests/ChakraCore.yaml&quot;);
</del><ins>+            &quot;JSTests/ChakraCore.yaml&quot;,
+            &quot;JSTests/wasm.yaml&quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if ($runMozillaTests) {
</span></span></pre></div>
<a id="trunkToolsScriptsrunjscstresstests"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/run-jsc-stress-tests (207362 => 207363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/run-jsc-stress-tests        2016-10-14 23:56:00 UTC (rev 207362)
+++ trunk/Tools/Scripts/run-jsc-stress-tests        2016-10-15 00:10:31 UTC (rev 207363)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> SCRIPTS_PATH = THIS_SCRIPT_PATH.dirname
</span><span class="cx"> WEBKIT_PATH = SCRIPTS_PATH.dirname.dirname
</span><span class="cx"> LAYOUTTESTS_PATH = WEBKIT_PATH + &quot;LayoutTests&quot;
</span><ins>+WASMTESTS_PATH = WEBKIT_PATH + &quot;JSTests/wasm&quot;
</ins><span class="cx"> CHAKRATESTS_PATH = WEBKIT_PATH + &quot;JSTests/ChakraCore/test&quot;
</span><span class="cx"> raise unless SCRIPTS_PATH.basename.to_s == &quot;Scripts&quot;
</span><span class="cx"> raise unless SCRIPTS_PATH.dirname.basename.to_s == &quot;Tools&quot;
</span><span class="lines">@@ -1153,6 +1154,15 @@
</span><span class="cx">     run(&quot;ftl-no-cjit-small-pool-modules&quot;, &quot;-m&quot;, &quot;--jitMemoryReservationSize=50000&quot;, *(FTL_OPTIONS + NO_CJIT_OPTIONS))
</span><span class="cx"> end
</span><span class="cx"> 
</span><ins>+def runWebAssembly
+    return if !$jitTests
+    return if !$isFTLPlatform
+    modules = Dir[WASMTESTS_PATH + &quot;*.js&quot;].map { |f| File.basename(f) }
+    prepareExtraAbsoluteFiles(WASMTESTS_PATH, [&quot;wasm.json&quot;])
+    prepareExtraRelativeFiles(modules.map { |f| &quot;../&quot; + f }, $collection)
+    run(&quot;default-wasm&quot;, &quot;-m&quot;)
+end
+
</ins><span class="cx"> def runChakra(mode, exception, baselineFile, extraFiles)
</span><span class="cx">     raise unless $benchmark.to_s =~ /\.js$/
</span><span class="cx">     failsWithException = exception != &quot;NoException&quot;
</span></span></pre>
</div>
</div>

</body>
</html>