<!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>[212983] 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/212983">212983</a></dd>
<dt>Author</dt> <dd>jfbastien@apple.com</dd>
<dt>Date</dt> <dd>2017-02-24 18:02:06 -0800 (Fri, 24 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebAssembly: miscellaneous spec fixes
https://bugs.webkit.org/show_bug.cgi?id=168822

Reviewed by Saam Barati.

JSTests:

* wasm.yaml: mark some skip tests as normal, now that they pass
* wasm/Builder.js: error message was wrong, causing extra error if hit
* wasm/js-api/global-error.js: new tests
(assert.throws):
* wasm/spec-tests/call.wast.js: comment out stack check tests
* wasm/spec-tests/call_indirect.wast.js: comment out stack check tests
* wasm/spec-tests/fac.wast.js: comment out stack check tests
* wasm/spec-tests/float_exprs.wast.js: wabt is wrong, bug reported, we should update
* wasm/spec-tests/imports.wast.js: bug in old wabt, fixed in recent wabt
(assert_unlinkable):

Source/JavaScriptCore:

* wasm/WasmModuleParser.cpp: &quot;unknown&quot; sections are now called &quot;custom&quot; sections
* wasm/WasmSections.h:
(JSC::Wasm::validateOrder):
(JSC::Wasm::makeString): fix ASSERT_UNREACHABLE bug in printing
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::constructJSWebAssemblyInstance): disallow i64 import
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::link): disallow i64 export
(JSC::WebAssemblyModuleRecord::evaluate):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTestswasmBuilderjs">trunk/JSTests/wasm/Builder.js</a></li>
<li><a href="#trunkJSTestswasmjsapiglobalerrorjs">trunk/JSTests/wasm/js-api/global-error.js</a></li>
<li><a href="#trunkJSTestswasmspectestscallwastjs">trunk/JSTests/wasm/spec-tests/call.wast.js</a></li>
<li><a href="#trunkJSTestswasmspectestscall_indirectwastjs">trunk/JSTests/wasm/spec-tests/call_indirect.wast.js</a></li>
<li><a href="#trunkJSTestswasmspectestsfacwastjs">trunk/JSTests/wasm/spec-tests/fac.wast.js</a></li>
<li><a href="#trunkJSTestswasmspectestsfloat_exprswastjs">trunk/JSTests/wasm/spec-tests/float_exprs.wast.js</a></li>
<li><a href="#trunkJSTestswasmspectestsimportswastjs">trunk/JSTests/wasm/spec-tests/imports.wast.js</a></li>
<li><a href="#trunkJSTestswasmyaml">trunk/JSTests/wasm.yaml</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmModuleParsercpp">trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmSectionsh">trunk/Source/JavaScriptCore/wasm/WasmSections.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyModuleRecordcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/JSTests/ChangeLog        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2017-02-24  JF Bastien  &lt;jfbastien@apple.com&gt;
+
+        WebAssembly: miscellaneous spec fixes
+        https://bugs.webkit.org/show_bug.cgi?id=168822
+
+        Reviewed by Saam Barati.
+
+        * wasm.yaml: mark some skip tests as normal, now that they pass
+        * wasm/Builder.js: error message was wrong, causing extra error if hit
+        * wasm/js-api/global-error.js: new tests
+        (assert.throws):
+        * wasm/spec-tests/call.wast.js: comment out stack check tests
+        * wasm/spec-tests/call_indirect.wast.js: comment out stack check tests
+        * wasm/spec-tests/fac.wast.js: comment out stack check tests
+        * wasm/spec-tests/float_exprs.wast.js: wabt is wrong, bug reported, we should update
+        * wasm/spec-tests/imports.wast.js: bug in old wabt, fixed in recent wabt
+        (assert_unlinkable):
+
</ins><span class="cx"> 2017-02-23  Saam Barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Intrinsicify parseInt
</span></span></pre></div>
<a id="trunkJSTestswasmBuilderjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/Builder.js (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/Builder.js        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/JSTests/wasm/Builder.js        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx">     else if (mutability === &quot;immutable&quot;)
</span><span class="cx">         return 0;
</span><span class="cx">     else
</span><del>-        throw new Error(`mutability should be either &quot;mutable&quot; or &quot;immutable&quot;, but got ${global.mutablity}`);
</del><ins>+        throw new Error(`mutability should be either &quot;mutable&quot; or &quot;immutable&quot;, but got ${mutability}`);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> const _exportGlobalContinuation = (builder, section, nextBuilder) =&gt; {
</span></span></pre></div>
<a id="trunkJSTestswasmjsapiglobalerrorjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/js-api/global-error.js (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/js-api/global-error.js        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/JSTests/wasm/js-api/global-error.js        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -187,3 +187,26 @@
</span><span class="cx">     const module = new WebAssembly.Module(bin.get());
</span><span class="cx">     assert.throws(() =&gt; new WebAssembly.Instance(module, { imp: { global: imp } }), WebAssembly.LinkError, &quot;imported global must be a number (evaluating 'new WebAssembly.Instance(module, { imp: { global: imp } })')&quot;);
</span><span class="cx"> }
</span><ins>+
+{
+    const builder = new Builder()
+        .Type().End()
+        .Global().I64(0, &quot;immutable&quot;).End()
+        .Export()
+            .Global(&quot;bigInt&quot;, 0)
+        .End();
+    const module = new WebAssembly.Module(builder.WebAssembly().get());
+    assert.throws(() =&gt; new WebAssembly.Instance(module), WebAssembly.LinkError, &quot;exported global cannot be an i64 (evaluating 'new WebAssembly.Instance(module)')&quot;);
+}
+
+{
+    const builder = new Builder()
+        .Type().End()
+        .Import()
+            .Global().I64(&quot;imp&quot;, &quot;global&quot;, &quot;immutable&quot;).End()
+        .End()
+        .Function().End()
+        .Global().GetGlobal(&quot;i64&quot;, 0, &quot;immutable&quot;).End();
+    const module = new WebAssembly.Module(builder.WebAssembly().get());
+    assert.throws(() =&gt; new WebAssembly.Instance(module, { imp: { global: undefined } }), WebAssembly.LinkError, &quot;imported global cannot be an i64 (evaluating 'new WebAssembly.Instance(module, { imp: { global: undefined } })')&quot;);
+}
</ins></span></pre></div>
<a id="trunkJSTestswasmspectestscallwastjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/spec-tests/call.wast.js (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/spec-tests/call.wast.js        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/JSTests/wasm/spec-tests/call.wast.js        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -126,8 +126,9 @@
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;assert_21&quot;]());
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;assert_22&quot;]());
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;assert_23&quot;]());
</span><del>-assert_trap(() =&gt; $$.exports[&quot;runaway&quot;]());
-assert_trap(() =&gt; $$.exports[&quot;mutual-runaway&quot;]());
</del><ins>+// FIXME do stack checks https://bugs.webkit.org/show_bug.cgi?id=165546
+//assert_trap(() =&gt; $$.exports[&quot;runaway&quot;]());
+//assert_trap(() =&gt; $$.exports[&quot;mutual-runaway&quot;]());
</ins><span class="cx"> assert_invalid(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x03\x02\x00\x00\x0a\x0a\x02\x05\x00\x10\x01\x45\x0b\x02\x00\x0b&quot;);
</span><span class="cx"> assert_invalid(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x08\x02\x60\x00\x00\x60\x00\x01\x7e\x03\x03\x02\x00\x01\x0a\x0c\x02\x05\x00\x10\x01\x45\x0b\x04\x00\x42\x01\x0b&quot;);
</span><span class="cx"> assert_invalid(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x08\x02\x60\x00\x00\x60\x01\x7f\x00\x03\x03\x02\x00\x01\x0a\x09\x02\x04\x00\x10\x01\x0b\x02\x00\x0b&quot;);
</span></span></pre></div>
<a id="trunkJSTestswasmspectestscall_indirectwastjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/spec-tests/call_indirect.wast.js (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/spec-tests/call_indirect.wast.js        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/JSTests/wasm/spec-tests/call_indirect.wast.js        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -139,8 +139,9 @@
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;odd&quot;](1), 44);
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;odd&quot;](200), 99);
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;odd&quot;](77), 44);
</span><del>-assert_trap(() =&gt; $$.exports[&quot;runaway&quot;]());
-assert_trap(() =&gt; $$.exports[&quot;mutual-runaway&quot;]());
</del><ins>+// FIXME do stack checks https://bugs.webkit.org/show_bug.cgi?id=165546
+//assert_trap(() =&gt; $$.exports[&quot;runaway&quot;]());
+//assert_trap(() =&gt; $$.exports[&quot;mutual-runaway&quot;]());
</ins><span class="cx"> assert_invalid(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x0a\x09\x01\x07\x00\x41\x00\x11\x00\x00\x0b&quot;);
</span><span class="cx"> assert_invalid(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x04\x04\x01\x70\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x11\x00\x00\x45\x0b&quot;);
</span><span class="cx"> assert_invalid(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x08\x02\x60\x00\x01\x7e\x60\x00\x00\x03\x02\x01\x01\x04\x04\x01\x70\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x11\x00\x00\x45\x0b&quot;);
</span></span></pre></div>
<a id="trunkJSTestswasmspectestsfacwastjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/spec-tests/fac.wast.js (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/spec-tests/fac.wast.js        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/JSTests/wasm/spec-tests/fac.wast.js        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -98,4 +98,5 @@
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;assert_2&quot;]());
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;assert_3&quot;]());
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;assert_4&quot;]());
</span><del>-assert_trap(() =&gt; $$.exports[&quot;assert_5&quot;]());
</del><ins>+// FIXME do stack checks https://bugs.webkit.org/show_bug.cgi?id=165546
+//assert_trap(() =&gt; $$.exports[&quot;assert_5&quot;]());
</ins></span></pre></div>
<a id="trunkJSTestswasmspectestsfloat_exprswastjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/spec-tests/float_exprs.wast.js (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/spec-tests/float_exprs.wast.js        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/JSTests/wasm/spec-tests/float_exprs.wast.js        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -132,8 +132,11 @@
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;f64.no_fold_mul_zero&quot;](-2.0), -0.0);
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;assert_1&quot;]());
</span><span class="cx"> $$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x0e\x03\x60\x01\x7d\x01\x7d\x60\x01\x7c\x01\x7c\x60\x00\x00\x03\x05\x04\x00\x01\x02\x02\x07\x43\x04\x13\x66\x33\x32\x2e\x6e\x6f\x5f\x66\x6f\x6c\x64\x5f\x6d\x75\x6c\x5f\x6f\x6e\x65\x00\x00\x13\x66\x36\x34\x2e\x6e\x6f\x5f\x66\x6f\x6c\x64\x5f\x6d\x75\x6c\x5f\x6f\x6e\x65\x00\x01\x08\x61\x73\x73\x65\x72\x74\x5f\x30\x00\x02\x08\x61\x73\x73\x65\x72\x74\x5f\x31\x00\x03\x0a\x57\x04\x0a\x00\x20\x00\x43\x00\x00\x80\x3f\x94\x0b\x0e\x00\x20\x00\x44\x00\x00\x00\x00\x00\x00\xf0\x3f\xa2\x0b\x19\x00\x02\x40\x43\x00\x00\xa0\x7f\x10\x00\xbc\x43\x00\x00\xe0\x7f\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b\x21\x00\x02\x40\x44\x00\x00\x00\x00\x00\x00\xf4\x7f\x10\x01\xbd\x44\x00\x00\x00\x00\x00\x00\xfc\x7f\xbd\x51\x45\x0d\x00\x0f\x0b\x00\x0b&quot;);
</span><del>-assert_return(() =&gt; $$.exports[&quot;assert_0&quot;]());
-assert_return(() =&gt; $$.exports[&quot;assert_1&quot;]());
</del><ins>+// FIXME The following spec tests seem to mistranslate with wabt:
+//   (assert_return (invoke &quot;f32.no_fold_mul_one&quot; (f32.const nan:0x200000)) (f32.const nan:0x600000))
+//   (assert_return (invoke &quot;f64.no_fold_mul_one&quot; (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+//assert_return(() =&gt; $$.exports[&quot;assert_0&quot;]());
+//assert_return(() =&gt; $$.exports[&quot;assert_1&quot;]());
</ins><span class="cx"> $$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x0e\x03\x60\x01\x7d\x01\x7d\x60\x01\x7c\x01\x7c\x60\x00\x00\x03\x07\x06\x00\x01\x02\x02\x02\x02\x07\x5b\x06\x14\x66\x33\x32\x2e\x6e\x6f\x5f\x66\x6f\x6c\x64\x5f\x7a\x65\x72\x6f\x5f\x64\x69\x76\x00\x00\x14\x66\x36\x34\x2e\x6e\x6f\x5f\x66\x6f\x6c\x64\x5f\x7a\x65\x72\x6f\x5f\x64\x69\x76\x00\x01\x08\x61\x73\x73\x65\x72\x74\x5f\x30\x00\x02\x08\x61\x73\x73\x65\x72\x74\x5f\x31\x00\x03\x08\x61\x73\x73\x65\x72\x74\x5f\x32\x00\x04\x08\x61\x73\x73\x65\x72\x74\x5f\x33\x00\x05\x0a\x93\x01\x06\x0a\x00\x43\x00\x00\x00\x00\x20\x00\x95\x0b\x0e\x00\x44\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\xa3\x0b\x19\x00\x02\x40\x43\x00\x00\xc0\x7f\x10\x00\xbc\x43\x00\x00\xc0\x7f\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b\x19\x00\x02\x40\x43\x00\x00\xa0\x7f\x10\x00\xbc\x43\x00\x00\xe0\x7f\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b\x21\x00\x02\x40\x44\x00\x00\x00\x00\x00\x00\xf8\x7f\x10\x01\xbd\x44\x00\x00\x00\x00\x00\x00\xf8\x7f\xbd\x51\x45\x
 0d\x00\x0f\x0b\x00\x0b\x21\x00\x02\x40\x44\x00\x00\x00\x00\x00\x00\xf4\x7f\x10\x01\xbd\x44\x00\x00\x00\x00\x00\x00\xfc\x7f\xbd\x51\x45\x0d\x00\x0f\x0b\x00\x0b&quot;);
</span><span class="cx"> assert_return_nan(() =&gt; $$.exports[&quot;f32.no_fold_zero_div&quot;](f32(0.0)));
</span><span class="cx"> assert_return_nan(() =&gt; $$.exports[&quot;f32.no_fold_zero_div&quot;](f32(-0.0)));
</span><span class="lines">@@ -375,7 +378,9 @@
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;no_fold_demote_promote&quot;](-4.7074160416121775e-27), -4.7074161331556024e-27);
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;no_fold_demote_promote&quot;](2.335945149795088e+31), 2.3359452224542198e+31);
</span><span class="cx"> $$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x09\x02\x60\x01\x7d\x01\x7d\x60\x00\x00\x03\x03\x02\x00\x01\x07\x25\x02\x16\x6e\x6f\x5f\x66\x6f\x6c\x64\x5f\x70\x72\x6f\x6d\x6f\x74\x65\x5f\x64\x65\x6d\x6f\x74\x65\x00\x00\x08\x61\x73\x73\x65\x72\x74\x5f\x30\x00\x01\x0a\x22\x02\x06\x00\x20\x00\xbb\xb6\x0b\x19\x00\x02\x40\x43\x00\x00\xa0\x7f\x10\x00\xbc\x43\x00\x00\xe0\x7f\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b&quot;);
</span><del>-assert_return(() =&gt; $$.exports[&quot;assert_0&quot;]());
</del><ins>+// FIXME The following spec tests seem to mistranslate with wabt:
+//   (assert_return (invoke &quot;no_fold_promote_demote&quot; (f32.const nan:0x200000)) (f32.const nan:0x600000))
+//assert_return(() =&gt; $$.exports[&quot;assert_0&quot;]());
</ins><span class="cx"> assert_return(() =&gt; $$.exports[&quot;no_fold_promote_demote&quot;](f32(0.0)), f32(0.0));
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;no_fold_promote_demote&quot;](f32(-0.0)), f32(-0.0));
</span><span class="cx"> assert_return(() =&gt; $$.exports[&quot;no_fold_promote_demote&quot;](f32(1.40129846432e-45)), f32(1.40129846432e-45));
</span></span></pre></div>
<a id="trunkJSTestswasmspectestsimportswastjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/spec-tests/imports.wast.js (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/spec-tests/imports.wast.js        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/JSTests/wasm/spec-tests/imports.wast.js        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> function assert_unlinkable(bytes) {
</span><span class="cx">   let mod = module(bytes);
</span><span class="cx">   try { new WebAssembly.Instance(mod, registry) } catch (e) {
</span><del>-    if (e instanceof TypeError) return;
</del><ins>+      if (e instanceof WebAssembly.LinkError) return; // Note: this is fixed in tip-of-tree wabt.
</ins><span class="cx">   }
</span><span class="cx">   throw new Error(&quot;Wasm linking failure expected&quot;);
</span><span class="cx"> }
</span><span class="lines">@@ -94,9 +94,10 @@
</span><span class="cx"> 
</span><span class="cx"> $$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x1e\x07\x60\x00\x00\x60\x01\x7f\x00\x60\x01\x7d\x00\x60\x00\x01\x7f\x60\x00\x01\x7d\x60\x01\x7f\x01\x7f\x60\x01\x7e\x01\x7e\x03\x08\x07\x00\x01\x02\x03\x04\x05\x06\x04\x04\x01\x70\x00\x0a\x05\x03\x01\x00\x02\x06\x0e\x02\x7f\x00\x41\x37\x0b\x7d\x00\x43\x00\x00\x30\x42\x0b\x07\x8e\x01\x0b\x04\x66\x75\x6e\x63\x00\x00\x08\x66\x75\x6e\x63\x2d\x69\x33\x32\x00\x01\x08\x66\x75\x6e\x63\x2d\x66\x33\x32\x00\x02\x09\x66\x75\x6e\x63\x2d\x3e\x69\x33\x32\x00\x03\x09\x66\x75\x6e\x63\x2d\x3e\x66\x33\x32\x00\x04\x0d\x66\x75\x6e\x63\x2d\x69\x33\x32\x2d\x3e\x69\x33\x32\x00\x05\x0d\x66\x75\x6e\x63\x2d\x69\x36\x34\x2d\x3e\x69\x36\x34\x00\x06\x0a\x67\x6c\x6f\x62\x61\x6c\x2d\x69\x33\x32\x03\x00\x0a\x67\x6c\x6f\x62\x61\x6c\x2d\x66\x33\x32\x03\x01\x0c\x74\x61\x62\x6c\x65\x2d\x31\x30\x2d\x69\x6e\x66\x01\x00\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x00\x0a\x21\x07\x02\x00\x0b\x02\x00\x0b\x02\x00\x0b\x04\x00\
 x41\x16\x0b\x07\x00\x43\x00\x00\x30\x41\x0b\x04\x00\x20\x00\x0b\x04\x00\x20\x00\x0b&quot;);
</span><span class="cx"> register(&quot;test&quot;, $$)
</span><del>-$$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x23\x08\x60\x01\x7f\x00\x60\x01\x7e\x00\x60\x01\x7d\x00\x60\x01\x7c\x00\x60\x02\x7f\x7d\x00\x60\x02\x7c\x7c\x00\x60\x01\x7e\x01\x7e\x60\x00\x00\x02\xc0\x01\x0b\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x05\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x03\x04\x74\x65\x73\x74\x0d\x66\x75\x6e\x63\x2d\x69\x36\x34\x2d\x3e\x69\x36\x34\x00\
 x06\x03\x04\x03\x00\x01\x07\x04\x05\x01\x70\x01\x02\x02\x07\x20\x03\x07\x70\x72\x69\x6e\x74\x33\x32\x00\x0b\x07\x70\x72\x69\x6e\x74\x36\x34\x00\x0c\x08\x61\x73\x73\x65\x72\x74\x5f\x30\x00\x0d\x09\x08\x01\x00\x41\x00\x0b\x02\x02\x05\x0a\x70\x03\x2c\x01\x01\x7d\x20\x00\xb2\x21\x01\x20\x00\x10\x00\x20\x00\x41\x01\x6a\x43\x00\x00\x28\x42\x10\x06\x20\x00\x10\x02\x20\x00\x10\x08\x20\x01\x10\x04\x20\x00\x41\x00\x11\x00\x00\x0b\x35\x01\x01\x7c\x20\x00\x10\x0a\xb9\x21\x01\x20\x00\x10\x01\x20\x01\x44\x00\x00\x00\x00\x00\x00\xf0\x3f\xa0\x44\x00\x00\x00\x00\x00\x80\x4a\x40\x10\x07\x20\x01\x10\x05\x20\x01\x10\x09\x20\x01\x41\x01\x11\x03\x00\x0b\x0b\x00\x02\x40\x42\x18\x10\x0c\x0f\x0b\x00\x0b&quot;);
-assert_return(() =&gt; $$.exports[&quot;print32&quot;](13));
-assert_return(() =&gt; $$.exports[&quot;assert_0&quot;]());
</del><ins>+// FIXME re-exporting an import isn't implemented. https://bugs.webkit.org/show_bug.cgi?id=165510
+//$$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x23\x08\x60\x01\x7f\x00\x60\x01\x7e\x00\x60\x01\x7d\x00\x60\x01\x7c\x00\x60\x02\x7f\x7d\x00\x60\x02\x7c\x7c\x00\x60\x01\x7e\x01\x7e\x60\x00\x00\x02\xc0\x01\x0b\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x05\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x03\x04\x74\x65\x73\x74\x0d\x66\x75\x6e\x63\x2d\x69\x36\x34\x2d\x3e\x69\x36\x34\x00\x06\x03\x0
 4\x03\x00\x01\x07\x04\x05\x01\x70\x01\x02\x02\x07\x20\x03\x07\x70\x72\x69\x6e\x74\x33\x32\x00\x0b\x07\x70\x72\x69\x6e\x74\x36\x34\x00\x0c\x08\x61\x73\x73\x65\x72\x74\x5f\x30\x00\x0d\x09\x08\x01\x00\x41\x00\x0b\x02\x02\x05\x0a\x70\x03\x2c\x01\x01\x7d\x20\x00\xb2\x21\x01\x20\x00\x10\x00\x20\x00\x41\x01\x6a\x43\x00\x00\x28\x42\x10\x06\x20\x00\x10\x02\x20\x00\x10\x08\x20\x01\x10\x04\x20\x00\x41\x00\x11\x00\x00\x0b\x35\x01\x01\x7c\x20\x00\x10\x0a\xb9\x21\x01\x20\x00\x10\x01\x20\x01\x44\x00\x00\x00\x00\x00\x00\xf0\x3f\xa0\x44\x00\x00\x00\x00\x00\x80\x4a\x40\x10\x07\x20\x01\x10\x05\x20\x01\x10\x09\x20\x01\x41\x01\x11\x03\x00\x0b\x0b\x00\x02\x40\x42\x18\x10\x0c\x0f\x0b\x00\x0b&quot;);
+//assert_return(() =&gt; $$.exports[&quot;print32&quot;](13));
+//assert_return(() =&gt; $$.exports[&quot;assert_0&quot;]());
</ins><span class="cx"> $$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x02\x0d\x01\x04\x74\x65\x73\x74\x04\x66\x75\x6e\x63\x00\x00&quot;);
</span><span class="cx"> $$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x05\x01\x60\x01\x7f\x00\x02\x11\x01\x04\x74\x65\x73\x74\x08\x66\x75\x6e\x63\x2d\x69\x33\x32\x00\x00&quot;);
</span><span class="cx"> $$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x05\x01\x60\x01\x7d\x00\x02\x11\x01\x04\x74\x65\x73\x74\x08\x66\x75\x6e\x63\x2d\x66\x33\x32\x00\x00&quot;);
</span><span class="lines">@@ -128,11 +129,12 @@
</span><span class="cx"> assert_unlinkable(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x02\x13\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x00\x00&quot;);
</span><span class="cx"> assert_unlinkable(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x02\x12\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x74\x61\x62\x6c\x65\x00\x00&quot;);
</span><span class="cx"> assert_unlinkable(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x02\x13\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x00\x00&quot;);
</span><del>-$$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x05\x01\x60\x00\x01\x7f\x02\x86\x01\x07\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7e\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7d\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7c\x00\x03\x05\x04\x00\x00\x00\x00\x07\x21\x04\x05\x67\x65\x74\x2d\x30\x00\x00\x05\x67\x65\x74\x2d\x31\x00\x01\x05\x67\x65\x74\x2d\x78\x00\x02\x05\x67\x65\x74\x2d\x79\x00\x03\x0a\x15\x04\x04\x00\x23\x00\x0b\x04\x00\x23\x01\x0b\x04\x00\x23\x02\x0b\x04\x00\x23\x03\x0b&quot;);
-assert_return(() =&gt; $$.exports[&quot;get-0&quot;](), 666);
-assert_return(() =&gt; $$.exports[&quot;get-1&quot;](), 666);
-assert_return(() =&gt; $$.exports[&quot;get-x&quot;](), 666);
-assert_return(() =&gt; $$.exports[&quot;get-y&quot;](), 666);
</del><ins>+// FIXME i64 global was fixed in ToT spec repo. Update spec tests for newer version. https://bugs.webkit.org/show_bug.cgi?id=168784
+//$$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x05\x01\x60\x00\x01\x7f\x02\x86\x01\x07\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7e\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7d\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x67\x6c\x6f\x62\x61\x6c\x03\x7c\x00\x03\x05\x04\x00\x00\x00\x00\x07\x21\x04\x05\x67\x65\x74\x2d\x30\x00\x00\x05\x67\x65\x74\x2d\x31\x00\x01\x05\x67\x65\x74\x2d\x78\x00\x02\x05\x67\x65\x74\x2d\x79\x00\x03\x0a\x15\x04\x04\x00\x23\x00\x0b\x04\x00\x23\x01\x0b\x04\x00\x23\x02\x0b\x04\x00\x23\x03\x0b&quot;);
+//assert_return(() =&gt; $$.exports[&quot;get-0&quot;](), 666);
+//assert_return(() =&gt; $$.exports[&quot;get-1&quot;](), 666);
+//assert_return(() =&gt; $$.exports[&quot;get-x&quot;](), 666);
+//assert_return(() =&gt; $$.exports[&quot;get-y&quot;](), 666);
</ins><span class="cx"> $$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x14\x01\x04\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x2d\x69\x33\x32\x03\x7f\x00&quot;);
</span><span class="cx"> $$ = instance(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x14\x01\x04\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x2d\x66\x33\x32\x03\x7d\x00&quot;);
</span><span class="cx"> assert_unlinkable(&quot;\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x11\x01\x04\x74\x65\x73\x74\x07\x75\x6e\x6b\x6e\x6f\x77\x6e\x03\x7f\x00&quot;);
</span></span></pre></div>
<a id="trunkJSTestswasmyaml"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm.yaml (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm.yaml        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/JSTests/wasm.yaml        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -52,10 +52,10 @@
</span><span class="cx">   cmd: runWebAssemblySpecTest :normal
</span><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/call.wast.js
</span><del>-  cmd: runWebAssemblySpecTest :skip
</del><ins>+  cmd: runWebAssemblySpecTest :normal
</ins><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/call_indirect.wast.js
</span><del>-  cmd: runWebAssemblySpecTest :skip
</del><ins>+  cmd: runWebAssemblySpecTest :normal
</ins><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/comments.wast.js
</span><span class="cx">   cmd: runWebAssemblySpecTest :normal
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">   cmd: runWebAssemblySpecTest :normal
</span><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/custom_section.wast.js
</span><del>-  cmd: runWebAssemblySpecTest :skip
</del><ins>+  cmd: runWebAssemblySpecTest :normal
</ins><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/endianness.wast.js
</span><span class="cx">   cmd: runWebAssemblySpecTest :normal
</span><span class="lines">@@ -85,10 +85,10 @@
</span><span class="cx">   cmd: runWebAssemblySpecTest :normal
</span><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/fac.wast.js
</span><del>-  cmd: runWebAssemblySpecTest :skip
</del><ins>+  cmd: runWebAssemblySpecTest :normal
</ins><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/float_exprs.wast.js
</span><del>-  cmd: runWebAssemblySpecTest :skip
</del><ins>+  cmd: runWebAssemblySpecTest :normal
</ins><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/float_literals.wast.js
</span><span class="cx">   cmd: runWebAssemblySpecTest :normal
</span><span class="lines">@@ -121,7 +121,7 @@
</span><span class="cx">   cmd: runWebAssemblySpecTest :normal
</span><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/imports.wast.js
</span><del>-  cmd: runWebAssemblySpecTest :skip
</del><ins>+  cmd: runWebAssemblySpecTest :normal
</ins><span class="cx"> 
</span><span class="cx"> - path: wasm/spec-tests/int_exprs.wast.js
</span><span class="cx">   cmd: runWebAssemblySpecTest :normal
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-02-24  JF Bastien  &lt;jfbastien@apple.com&gt;
+
+        WebAssembly: miscellaneous spec fixes
+        https://bugs.webkit.org/show_bug.cgi?id=168822
+
+        Reviewed by Saam Barati.
+
+        * wasm/WasmModuleParser.cpp: &quot;unknown&quot; sections are now called &quot;custom&quot; sections
+        * wasm/WasmSections.h:
+        (JSC::Wasm::validateOrder):
+        (JSC::Wasm::makeString): fix ASSERT_UNREACHABLE bug in printing
+        * wasm/js/WebAssemblyInstanceConstructor.cpp:
+        (JSC::constructJSWebAssemblyInstance): disallow i64 import
+        * wasm/js/WebAssemblyModuleRecord.cpp:
+        (JSC::WebAssemblyModuleRecord::link): disallow i64 export
+        (JSC::WebAssemblyModuleRecord::evaluate):
+
</ins><span class="cx"> 2017-02-24  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move Arg::Type and Arg::Width out into the B3 namespace, since they are general concepts
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmModuleParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -59,13 +59,13 @@
</span><span class="cx">     if (versionNumber != 0xD) // FIXME Stop supporting version 0xD temporarily. https://bugs.webkit.org/show_bug.cgi?id=168788
</span><span class="cx">         WASM_PARSER_FAIL_IF(versionNumber != expectedVersionNumber, &quot;unexpected version number &quot;, versionNumber, &quot; expected &quot;, expectedVersionNumber);
</span><span class="cx"> 
</span><del>-    Section previousSection = Section::Unknown;
</del><ins>+    Section previousSection = Section::Custom;
</ins><span class="cx">     while (m_offset &lt; length()) {
</span><span class="cx">         uint8_t sectionByte;
</span><span class="cx"> 
</span><span class="cx">         WASM_PARSER_FAIL_IF(!parseUInt7(sectionByte), &quot;can't get section byte&quot;);
</span><span class="cx"> 
</span><del>-        Section section = Section::Unknown;
</del><ins>+        Section section = Section::Custom;
</ins><span class="cx">         if (sectionByte) {
</span><span class="cx">             if (isValidSection(sectionByte))
</span><span class="cx">                 section = static_cast&lt;Section&gt;(sectionByte);
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx">         FOR_EACH_WASM_SECTION(WASM_SECTION_PARSE)
</span><span class="cx"> #undef WASM_SECTION_PARSE
</span><span class="cx"> 
</span><del>-        case Section::Unknown: {
</del><ins>+        case Section::Custom: {
</ins><span class="cx">             WASM_FAIL_IF_HELPER_FAILS(parseCustom(sectionLength));
</span><span class="cx">             break;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmSectionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmSections.h (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmSections.h        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/Source/JavaScriptCore/wasm/WasmSections.h        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> #define DEFINE_WASM_SECTION_ENUM(NAME, ID, DESCRIPTION) NAME = ID,
</span><span class="cx">     FOR_EACH_WASM_SECTION(DEFINE_WASM_SECTION_ENUM)
</span><span class="cx"> #undef DEFINE_WASM_SECTION_ENUM
</span><del>-    Unknown
</del><ins>+    Custom
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename Int&gt;
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx"> 
</span><span class="cx"> static inline bool validateOrder(Section previous, Section next)
</span><span class="cx"> {
</span><del>-    if (previous == Section::Unknown)
</del><ins>+    if (previous == Section::Custom)
</ins><span class="cx">         return true;
</span><span class="cx">     return static_cast&lt;uint8_t&gt;(previous) &lt; static_cast&lt;uint8_t&gt;(next);
</span><span class="cx"> }
</span><span class="lines">@@ -71,12 +71,11 @@
</span><span class="cx"> static inline const char* makeString(Section section)
</span><span class="cx"> {
</span><span class="cx">     switch (section) {
</span><ins>+    case Section::Custom:
+        return &quot;Custom&quot;;
</ins><span class="cx"> #define STRINGIFY_SECTION_NAME(NAME, ID, DESCRIPTION) case Section::NAME: return #NAME;
</span><span class="cx">         FOR_EACH_WASM_SECTION(STRINGIFY_SECTION_NAME)
</span><span class="cx"> #undef STRINGIFY_SECTION_NAME
</span><del>-    default:
-        RELEASE_ASSERT_NOT_REACHED();
-        return &quot;?&quot;;
</del><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -203,7 +203,9 @@
</span><span class="cx">             // 5. If i is a global import:
</span><span class="cx">             // i. If i is not an immutable global, throw a TypeError.
</span><span class="cx">             ASSERT(moduleInformation.globals[import.kindIndex].mutability == Wasm::Global::Immutable);
</span><del>-            // ii. If Type(v) is not Number, throw a TypeError.
</del><ins>+            // ii. If the global_type of i is i64 or Type(v) is not Number, throw a WebAssembly.LinkError.
+            if (moduleInformation.globals[import.kindIndex].type == Wasm::I64)
+                return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral(&quot;imported global cannot be an i64&quot;))));
</ins><span class="cx">             if (!value.isNumber())
</span><span class="cx">                 return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral(&quot;imported global must be a number&quot;))));
</span><span class="cx">             // iii. Append ToWebAssemblyValue(v) to imports.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyModuleRecordcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp (212982 => 212983)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp        2017-02-25 01:17:15 UTC (rev 212982)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp        2017-02-25 02:02:06 UTC (rev 212983)
</span><span class="lines">@@ -148,6 +148,10 @@
</span><span class="cx">                 exportedValue = JSValue(instance-&gt;loadI32Global(exp.kindIndex));
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><ins>+            case Wasm::I64:
+                throwException(state, scope, createJSWebAssemblyLinkError(state, vm, ASCIILiteral(&quot;exported global cannot be an i64&quot;)));
+                return;
+
</ins><span class="cx">             case Wasm::F32:
</span><span class="cx">                 exportedValue = JSValue(instance-&gt;loadF32Global(exp.kindIndex));
</span><span class="cx">                 break;
</span><span class="lines">@@ -238,7 +242,7 @@
</span><span class="cx">                 JSWebAssemblyCallee* wasmEntrypointCallee = module-&gt;wasmEntrypointCalleeFromFunctionIndexSpace(functionIndex);
</span><span class="cx">                 Wasm::SignatureIndex signatureIndex = module-&gt;signatureIndexFromFunctionIndexSpace(functionIndex);
</span><span class="cx">                 const Wasm::Signature* signature = Wasm::SignatureInformation::get(&amp;vm, signatureIndex);
</span><del>-                // FIXME: Say we export local function &quot;foo&quot; at funciton index 0.
</del><ins>+                // FIXME: Say we export local function &quot;foo&quot; at function index 0.
</ins><span class="cx">                 // What if we also set it to the table an Element w/ index 0.
</span><span class="cx">                 // Does (new Instance(...)).exports.foo === table.get(0)?
</span><span class="cx">                 // https://bugs.webkit.org/show_bug.cgi?id=165825
</span></span></pre>
</div>
</div>

</body>
</html>