<!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>[210073] 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/210073">210073</a></dd>
<dt>Author</dt> <dd>jfbastien@apple.com</dd>
<dt>Date</dt> <dd>2016-12-21 12:34:04 -0800 (Wed, 21 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>WebAssembly JS API: cleanup & pass VM around to {Compile/Runtime}Error
https://bugs.webkit.org/show_bug.cgi?id=166295
<rdar://problem/29762017>
Reviewed by Mark Lam.
JSTests:
Update tests to generate new error messages. Adapt some to use the
assert.js module.
* wasm/assert.js: allow filtering out sometimes-useless source
location information. Return the exception so that further
processing can occur on it as desired.
* wasm/function-tests/exceptions.js:
* wasm/function-tests/trap-load-2.js:
(assert): Deleted.
(i.catch): Deleted.
* wasm/function-tests/trap-load.js:
(assert): Deleted.
(i.catch): Deleted.
* wasm/function-tests/trap-store-2.js:
(import.Builder.from.string_appeared_here.assert): Deleted.
(i.catch): Deleted.
* wasm/function-tests/trap-store.js:
(import.Builder.from.string_appeared_here.assert): Deleted.
(i.catch): Deleted.
Source/JavaScriptCore:
Rename the create* functions, and pass VM around, as suggested for
LinkError in #165805.
At the same time, use the default source appender when
constructing these error types, which gives a nice map back to the
original source as part of the error message. This is clearer when
using the current frame, so add that as well.
* jit/ThunkGenerators.cpp:
(JSC::throwExceptionFromWasmThunkGenerator):
* wasm/js/JSWebAssemblyCompileError.cpp:
(JSC::JSWebAssemblyCompileError::create):
(JSC::createJSWebAssemblyCompileError):
(JSC::createWebAssemblyCompileError): Deleted.
* wasm/js/JSWebAssemblyCompileError.h:
(JSC::JSWebAssemblyCompileError::create):
* wasm/js/JSWebAssemblyRuntimeError.cpp:
(JSC::JSWebAssemblyRuntimeError::create):
* wasm/js/JSWebAssemblyRuntimeError.h:
(JSC::JSWebAssemblyRuntimeError::create):
* wasm/js/WebAssemblyCompileErrorConstructor.cpp:
(JSC::constructJSWebAssemblyCompileError):
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::WebAssemblyModuleConstructor::createModule):
* wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
(JSC::constructJSWebAssemblyRuntimeError):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTestswasmassertjs">trunk/JSTests/wasm/assert.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsexceptionsjs">trunk/JSTests/wasm/function-tests/exceptions.js</a></li>
<li><a href="#trunkJSTestswasmfunctionteststrapload2js">trunk/JSTests/wasm/function-tests/trap-load-2.js</a></li>
<li><a href="#trunkJSTestswasmfunctionteststraploadjs">trunk/JSTests/wasm/function-tests/trap-load.js</a></li>
<li><a href="#trunkJSTestswasmfunctionteststrapstore2js">trunk/JSTests/wasm/function-tests/trap-store-2.js</a></li>
<li><a href="#trunkJSTestswasmfunctionteststrapstorejs">trunk/JSTests/wasm/function-tests/trap-store.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorejitThunkGeneratorscpp">trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyCompileErrorcpp">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyCompileErrorh">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyLinkErrorcpp">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyLinkErrorh">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyRuntimeErrorcpp">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyRuntimeErrorh">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyCompileErrorConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyLinkErrorConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyModuleConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyModuleRecordcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyRuntimeErrorConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/JSTests/ChangeLog        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2016-12-21 JF Bastien <jfbastien@apple.com>
+
+ WebAssembly JS API: cleanup & pass VM around to {Compile/Runtime}Error
+ https://bugs.webkit.org/show_bug.cgi?id=166295
+ <rdar://problem/29762017>
+
+ Reviewed by Mark Lam.
+
+ Update tests to generate new error messages. Adapt some to use the
+ assert.js module.
+
+ * wasm/assert.js: allow filtering out sometimes-useless source
+ location information. Return the exception so that further
+ processing can occur on it as desired.
+ * wasm/function-tests/exceptions.js:
+ * wasm/function-tests/trap-load-2.js:
+ (assert): Deleted.
+ (i.catch): Deleted.
+ * wasm/function-tests/trap-load.js:
+ (assert): Deleted.
+ (i.catch): Deleted.
+ * wasm/function-tests/trap-store-2.js:
+ (import.Builder.from.string_appeared_here.assert): Deleted.
+ (i.catch): Deleted.
+ * wasm/function-tests/trap-store.js:
+ (import.Builder.from.string_appeared_here.assert): Deleted.
+ (i.catch): Deleted.
+
</ins><span class="cx"> 2016-12-20 Keith Miller <keith_miller@apple.com>
</span><span class="cx">
</span><span class="cx"> Add support for global
</span></span></pre></div>
<a id="trunkJSTestswasmassertjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/assert.js (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/assert.js        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/JSTests/wasm/assert.js        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -103,12 +103,20 @@
</span><span class="cx"> _fail(`Expected: "${lhs}" > "${rhs}"`, msg);
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+// Ignore source information at the end of the error message if the expected message didn't specify that information. Sometimes it changes, or it's tricky to get just right.
+const _sourceRe = new RegExp(/ \(evaluating '.*'\)/);
+
</ins><span class="cx"> const _throws = (func, type, message, ...args) => {
</span><span class="cx"> try {
</span><span class="cx"> func(...args);
</span><span class="cx"> } catch (e) {
</span><del>- if (e instanceof type && e.message === message)
- return;
</del><ins>+ if (e instanceof type) {
+ if (e.message === message)
+ return e;
+ const cleanMessage = e.message.replace(_sourceRe, '');
+ if (cleanMessage === message)
+ return e;
+ }
</ins><span class="cx"> _fail(`Expected to throw a ${type.name} with message "${message}", got ${e.name} with message "${e.message}"`);
</span><span class="cx"> }
</span><span class="cx"> _fail(`Expected to throw a ${type.name} with message "${message}"`);
</span></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsexceptionsjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/function-tests/exceptions.js (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/exceptions.js        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/JSTests/wasm/function-tests/exceptions.js        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> assert.eq(table.get(0), null);
</span><span class="cx">
</span><span class="cx"> for (let i = 0; i < 1000; i++) {
</span><del>- assert.throws(() => foo(0, i), WebAssembly.RuntimeError, "call_indirect to a null table entry");
</del><ins>+ assert.throws(() => foo(0, i), WebAssembly.RuntimeError, "call_indirect to a null table entry (evaluating 'func(...args)')");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> table.set(0, foo);
</span><span class="lines">@@ -52,11 +52,11 @@
</span><span class="cx"> assert.eq(table.get(0), foo);
</span><span class="cx">
</span><span class="cx"> for (let i = 0; i < 1000; i++) {
</span><del>- assert.throws(() => foo(1 + i, i), WebAssembly.RuntimeError, "Out of bounds call_indirect");
</del><ins>+ assert.throws(() => foo(1 + i, i), WebAssembly.RuntimeError, "Out of bounds call_indirect (evaluating 'func(...args)')");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (let i = 0; i < 1000; i++) {
</span><del>- assert.throws(() => foo(0, i), WebAssembly.RuntimeError, "call_indirect to a signature that does not match");
</del><ins>+ assert.throws(() => foo(0, i), WebAssembly.RuntimeError, "call_indirect to a signature that does not match (evaluating 'func(...args)')");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> table.set(0, bar);
</span></span></pre></div>
<a id="trunkJSTestswasmfunctionteststrapload2js"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/function-tests/trap-load-2.js (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/trap-load-2.js        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/JSTests/wasm/function-tests/trap-load-2.js        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> import Builder from '../Builder.js'
</span><ins>+import * as assert from '../assert.js'
</ins><span class="cx">
</span><span class="cx"> const pageSize = 64 * 1024;
</span><span class="cx"> const numPages = 10;
</span><span class="lines">@@ -18,11 +19,6 @@
</span><span class="cx"> .End()
</span><span class="cx"> .End();
</span><span class="cx">
</span><del>-function assert(b) {
- if (!b)
- throw new Error("Bad")
-}
-
</del><span class="cx"> function wasmFrameCountFromError(e) {
</span><span class="cx"> let stackFrames = e.stack.split("\n").filter((s) => s.indexOf("<wasm>@[wasm code]") !== -1);
</span><span class="cx"> return stackFrames.length;
</span><span class="lines">@@ -70,18 +66,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (let i = 0; i < 5000; i++) {
</span><del>- let threw = false;
- try {
- foo(5, address);
- } catch(e) {
- assert(e instanceof WebAssembly.RuntimeError);
- assert(e.message === "Out of bounds memory access");
- // There are 5 total calls, and each call does:
- // JS entry, wasm entry, js call stub.
- // The last call that traps just has JS entry and wasm entry.
- assert(wasmFrameCountFromError(e) === 5 * 3 + 2);
- threw = true;
- }
- assert(threw);
</del><ins>+ const e = assert.throws(() => foo(5, address), WebAssembly.RuntimeError, "Out of bounds memory access (evaluating 'foo(x - 1, address)')");
+ // There are 5 total calls, and each call does:
+ // JS entry, wasm entry, js call stub.
+ // The last call that traps just has JS entry and wasm entry.
+ assert.eq(wasmFrameCountFromError(e), 5 * 3 + 2);
</ins><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkJSTestswasmfunctionteststraploadjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/function-tests/trap-load.js (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/trap-load.js        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/JSTests/wasm/function-tests/trap-load.js        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> import Builder from '../Builder.js'
</span><ins>+import * as assert from '../assert.js'
</ins><span class="cx">
</span><span class="cx"> const pageSize = 64 * 1024;
</span><span class="cx"> const numPages = 10;
</span><span class="lines">@@ -22,11 +23,6 @@
</span><span class="cx"> const module = new WebAssembly.Module(bin);
</span><span class="cx"> const foo = new WebAssembly.Instance(module, {a: {b: new WebAssembly.Memory({initial: numPages})}}).exports.foo;
</span><span class="cx">
</span><del>-function assert(b) {
- if (!b)
- throw new Error("Bad")
-}
-
</del><span class="cx"> function wasmFrameCountFromError(e) {
</span><span class="cx"> let stackFrames = e.stack.split("\n").filter((s) => s.indexOf("<wasm>@[wasm code]") !== -1);
</span><span class="cx"> return stackFrames.length;
</span><span class="lines">@@ -33,14 +29,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (let i = 0; i < 1000; i++) {
</span><del>- let threw = false;
- try {
- foo(numPages * pageSize + 1);
- } catch(e) {
- assert(e instanceof WebAssembly.RuntimeError);
- assert(e.message === "Out of bounds memory access");
- threw = true;
- assert(wasmFrameCountFromError(e) === 2);
- }
- assert(threw);
</del><ins>+ const e = assert.throws(() => foo(numPages * pageSize + 1), WebAssembly.RuntimeError, "Out of bounds memory access (evaluating 'func(...args)')");
+ assert.eq(wasmFrameCountFromError(e), 2);
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkJSTestswasmfunctionteststrapstore2js"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/function-tests/trap-store-2.js (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/trap-store-2.js        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/JSTests/wasm/function-tests/trap-store-2.js        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -1,10 +1,6 @@
</span><span class="cx"> import Builder from '../Builder.js'
</span><ins>+import * as assert from '../assert.js'
</ins><span class="cx">
</span><del>-function assert(b) {
- if (!b)
- throw new Error("Bad")
-}
-
</del><span class="cx"> const pageSize = 64 * 1024;
</span><span class="cx"> const numPages = 10;
</span><span class="cx">
</span><span class="lines">@@ -49,15 +45,6 @@
</span><span class="cx"> foo(x - 1, address);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (let i = 0; i < 5000; i++) {
- let threw = false;
- try {
- foo(6, address);
- } catch(e) {
- assert(e instanceof WebAssembly.RuntimeError);
- assert(e.message === "Out of bounds memory access");
- threw = true;
- }
- assert(threw);
- }
</del><ins>+ for (let i = 0; i < 5000; i++)
+ assert.throws(() => foo(6, address), WebAssembly.RuntimeError, "Out of bounds memory access");
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkJSTestswasmfunctionteststrapstorejs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/function-tests/trap-store.js (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/trap-store.js        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/JSTests/wasm/function-tests/trap-store.js        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -1,10 +1,6 @@
</span><span class="cx"> import Builder from '../Builder.js'
</span><ins>+import * as assert from '../assert.js'
</ins><span class="cx">
</span><del>-function assert(b) {
- if (!b)
- throw new Error("Bad")
-}
-
</del><span class="cx"> const pageSize = 64 * 1024;
</span><span class="cx"> const numPages = 10;
</span><span class="cx">
</span><span class="lines">@@ -28,15 +24,6 @@
</span><span class="cx"> const module = new WebAssembly.Module(bin);
</span><span class="cx"> const foo = new WebAssembly.Instance(module, {a: {b: new WebAssembly.Memory({initial: numPages})}}).exports.foo;
</span><span class="cx">
</span><del>- for (let i = 0; i < 10000; i++) {
- let threw = false;
- try {
- foo(i, numPages * pageSize + 1);
- } catch(e) {
- assert(e instanceof WebAssembly.RuntimeError);
- assert(e.message === "Out of bounds memory access");
- threw = true;
- }
- assert(threw);
- }
</del><ins>+ for (let i = 0; i < 10000; i++)
+ assert.throws(() => foo(i, numPages * pageSize + 1), WebAssembly.RuntimeError, "Out of bounds memory access (evaluating 'func(...args)')");
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2016-12-21 JF Bastien <jfbastien@apple.com>
+
+ WebAssembly JS API: cleanup & pass VM around to {Compile/Runtime}Error
+ https://bugs.webkit.org/show_bug.cgi?id=166295
+ <rdar://problem/29762017>
+
+ Reviewed by Mark Lam.
+
+ Rename the create* functions, and pass VM around, as suggested for
+ LinkError in #165805.
+
+ At the same time, use the default source appender when
+ constructing these error types, which gives a nice map back to the
+ original source as part of the error message. This is clearer when
+ using the current frame, so add that as well.
+
+ * jit/ThunkGenerators.cpp:
+ (JSC::throwExceptionFromWasmThunkGenerator):
+ * wasm/js/JSWebAssemblyCompileError.cpp:
+ (JSC::JSWebAssemblyCompileError::create):
+ (JSC::createJSWebAssemblyCompileError):
+ (JSC::createWebAssemblyCompileError): Deleted.
+ * wasm/js/JSWebAssemblyCompileError.h:
+ (JSC::JSWebAssemblyCompileError::create):
+ * wasm/js/JSWebAssemblyRuntimeError.cpp:
+ (JSC::JSWebAssemblyRuntimeError::create):
+ * wasm/js/JSWebAssemblyRuntimeError.h:
+ (JSC::JSWebAssemblyRuntimeError::create):
+ * wasm/js/WebAssemblyCompileErrorConstructor.cpp:
+ (JSC::constructJSWebAssemblyCompileError):
+ * wasm/js/WebAssemblyModuleConstructor.cpp:
+ (JSC::WebAssemblyModuleConstructor::createModule):
+ * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
+ (JSC::constructJSWebAssemblyRuntimeError):
+
</ins><span class="cx"> 2016-12-21 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> [ES6] Fix modules document in features.json
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitThunkGeneratorscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -1155,8 +1155,7 @@
</span><span class="cx"> auto throwScope = DECLARE_THROW_SCOPE(*vm);
</span><span class="cx"> JSGlobalObject* globalObject = vm->topJSWebAssemblyInstance->globalObject();
</span><span class="cx">
</span><del>- JSWebAssemblyRuntimeError* error = JSWebAssemblyRuntimeError::create(
- exec, globalObject->WebAssemblyRuntimeErrorStructure(), Wasm::errorMessageForExceptionType(type));
</del><ins>+ JSWebAssemblyRuntimeError* error = JSWebAssemblyRuntimeError::create(exec, *vm, globalObject->WebAssemblyRuntimeErrorStructure(), Wasm::errorMessageForExceptionType(type));
</ins><span class="cx"> throwException(exec, throwScope, error);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyCompileErrorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -32,10 +32,11 @@
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><del>-JSWebAssemblyCompileError* JSWebAssemblyCompileError::create(ExecState* state, Structure* structure, const String& message, bool useCurrentFrame)
</del><ins>+JSWebAssemblyCompileError* JSWebAssemblyCompileError::create(ExecState* state, VM& vm, Structure* structure, const String& message)
</ins><span class="cx"> {
</span><del>- auto& vm = state->vm();
</del><span class="cx"> auto* instance = new (NotNull, allocateCell<JSWebAssemblyCompileError>(vm.heap)) JSWebAssemblyCompileError(vm, structure);
</span><ins>+ instance->m_sourceAppender = defaultSourceAppender;
+ bool useCurrentFrame = true;
</ins><span class="cx"> instance->finishCreation(state, vm, message, useCurrentFrame);
</span><span class="cx"> return instance;
</span><span class="cx"> }
</span><span class="lines">@@ -48,11 +49,11 @@
</span><span class="cx"> const ClassInfo JSWebAssemblyCompileError::s_info = { "WebAssembly.CompileError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyCompileError) };
</span><span class="cx">
</span><span class="cx">
</span><del>-JSObject* createWebAssemblyCompileError(ExecState* exec, const String& message)
</del><ins>+JSObject* createJSWebAssemblyCompileError(ExecState* state, VM& vm, const String& message)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!message.isEmpty());
</span><del>- JSGlobalObject* globalObject = exec->lexicalGlobalObject();
- return ErrorInstance::create(exec, globalObject->vm(), globalObject->WebAssemblyCompileErrorStructure(), message, defaultSourceAppender, TypeNothing, true);
</del><ins>+ JSGlobalObject* globalObject = state->lexicalGlobalObject();
+ return JSWebAssemblyCompileError::create(state, vm, globalObject->WebAssemblyCompileErrorStructure(), message);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyCompileErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -35,10 +35,10 @@
</span><span class="cx"> public:
</span><span class="cx"> typedef ErrorInstance Base;
</span><span class="cx">
</span><del>- static JSWebAssemblyCompileError* create(ExecState*, Structure*, const String&, bool);
- static JSWebAssemblyCompileError* create(ExecState* exec, Structure* structure, JSValue message, bool useCurrentFrame)
</del><ins>+ static JSWebAssemblyCompileError* create(ExecState*, VM&, Structure*, const String&);
+ static JSWebAssemblyCompileError* create(ExecState* state, VM& vm, Structure* structure, JSValue message)
</ins><span class="cx"> {
</span><del>- return create(exec, structure, message.isUndefined() ? String() : message.toWTFString(exec), useCurrentFrame);
</del><ins>+ return create(state, vm, structure, message.isUndefined() ? String() : message.toWTFString(state));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> DECLARE_INFO;
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> JSWebAssemblyCompileError(VM&, Structure*);
</span><span class="cx"> };
</span><span class="cx">
</span><del>-JSObject* createWebAssemblyCompileError(ExecState*, const String&);
</del><ins>+JSObject* createJSWebAssemblyCompileError(ExecState*, VM&, const String&);
</ins><span class="cx">
</span><span class="cx"> } // namespace JSC
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyLinkErrorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -32,11 +32,12 @@
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><del>-JSWebAssemblyLinkError* JSWebAssemblyLinkError::create(ExecState* state, VM* vm, Structure* structure, const String& message)
</del><ins>+JSWebAssemblyLinkError* JSWebAssemblyLinkError::create(ExecState* state, VM& vm, Structure* structure, const String& message)
</ins><span class="cx"> {
</span><del>- auto* instance = new (NotNull, allocateCell<JSWebAssemblyLinkError>(vm->heap)) JSWebAssemblyLinkError(*vm, structure);
</del><ins>+ auto* instance = new (NotNull, allocateCell<JSWebAssemblyLinkError>(vm.heap)) JSWebAssemblyLinkError(vm, structure);
</ins><span class="cx"> instance->m_sourceAppender = defaultSourceAppender;
</span><del>- instance->finishCreation(state, *vm, message, true);
</del><ins>+ bool useCurrentFrame = true;
+ instance->finishCreation(state, vm, message, useCurrentFrame);
</ins><span class="cx"> return instance;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -48,7 +49,7 @@
</span><span class="cx"> const ClassInfo JSWebAssemblyLinkError::s_info = { "WebAssembly.LinkError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyLinkError) };
</span><span class="cx">
</span><span class="cx">
</span><del>-JSObject* createJSWebAssemblyLinkError(ExecState* state, VM* vm, const String& message)
</del><ins>+JSObject* createJSWebAssemblyLinkError(ExecState* state, VM& vm, const String& message)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!message.isEmpty());
</span><span class="cx"> JSGlobalObject* globalObject = state->lexicalGlobalObject();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyLinkErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.h (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.h        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.h        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -35,8 +35,8 @@
</span><span class="cx"> public:
</span><span class="cx"> typedef ErrorInstance Base;
</span><span class="cx">
</span><del>- static JSWebAssemblyLinkError* create(ExecState*, VM*, Structure*, const String&);
- static JSWebAssemblyLinkError* create(ExecState* state, VM* vm, Structure* structure, JSValue message)
</del><ins>+ static JSWebAssemblyLinkError* create(ExecState*, VM&, Structure*, const String&);
+ static JSWebAssemblyLinkError* create(ExecState* state, VM& vm, Structure* structure, JSValue message)
</ins><span class="cx"> {
</span><span class="cx"> return create(state, vm, structure, message.isUndefined() ? String() : message.toWTFString(state));
</span><span class="cx"> }
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> JSWebAssemblyLinkError(VM&, Structure*);
</span><span class="cx"> };
</span><span class="cx">
</span><del>-JSObject* createJSWebAssemblyLinkError(ExecState*, VM*, const String&);
</del><ins>+JSObject* createJSWebAssemblyLinkError(ExecState*, VM&, const String&);
</ins><span class="cx">
</span><span class="cx"> } // namespace JSC
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyRuntimeErrorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -32,10 +32,11 @@
</span><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><del>-JSWebAssemblyRuntimeError* JSWebAssemblyRuntimeError::create(ExecState* state, Structure* structure, const String& message, bool useCurrentFrame)
</del><ins>+JSWebAssemblyRuntimeError* JSWebAssemblyRuntimeError::create(ExecState* state, VM& vm, Structure* structure, const String& message)
</ins><span class="cx"> {
</span><del>- auto& vm = state->vm();
</del><span class="cx"> auto* instance = new (NotNull, allocateCell<JSWebAssemblyRuntimeError>(vm.heap)) JSWebAssemblyRuntimeError(vm, structure);
</span><ins>+ instance->m_sourceAppender = defaultSourceAppender;
+ bool useCurrentFrame = true;
</ins><span class="cx"> instance->finishCreation(state, vm, message, useCurrentFrame);
</span><span class="cx"> return instance;
</span><span class="cx"> }
</span><span class="lines">@@ -47,6 +48,7 @@
</span><span class="cx">
</span><span class="cx"> const ClassInfo JSWebAssemblyRuntimeError::s_info = { "WebAssembly.RuntimeError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyRuntimeError) };
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(WEBASSEMBLY)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyRuntimeErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -35,10 +35,10 @@
</span><span class="cx"> public:
</span><span class="cx"> typedef ErrorInstance Base;
</span><span class="cx">
</span><del>- static JSWebAssemblyRuntimeError* create(ExecState*, Structure*, const String&, bool useCurrentFrame = true);
- static JSWebAssemblyRuntimeError* create(ExecState* exec, Structure* structure, JSValue message, bool useCurrentFrame)
</del><ins>+ static JSWebAssemblyRuntimeError* create(ExecState*, VM&, Structure*, const String&);
+ static JSWebAssemblyRuntimeError* create(ExecState* state, VM& vm, Structure* structure, JSValue message)
</ins><span class="cx"> {
</span><del>- return create(exec, structure, message.isUndefined() ? String() : message.toWTFString(exec), useCurrentFrame);
</del><ins>+ return create(state, vm, structure, message.isUndefined() ? String() : message.toWTFString(state));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> DECLARE_INFO;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyCompileErrorConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> JSValue message = state->argument(0);
</span><span class="cx"> auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->jsCallee())->globalObject()->WebAssemblyCompileErrorStructure());
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, encodedJSValue());
</span><del>- return JSValue::encode(JSWebAssemblyCompileError::create(state, structure, message, false));
</del><ins>+ return JSValue::encode(JSWebAssemblyCompileError::create(state, vm, structure, message));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyCompileError(ExecState* state)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx"> // 4. If i is a function import:
</span><span class="cx"> // i. If IsCallable(v) is false, throw a WebAssembly.LinkError.
</span><span class="cx"> if (!value.isFunction())
</span><del>- return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("import function must be callable"))));
</del><ins>+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("import function must be callable"))));
</ins><span class="cx"> JSCell* cell = value.asCell();
</span><span class="cx"> // ii. If v is an Exported Function Exotic Object:
</span><span class="cx"> if (WebAssemblyFunction* importedExports = jsDynamicCast<WebAssemblyFunction*>(object)) {
</span><span class="lines">@@ -137,22 +137,22 @@
</span><span class="cx"> JSWebAssemblyTable* table = jsDynamicCast<JSWebAssemblyTable*>(value);
</span><span class="cx"> // i. If v is not a WebAssembly.Table object, throw a WebAssembly.LinkError.
</span><span class="cx"> if (!table)
</span><del>- return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Table import is not an instance of WebAssembly.Table"))));
</del><ins>+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Table import is not an instance of WebAssembly.Table"))));
</ins><span class="cx">
</span><span class="cx"> uint32_t expectedInitial = moduleInformation.tableInformation.initial();
</span><span class="cx"> uint32_t actualInitial = table->size();
</span><span class="cx"> if (actualInitial < expectedInitial)
</span><del>- return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Table import provided an 'initial' that is too small"))));
</del><ins>+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Table import provided an 'initial' that is too small"))));
</ins><span class="cx">
</span><span class="cx"> if (std::optional<uint32_t> expectedMaximum = moduleInformation.tableInformation.maximum()) {
</span><span class="cx"> std::optional<uint32_t> actualMaximum = table->maximum();
</span><span class="cx"> if (!actualMaximum) {
</span><span class="cx"> return JSValue::encode(
</span><del>- throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Table import does not have a 'maximum' but the module requires that it does"))));
</del><ins>+ throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Table import does not have a 'maximum' but the module requires that it does"))));
</ins><span class="cx"> }
</span><span class="cx"> if (*actualMaximum > *expectedMaximum) {
</span><span class="cx"> return JSValue::encode(
</span><del>- throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Imported Table's 'maximum' is larger than the module's expected 'maximum'"))));
</del><ins>+ throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Imported Table's 'maximum' is larger than the module's expected 'maximum'"))));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -169,23 +169,23 @@
</span><span class="cx"> JSWebAssemblyMemory* memory = jsDynamicCast<JSWebAssemblyMemory*>(value);
</span><span class="cx"> // i. If v is not a WebAssembly.Memory object, throw a WebAssembly.LinkError.
</span><span class="cx"> if (!memory)
</span><del>- return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Memory import is not an instance of WebAssembly.Memory"))));
</del><ins>+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import is not an instance of WebAssembly.Memory"))));
</ins><span class="cx">
</span><span class="cx"> Wasm::PageCount expectedInitial = moduleInformation.memory.initial();
</span><span class="cx"> Wasm::PageCount actualInitial = memory->memory()->initial();
</span><span class="cx"> if (actualInitial < expectedInitial)
</span><del>- return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Memory import provided an 'initial' that is too small"))));
</del><ins>+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import provided an 'initial' that is too small"))));
</ins><span class="cx">
</span><span class="cx"> if (Wasm::PageCount expectedMaximum = moduleInformation.memory.maximum()) {
</span><span class="cx"> Wasm::PageCount actualMaximum = memory->memory()->maximum();
</span><span class="cx"> if (!actualMaximum) {
</span><span class="cx"> return JSValue::encode(
</span><del>- throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Memory import did not have a 'maximum' but the module requires that it does"))));
</del><ins>+ throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import did not have a 'maximum' but the module requires that it does"))));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (actualMaximum > expectedMaximum) {
</span><span class="cx"> return JSValue::encode(
</span><del>- throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Memory imports 'maximum' is larger than the module's expected 'maximum'"))));
</del><ins>+ throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory imports 'maximum' is larger than the module's expected 'maximum'"))));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> // ii. Append v to memories.
</span><span class="lines">@@ -199,7 +199,7 @@
</span><span class="cx"> ASSERT(moduleInformation.globals[import.kindIndex].mutability == Wasm::Global::Immutable);
</span><span class="cx"> // ii. If Type(v) is not Number, throw a TypeError.
</span><span class="cx"> if (!value.isNumber())
</span><del>- return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("imported global must be a number"))));
</del><ins>+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("imported global must be a number"))));
</ins><span class="cx"> // iii. Append ToWebAssemblyValue(v) to imports.
</span><span class="cx"> switch (moduleInformation.globals[import.kindIndex].type) {
</span><span class="cx"> case Wasm::I32:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyLinkErrorConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> JSValue message = state->argument(0);
</span><span class="cx"> auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->jsCallee())->globalObject()->WebAssemblyLinkErrorStructure());
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, encodedJSValue());
</span><del>- return JSValue::encode(JSWebAssemblyLinkError::create(state, &vm, structure, message));
</del><ins>+ return JSValue::encode(JSWebAssemblyLinkError::create(state, vm, structure, message));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyLinkError(ExecState* state)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyModuleConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -84,7 +84,7 @@
</span><span class="cx"> // On failure, a new WebAssembly.CompileError is thrown.
</span><span class="cx"> plan.run();
</span><span class="cx"> if (plan.failed())
</span><del>- return throwException(state, scope, createWebAssemblyCompileError(state, plan.errorMessage()));
</del><ins>+ return throwException(state, scope, createJSWebAssemblyCompileError(state, vm, plan.errorMessage()));
</ins><span class="cx">
</span><span class="cx"> // On success, a new WebAssembly.Module object is returned with [[Module]] set to the validated Ast.module.
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyModuleRecordcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -199,7 +199,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template <typename Scope, typename N, typename ...Args>
</span><del>-NEVER_INLINE static JSValue dataSegmentFail(ExecState* state, VM* vm, Scope& scope, N memorySize, N segmentSize, N offset, Args... args)
</del><ins>+NEVER_INLINE static JSValue dataSegmentFail(ExecState* state, VM& vm, Scope& scope, N memorySize, N segmentSize, N offset, Args... args)
</ins><span class="cx"> {
</span><span class="cx"> return throwException(state, scope, createJSWebAssemblyLinkError(state, vm, makeString(ASCIILiteral("Invalid data segment initialization: segment of "), String::number(segmentSize), ASCIILiteral(" bytes memory of "), String::number(memorySize), ASCIILiteral(" bytes, at offset "), String::number(offset), args...)));
</span><span class="cx"> }
</span><span class="lines">@@ -225,7 +225,7 @@
</span><span class="cx"> uint32_t tableIndex = element.offset;
</span><span class="cx"> uint64_t lastWrittenIndex = static_cast<uint64_t>(tableIndex) + static_cast<uint64_t>(element.functionIndices.size()) - 1;
</span><span class="cx"> if (lastWrittenIndex >= table->size())
</span><del>- return throwException(state, scope, createJSWebAssemblyLinkError(state, &vm, ASCIILiteral("Element is trying to set an out of bounds table index")));
</del><ins>+ return throwException(state, scope, createJSWebAssemblyLinkError(state, vm, ASCIILiteral("Element is trying to set an out of bounds table index")));
</ins><span class="cx">
</span><span class="cx"> for (uint32_t i = 0; i < element.functionIndices.size(); ++i) {
</span><span class="cx"> // FIXME: This essentially means we're exporting an import.
</span><span class="lines">@@ -266,9 +266,9 @@
</span><span class="cx"> for (auto& segment : data) {
</span><span class="cx"> if (segment->sizeInBytes) {
</span><span class="cx"> if (UNLIKELY(sizeInBytes < segment->sizeInBytes))
</span><del>- return dataSegmentFail(state, &vm, scope, sizeInBytes, segment->sizeInBytes, segment->offset, ASCIILiteral(", segment is too big"));
</del><ins>+ return dataSegmentFail(state, vm, scope, sizeInBytes, segment->sizeInBytes, segment->offset, ASCIILiteral(", segment is too big"));
</ins><span class="cx"> if (UNLIKELY(segment->offset > sizeInBytes - segment->sizeInBytes))
</span><del>- return dataSegmentFail(state, &vm, scope, sizeInBytes, segment->sizeInBytes, segment->offset, ASCIILiteral(", segment writes outside of memory"));
</del><ins>+ return dataSegmentFail(state, vm, scope, sizeInBytes, segment->sizeInBytes, segment->offset, ASCIILiteral(", segment writes outside of memory"));
</ins><span class="cx"> memcpy(memory + segment->offset, &segment->byte(0), segment->sizeInBytes);
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyRuntimeErrorConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp (210072 => 210073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp        2016-12-21 20:27:46 UTC (rev 210072)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp        2016-12-21 20:34:04 UTC (rev 210073)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> JSValue message = state->argument(0);
</span><span class="cx"> auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->jsCallee())->globalObject()->WebAssemblyRuntimeErrorStructure());
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, encodedJSValue());
</span><del>- return JSValue::encode(JSWebAssemblyRuntimeError::create(state, structure, message, false));
</del><ins>+ return JSValue::encode(JSWebAssemblyRuntimeError::create(state, vm, structure, message));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyRuntimeError(ExecState* state)
</span></span></pre>
</div>
</div>
</body>
</html>