<!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>[214438] 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/214438">214438</a></dd>
<dt>Author</dt> <dd>jfbastien@apple.com</dd>
<dt>Date</dt> <dd>2017-03-27 16:24:31 -0700 (Mon, 27 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>WebAssembly: misc memory testing
https://bugs.webkit.org/show_bug.cgi?id=170137
Reviewed by Keith Miller.
JSTests:
* wasm/assert.js: handle newlines in code we print out, avoid regex
* wasm/function-tests/memory-import-and-grow.js: Added.
(const.instantiate):
(const.test):
* wasm/function-tests/memory-section-and-import.js: Added.
(const.instantiate):
Source/JavaScriptCore:
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::WebAssemblyInstanceConstructor::createInstance): improve error messages</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="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkJSTestswasmfunctiontestsmemoryimportandgrowjs">trunk/JSTests/wasm/function-tests/memory-import-and-grow.js</a></li>
<li><a href="#trunkJSTestswasmfunctiontestsmemorysectionandimportjs">trunk/JSTests/wasm/function-tests/memory-section-and-import.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (214437 => 214438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2017-03-27 23:21:19 UTC (rev 214437)
+++ trunk/JSTests/ChangeLog        2017-03-27 23:24:31 UTC (rev 214438)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2017-03-27 JF Bastien <jfbastien@apple.com>
+
+ WebAssembly: misc memory testing
+ https://bugs.webkit.org/show_bug.cgi?id=170137
+
+ Reviewed by Keith Miller.
+
+ * wasm/assert.js: handle newlines in code we print out, avoid regex
+ * wasm/function-tests/memory-import-and-grow.js: Added.
+ (const.instantiate):
+ (const.test):
+ * wasm/function-tests/memory-section-and-import.js: Added.
+ (const.instantiate):
+
</ins><span class="cx"> 2017-03-23 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> [JSC] Use jsNontrivialString agressively for ToString(Int52)
</span></span></pre></div>
<a id="trunkJSTestswasmassertjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/assert.js (214437 => 214438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/assert.js        2017-03-27 23:21:19 UTC (rev 214437)
+++ trunk/JSTests/wasm/assert.js        2017-03-27 23:24:31 UTC (rev 214438)
</span><span class="lines">@@ -111,9 +111,6 @@
</span><span class="cx"> _fail(`Expected: "${lhs}" > "${rhs}"`, msg);
</span><span class="cx"> };
</span><span class="cx">
</span><del>-// 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 '.*'\))|( \(In .*\))/);
-
</del><span class="cx"> const _throws = (func, type, message, ...args) => {
</span><span class="cx"> try {
</span><span class="cx"> func(...args);
</span><span class="lines">@@ -121,9 +118,16 @@
</span><span class="cx"> if (e instanceof type) {
</span><span class="cx"> if (e.message === message)
</span><span class="cx"> return e;
</span><del>- const cleanMessage = e.message.replace(_sourceRe, '');
- if (cleanMessage === message)
- return e;
</del><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 evaluatingIndex = e.message.indexOf(" (evaluating '");
+ if (evaluatingIndex !== -1) {
+ const cleanMessage = e.message.substring(0, evaluatingIndex);
+ if (cleanMessage === message)
+ return e;
+ }
+ return e;
</ins><span class="cx"> }
</span><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></pre></div>
<a id="trunkJSTestswasmfunctiontestsmemoryimportandgrowjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/function-tests/memory-import-and-grow.js (0 => 214438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/memory-import-and-grow.js         (rev 0)
+++ trunk/JSTests/wasm/function-tests/memory-import-and-grow.js        2017-03-27 23:24:31 UTC (rev 214438)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+import Builder from '../Builder.js';
+import * as assert from '../assert.js';
+
+const pageSize = 64 * 1024;
+
+const verbose = false;
+
+// https://github.com/WebAssembly/design/blob/master/Modules.md#imports
+// Says:
+//
+// A linear memory import includes the same set of fields defined in the Linear
+// Memory section: initial length and optional maximum length. The host
+// environment must only allow imports of WebAssembly linear memories that have
+// initial length greater-or-equal than the initial length declared in the
+// import and that have maximum length less-or-equal than the maximum length
+// declared in the import. This ensures that separate compilation can assume:
+// memory accesses below the declared initial length are always in-bounds,
+// accesses above the declared maximum length are always out-of-bounds and if
+// initial equals maximum, the length is fixed.
+
+const instantiate = (builder, importObject = undefined) => {
+ return new WebAssembly.Instance(
+ new WebAssembly.Module(
+ builder.WebAssembly().get()),
+ importObject);
+};
+
+const test = (memoryToImport, importedMemoryDeclaration, growMemoryToImportBy = undefined, growImportedMemoryDeclarationBy = undefined, expectedFinal) => {
+ const builder0 = (new Builder())
+ .Type().End()
+ .Function().End()
+ .Memory().InitialMaxPages(memoryToImport.initial, memoryToImport.maximum).End()
+ .Export()
+ .Function("current").Function("grow").Function("get")
+ .Memory("memory", 0)
+ .End()
+ .Code()
+ .Function("current", { params: [], ret: "i32" }).CurrentMemory(0).Return().End()
+ .Function("grow", { params: ["i32"], ret: "i32" }).GetLocal(0).GrowMemory(0).Return().End()
+ .Function("get", { params: ["i32"], ret: "i32" }).GetLocal(0).I32Load(2, 0).Return().End()
+ .End();
+
+ const builder1 = (new Builder())
+ .Type().End()
+ .Import().Memory("imp", "memory", importedMemoryDeclaration).End()
+ .Function().End()
+ .Export()
+ .Function("current").Function("grow").Function("get")
+ .Memory("memory", 0)
+ .End()
+ .Code()
+ .Function("current", { params: [], ret: "i32" }).CurrentMemory(0).Return().End()
+ .Function("grow", { params: ["i32"], ret: "i32" }).GetLocal(0).GrowMemory(0).Return().End()
+ .Function("get", { params: ["i32"], ret: "i32" }).GetLocal(0).I32Load(2, 0).Return().End()
+ .End();
+
+ const i0 = instantiate(builder0);
+ const i1 = instantiate(builder1, { imp: { memory: i0.exports.memory } });
+ assert.eq(i0.exports.current(), i1.exports.current());
+ assert.eq(i0.exports.current(), memoryToImport.initial);
+
+ if (growMemoryToImportBy !== undefined) {
+ const grow = i0.exports.grow(growMemoryToImportBy);
+ if (verbose)
+ print(`currents: ${i0.exports.current()} and ${i1.exports.current()} -- grow result: ${grow}`);
+ }
+
+ if (growImportedMemoryDeclarationBy !== undefined) {
+ const grow = i1.exports.grow(growImportedMemoryDeclarationBy);
+ if (verbose)
+ print(`currents: ${i0.exports.current()} and ${i1.exports.current()} -- grow result: ${grow}`);
+ }
+
+ assert.eq(i0.exports.current(), i1.exports.current());
+ assert.eq(i0.exports.current(), expectedFinal);
+};
+
+const u = undefined;
+
+// Identical Just Works.
+test({ initial: 2, maximum: 4 }, { initial: 2, maximum: 4 }, 0, u, 2);
+test({ initial: 2, maximum: 4 }, { initial: 2, maximum: 4 }, 1, u, 3);
+test({ initial: 2, maximum: 4 }, { initial: 2, maximum: 4 }, 2, u, 4);
+test({ initial: 2, maximum: 4 }, { initial: 2, maximum: 4 }, 3, u, 2);
+test({ initial: 2, maximum: 4 }, { initial: 2, maximum: 4 }, u, 0, 2);
+test({ initial: 2, maximum: 4 }, { initial: 2, maximum: 4 }, u, 1, 3);
+test({ initial: 2, maximum: 4 }, { initial: 2, maximum: 4 }, u, 2, 4);
+test({ initial: 2, maximum: 4 }, { initial: 2, maximum: 4 }, u, 3, 2);
+
+// Allowed: imported initial is greater than declared.
+test({ initial: 2, maximum: 4 }, { initial: 1, maximum: 4 }, 0, u, 2);
+test({ initial: 2, maximum: 4 }, { initial: 1, maximum: 4 }, 1, u, 3);
+test({ initial: 2, maximum: 4 }, { initial: 1, maximum: 4 }, 2, u, 4);
+test({ initial: 2, maximum: 4 }, { initial: 1, maximum: 4 }, 3, u, 2);
+test({ initial: 2, maximum: 4 }, { initial: 0, maximum: 4 }, 0, u, 2);
+test({ initial: 2, maximum: 4 }, { initial: 0, maximum: 4 }, 1, u, 3);
+test({ initial: 2, maximum: 4 }, { initial: 0, maximum: 4 }, 2, u, 4);
+test({ initial: 2, maximum: 4 }, { initial: 0, maximum: 4 }, 3, u, 2);
+test({ initial: 2, maximum: 4 }, { initial: 1, maximum: 4 }, u, 0, 2);
+test({ initial: 2, maximum: 4 }, { initial: 1, maximum: 4 }, u, 1, 3);
+test({ initial: 2, maximum: 4 }, { initial: 1, maximum: 4 }, u, 2, 4);
+test({ initial: 2, maximum: 4 }, { initial: 1, maximum: 4 }, u, 3, 2);
+test({ initial: 2, maximum: 4 }, { initial: 0, maximum: 4 }, u, 0, 2);
+test({ initial: 2, maximum: 4 }, { initial: 0, maximum: 4 }, u, 1, 3);
+test({ initial: 2, maximum: 4 }, { initial: 0, maximum: 4 }, u, 2, 4);
+test({ initial: 2, maximum: 4 }, { initial: 0, maximum: 4 }, u, 3, 2);
+
+// Allowed: imported maximum is lesser than declared.
+test({ initial: 2, maximum: 3 }, { initial: 2, maximum: 4 }, 0, u, 2);
+test({ initial: 2, maximum: 3 }, { initial: 2, maximum: 4 }, 1, u, 3);
+test({ initial: 2, maximum: 3 }, { initial: 2, maximum: 4 }, 2, u, 2);
+test({ initial: 2, maximum: 2 }, { initial: 2, maximum: 4 }, 0, u, 2);
+test({ initial: 2, maximum: 2 }, { initial: 2, maximum: 4 }, 1, u, 2);
+test({ initial: 2, maximum: 3 }, { initial: 2, maximum: 4 }, u, 0, 2);
+test({ initial: 2, maximum: 3 }, { initial: 2, maximum: 4 }, u, 1, 3);
+test({ initial: 2, maximum: 3 }, { initial: 2, maximum: 4 }, u, 2, 2);
+test({ initial: 2, maximum: 2 }, { initial: 2, maximum: 4 }, u, 0, 2);
+test({ initial: 2, maximum: 2 }, { initial: 2, maximum: 4 }, u, 1, 2);
+
+// Allowed: no declared maximum, same as above.
+test({ initial: 2, maximum: 4 }, { initial: 2 }, 0, u, 2);
+
+// Disallowed: imported initial is lesser than declared.
+assert.throws(() => test({ initial: 1, maximum: 4 }, { initial: 2, maximum: 4 }, u, u, 2), WebAssembly.LinkError, `Memory import provided an 'initial' that is smaller than the module's declared 'initial' import memory size`);
+assert.throws(() => test({ initial: 0, maximum: 4 }, { initial: 2, maximum: 4 }, u, u, 2), WebAssembly.LinkError, `Memory import provided an 'initial' that is smaller than the module's declared 'initial' import memory size`);
+
+// Disallowed: imported maximum is greater than declared.
+assert.throws(() => test({ initial: 2, maximum: 5 }, { initial: 2, maximum: 4 }, u, u, 2), WebAssembly.LinkError, `Memory import provided a 'maximum' that is larger than the module's declared 'maximum' import memory size`);
+
+// Disallowed: no imported maximum, same as above.
+assert.throws(() => test({ initial: 2 }, { initial: 2, maximum: 4 }, 0, u, 2), WebAssembly.LinkError, `Memory import did not have a 'maximum' but the module requires that it does`);
</ins></span></pre></div>
<a id="trunkJSTestswasmfunctiontestsmemorysectionandimportjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/function-tests/memory-section-and-import.js (0 => 214438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/function-tests/memory-section-and-import.js         (rev 0)
+++ trunk/JSTests/wasm/function-tests/memory-section-and-import.js        2017-03-27 23:24:31 UTC (rev 214438)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+import Builder from '../Builder.js';
+import * as assert from '../assert.js';
+
+const instantiate = (builder, importObject = undefined) => {
+ return new WebAssembly.Instance(
+ new WebAssembly.Module(
+ builder.WebAssembly().get()),
+ importObject);
+};
+
+const initial = 0;
+const maximum = 2;
+
+const builder0 = (new Builder())
+ .Type().End()
+ .Function().End()
+ .Memory().InitialMaxPages(initial, maximum).End()
+ .Export()
+ .Memory("memory", 0)
+ .End()
+ .Code().End();
+
+const builder1 = (new Builder())
+ .Type().End()
+ .Import().Memory("imp", "memory", { initial: initial, maximum: maximum }).End()
+ .Function().End()
+ .Memory().InitialMaxPages(initial, maximum).End()
+ .Code().End();
+
+const i0 = instantiate(builder0);
+assert.throws(() => instantiate(builder1, { imp: { memory: i0.exports.memory } }), WebAssembly.CompileError, `WebAssembly.Module doesn't parse at byte 34 / 40: Memory section cannot exist if an Import has a memory`);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (214437 => 214438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-03-27 23:21:19 UTC (rev 214437)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-03-27 23:24:31 UTC (rev 214438)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2017-03-27 JF Bastien <jfbastien@apple.com>
+
+ WebAssembly: misc memory testing
+ https://bugs.webkit.org/show_bug.cgi?id=170137
+
+ Reviewed by Keith Miller.
+
+ * wasm/js/WebAssemblyInstanceConstructor.cpp:
+ (JSC::WebAssemblyInstanceConstructor::createInstance): improve error messages
+
</ins><span class="cx"> 2017-03-27 Michael Saboff <msaboff@apple.com>
</span><span class="cx">
</span><span class="cx"> Add ARM64 system instructions to disassembler
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp (214437 => 214438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp        2017-03-27 23:21:19 UTC (rev 214437)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp        2017-03-27 23:24:31 UTC (rev 214438)
</span><span class="lines">@@ -168,16 +168,16 @@
</span><span class="cx"> if (!table)
</span><span class="cx"> return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Table import is not an instance of WebAssembly.Table")));
</span><span class="cx">
</span><del>- uint32_t expectedInitial = moduleInformation.tableInformation.initial();
- uint32_t actualInitial = table->size();
- if (actualInitial < expectedInitial)
</del><ins>+ uint32_t declaredInitial = moduleInformation.tableInformation.initial();
+ uint32_t importedInitial = table->size();
+ if (importedInitial < declaredInitial)
</ins><span class="cx"> return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Table import provided an 'initial' that is too small")));
</span><span class="cx">
</span><del>- if (std::optional<uint32_t> expectedMaximum = moduleInformation.tableInformation.maximum()) {
- std::optional<uint32_t> actualMaximum = table->maximum();
- if (!actualMaximum)
</del><ins>+ if (std::optional<uint32_t> declaredMaximum = moduleInformation.tableInformation.maximum()) {
+ std::optional<uint32_t> importedMaximum = table->maximum();
+ if (!importedMaximum)
</ins><span class="cx"> return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Table import does not have a 'maximum' but the module requires that it does")));
</span><del>- if (*actualMaximum > *expectedMaximum)
</del><ins>+ if (*importedMaximum > *declaredMaximum)
</ins><span class="cx"> return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Imported Table's 'maximum' is larger than the module's expected 'maximum'")));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -196,18 +196,18 @@
</span><span class="cx"> if (!memory)
</span><span class="cx"> return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import is not an instance of WebAssembly.Memory")));
</span><span class="cx">
</span><del>- Wasm::PageCount expectedInitial = moduleInformation.memory.initial();
- Wasm::PageCount actualInitial = memory->memory().initial();
- if (actualInitial < expectedInitial)
- return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import provided an 'initial' that is too small")));
</del><ins>+ Wasm::PageCount declaredInitial = moduleInformation.memory.initial();
+ Wasm::PageCount importedInitial = memory->memory().initial();
+ if (importedInitial < declaredInitial)
+ return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import provided an 'initial' that is smaller than the module's declared 'initial' import memory size")));
</ins><span class="cx">
</span><del>- if (Wasm::PageCount expectedMaximum = moduleInformation.memory.maximum()) {
- Wasm::PageCount actualMaximum = memory->memory().maximum();
- if (!actualMaximum)
</del><ins>+ if (Wasm::PageCount declaredMaximum = moduleInformation.memory.maximum()) {
+ Wasm::PageCount importedMaximum = memory->memory().maximum();
+ if (!importedMaximum)
</ins><span class="cx"> return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import did not have a 'maximum' but the module requires that it does")));
</span><span class="cx">
</span><del>- if (actualMaximum > expectedMaximum)
- return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory imports 'maximum' is larger than the module's expected 'maximum'")));
</del><ins>+ if (importedMaximum > declaredMaximum)
+ return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import provided a 'maximum' that is larger than the module's declared 'maximum' import memory size")));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // ii. Append v to memories.
</span></span></pre>
</div>
</div>
</body>
</html>