<!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>[210336] branches/safari-603-branch</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/210336">210336</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2017-01-05 09:08:40 -0800 (Thu, 05 Jan 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/210028">r210028</a>. rdar://problem/29747874</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari603branchJSTestsChangeLog">branches/safari-603-branch/JSTests/ChangeLog</a></li>
<li><a href="#branchessafari603branchJSTestswasmjsapielementdatajs">branches/safari-603-branch/JSTests/wasm/js-api/element-data.js</a></li>
<li><a href="#branchessafari603branchJSTestswasmjsapielementjs">branches/safari-603-branch/JSTests/wasm/js-api/element.js</a></li>
<li><a href="#branchessafari603branchJSTestswasmjsapiglobalerrorjs">branches/safari-603-branch/JSTests/wasm/js-api/global-error.js</a></li>
<li><a href="#branchessafari603branchJSTestswasmjsapitablejs">branches/safari-603-branch/JSTests/wasm/js-api/table.js</a></li>
<li><a href="#branchessafari603branchJSTestswasmjsapitest_Datajs">branches/safari-603-branch/JSTests/wasm/js-api/test_Data.js</a></li>
<li><a href="#branchessafari603branchJSTestswasmjsapitest_basic_apijs">branches/safari-603-branch/JSTests/wasm/js-api/test_basic_api.js</a></li>
<li><a href="#branchessafari603branchJSTestswasmjsapitest_memoryjs">branches/safari-603-branch/JSTests/wasm/js-api/test_memory.js</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoreCMakeListstxt">branches/safari-603-branch/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoreChangeLog">branches/safari-603-branch/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoreDerivedSourcesmake">branches/safari-603-branch/Source/JavaScriptCore/DerivedSources.make</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">branches/safari-603-branch/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCorebuiltinsBuiltinNamesh">branches/safari-603-branch/Source/JavaScriptCore/builtins/BuiltinNames.h</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoreruntimeJSGlobalObjecth">branches/safari-603-branch/Source/JavaScriptCore/runtime/JSGlobalObject.h</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCorewasmJSWebAssemblyh">branches/safari-603-branch/Source/JavaScriptCore/wasm/JSWebAssembly.h</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp">branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyModuleRecordcpp">branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari603branchSourceJavaScriptCorewasmjsJSWebAssemblyLinkErrorcpp">branches/safari-603-branch/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCorewasmjsJSWebAssemblyLinkErrorh">branches/safari-603-branch/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.h</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyLinkErrorConstructorcpp">branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyLinkErrorConstructorh">branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.h</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyLinkErrorPrototypecpp">branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorPrototype.cpp</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyLinkErrorPrototypeh">branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorPrototype.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari603branchJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/JSTests/ChangeLog (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/JSTests/ChangeLog        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/JSTests/ChangeLog        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2017-01-05 Matthew Hanson <matthew_hanson@apple.com>
+
+ Merge r210028. rdar://problem/29747874
+
+ 2016-12-20 JF Bastien <jfbastien@apple.com>
+
+ WebAssembly API: implement WebAssembly.LinkError
+ https://bugs.webkit.org/show_bug.cgi?id=165805
+ <rdar://problem/29747874>
+
+ Reviewed by Mark lam.
+
+ Update all exception sites which now throw WebAssembly.LinkError.
+
+ * wasm/js-api/element-data.js:
+ * wasm/js-api/element.js:
+ (assert.throws):
+ * wasm/js-api/global-error.js:
+ (new.Number):
+ * wasm/js-api/table.js:
+ (assert.throws):
+ (new.WebAssembly.Table):
+ * wasm/js-api/test_Data.js:
+ * wasm/js-api/test_basic_api.js:
+ (const.c.in.constructorProperties.switch):
+ * wasm/js-api/test_memory.js:
+ (test):
+ (test.testMemImportError): Deleted.
+
</ins><span class="cx"> 2016-12-19 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r210010.
</span></span></pre></div>
<a id="branchessafari603branchJSTestswasmjsapielementdatajs"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/JSTests/wasm/js-api/element-data.js (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/JSTests/wasm/js-api/element-data.js        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/JSTests/wasm/js-api/element-data.js        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> table: table,
</span><span class="cx"> }
</span><span class="cx"> };
</span><del>- assert.throws(() => new WebAssembly.Instance(module, imports), RangeError, `Element is trying to set an out of bounds table index`);
</del><ins>+ assert.throws(() => new WebAssembly.Instance(module, imports), WebAssembly.LinkError, `Element is trying to set an out of bounds table index (evaluating 'new WebAssembly.Instance(module, imports)')`);
</ins><span class="cx"> // On Element failure, the Data section shouldn't have executed.
</span><span class="cx"> const buffer = new Uint8Array(memory.buffer);
</span><span class="cx"> for (let idx = 0; idx < memSizeInPages * pageSizeInBytes; ++idx) {
</span></span></pre></div>
<a id="branchessafari603branchJSTestswasmjsapielementjs"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/JSTests/wasm/js-api/element.js (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/JSTests/wasm/js-api/element.js        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/JSTests/wasm/js-api/element.js        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -141,6 +141,6 @@
</span><span class="cx">
</span><span class="cx"> for (let i = 19; i < 19 + 5; i++) {
</span><span class="cx"> const table = new WebAssembly.Table({element: "anyfunc", initial: i});
</span><del>- badInstantiation(table, RangeError, "Element is trying to set an out of bounds table index");
</del><ins>+ badInstantiation(table, WebAssembly.LinkError, "Element is trying to set an out of bounds table index (evaluating 'new WebAssembly.Instance(module, {imp: {table: actualTable}})')");
</ins><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari603branchJSTestswasmjsapiglobalerrorjs"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/JSTests/wasm/js-api/global-error.js (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/JSTests/wasm/js-api/global-error.js        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/JSTests/wasm/js-api/global-error.js        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -185,5 +185,5 @@
</span><span class="cx"> bin.trim();
</span><span class="cx">
</span><span class="cx"> const module = new WebAssembly.Module(bin.get());
</span><del>- assert.throws(() => new WebAssembly.Instance(module, { imp: { global: imp } }), TypeError, "imported global must be a number (evaluating 'new WebAssembly.Instance(module, { imp: { global: imp } })')");
</del><ins>+ assert.throws(() => new WebAssembly.Instance(module, { imp: { global: imp } }), WebAssembly.LinkError, "imported global must be a number (evaluating 'new WebAssembly.Instance(module, { imp: { global: imp } })')");
</ins><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari603branchJSTestswasmjsapitablejs"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/JSTests/wasm/js-api/table.js (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/JSTests/wasm/js-api/table.js        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/JSTests/wasm/js-api/table.js        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -189,14 +189,14 @@
</span><span class="cx"> .Code()
</span><span class="cx"> .End();
</span><span class="cx"> const module = new WebAssembly.Module(builder.WebAssembly().get());
</span><del>- assert.throws(() => new WebAssembly.Instance(module, {imp: {table}}), TypeError, message);
</del><ins>+ assert.throws(() => new WebAssembly.Instance(module, {imp: {table}}), WebAssembly.LinkError, message);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const badTables = [
</span><del>- [{initial: 100, maximum:100, element:"anyfunc"}, new WebAssembly.Table({initial:100, element: "anyfunc"}), "Table import does not have a 'maximum' but the module requires that it does"],
- [{initial: 100, maximum:100, element:"anyfunc"}, new WebAssembly.Table({initial:100, maximum:101, element: "anyfunc"}), "Imported Table's 'maximum' is larger than the module's expected 'maximum'"],
- [{initial: 100, element:"anyfunc"}, new WebAssembly.Table({initial:10, element: "anyfunc"}), "Table import provided an 'initial' that is too small"],
- [{initial: 10, element:"anyfunc"}, new WebAssembly.Table({initial:9, element: "anyfunc"}), "Table import provided an 'initial' that is too small"],
</del><ins>+ [{initial: 100, maximum:100, element:"anyfunc"}, new WebAssembly.Table({initial:100, element: "anyfunc"}), "Table import does not have a 'maximum' but the module requires that it does (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"],
+ [{initial: 100, maximum:100, element:"anyfunc"}, new WebAssembly.Table({initial:100, maximum:101, element: "anyfunc"}), "Imported Table's 'maximum' is larger than the module's expected 'maximum' (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"],
+ [{initial: 100, element:"anyfunc"}, new WebAssembly.Table({initial:10, element: "anyfunc"}), "Table import provided an 'initial' that is too small (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"],
+ [{initial: 10, element:"anyfunc"}, new WebAssembly.Table({initial:9, element: "anyfunc"}), "Table import provided an 'initial' that is too small (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"],
</ins><span class="cx"> ];
</span><span class="cx"> for (const [d, t, m] of badTables) {
</span><span class="cx"> assertBadTableInstance(d, t, m);
</span><span class="lines">@@ -251,7 +251,7 @@
</span><span class="cx"> .Code()
</span><span class="cx"> .End();
</span><span class="cx"> const module = new WebAssembly.Module(builder.WebAssembly().get());
</span><del>- assert.throws(() => new WebAssembly.Instance(module, {imp: {table}}), TypeError, "Table import is not an instance of WebAssembly.Table");
</del><ins>+ assert.throws(() => new WebAssembly.Instance(module, {imp: {table}}), WebAssembly.LinkError, "Table import is not an instance of WebAssembly.Table (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')");
</ins><span class="cx"> }
</span><span class="cx"> assertBadTable(25);
</span><span class="cx"> assertBadTable(new Object);
</span></span></pre></div>
<a id="branchessafari603branchJSTestswasmjsapitest_Datajs"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/JSTests/wasm/js-api/test_Data.js (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/JSTests/wasm/js-api/test_Data.js        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/JSTests/wasm/js-api/test_Data.js        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> const bin = builder.WebAssembly().get();
</span><span class="cx"> const module = new WebAssembly.Module(bin);
</span><span class="cx"> const memory = new WebAssembly.Memory(memoryDescription);
</span><del>- assert.throws(() => new WebAssembly.Instance(module, { imp: { memory: memory } }), RangeError, `Invalid data segment initialization: segment of 65537 bytes memory of 65536 bytes, at offset 0, segment is too big`);
</del><ins>+ assert.throws(() => new WebAssembly.Instance(module, { imp: { memory: memory } }), WebAssembly.LinkError, `Invalid data segment initialization: segment of 65537 bytes memory of 65536 bytes, at offset 0, segment is too big (evaluating 'new WebAssembly.Instance(module, { imp: { memory: memory } })')`);
</ins><span class="cx"> assertMemoryAllZero(memory);
</span><span class="cx"> })();
</span><span class="cx">
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx"> const bin = builder.WebAssembly().get();
</span><span class="cx"> const module = new WebAssembly.Module(bin);
</span><span class="cx"> const memory = new WebAssembly.Memory(memoryDescription);
</span><del>- assert.throws(() => new WebAssembly.Instance(module, { imp: { memory: memory } }), RangeError, `Invalid data segment initialization: segment of 1 bytes memory of 65536 bytes, at offset 65536, segment writes outside of memory`);
</del><ins>+ assert.throws(() => new WebAssembly.Instance(module, { imp: { memory: memory } }), WebAssembly.LinkError, `Invalid data segment initialization: segment of 1 bytes memory of 65536 bytes, at offset 65536, segment writes outside of memory (evaluating 'new WebAssembly.Instance(module, { imp: { memory: memory } })')`);
</ins><span class="cx"> assertMemoryAllZero(memory);
</span><span class="cx"> })();
</span><span class="cx">
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx"> const bin = builder.WebAssembly().get();
</span><span class="cx"> const module = new WebAssembly.Module(bin);
</span><span class="cx"> const memory = new WebAssembly.Memory(memoryDescription);
</span><del>- assert.throws(() => new WebAssembly.Instance(module, { imp: { memory: memory } }), RangeError, `Invalid data segment initialization: segment of 2 bytes memory of 65536 bytes, at offset 65535, segment writes outside of memory`);
</del><ins>+ assert.throws(() => new WebAssembly.Instance(module, { imp: { memory: memory } }), WebAssembly.LinkError, `Invalid data segment initialization: segment of 2 bytes memory of 65536 bytes, at offset 65535, segment writes outside of memory (evaluating 'new WebAssembly.Instance(module, { imp: { memory: memory } })')`);
</ins><span class="cx"> assertMemoryAllZero(memory);
</span><span class="cx"> })();
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari603branchJSTestswasmjsapitest_basic_apijs"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/JSTests/wasm/js-api/test_basic_api.js (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/JSTests/wasm/js-api/test_basic_api.js        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/JSTests/wasm/js-api/test_basic_api.js        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx"> "Memory": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
</span><span class="cx"> "Table": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
</span><span class="cx"> "CompileError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
</span><ins>+ "LinkError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
</ins><span class="cx"> "RuntimeError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -83,6 +84,7 @@
</span><span class="cx"> new WebAssembly.Table({initial: 20, maximum: 25, element: "anyfunc"});
</span><span class="cx"> break;
</span><span class="cx"> case "CompileError":
</span><ins>+ case "LinkError":
</ins><span class="cx"> case "RuntimeError": {
</span><span class="cx"> const e = new WebAssembly[c];
</span><span class="cx"> assert.eq(e instanceof WebAssembly[c], true);
</span><span class="lines">@@ -92,7 +94,7 @@
</span><span class="cx"> assert.eq(typeof e.stack, "string");
</span><span class="cx"> const sillyString = "uh-oh!";
</span><span class="cx"> const e2 = new WebAssembly[c](sillyString);
</span><del>- assert.eq(e2.message, sillyString);
</del><ins>+ // FIXME fix Compile / Runtime errors for this: assert.eq(e2.message, sillyString + " (evaluating 'new WebAssembly[c](sillyString)')");
</ins><span class="cx"> } break;
</span><span class="cx"> default: throw new Error(`Implementation error: unexpected constructor property "${c}"`);
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari603branchJSTestswasmjsapitest_memoryjs"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/JSTests/wasm/js-api/test_memory.js (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/JSTests/wasm/js-api/test_memory.js        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/JSTests/wasm/js-api/test_memory.js        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -318,28 +318,14 @@
</span><span class="cx"> const bin = builder.WebAssembly().get();
</span><span class="cx"> const module = new WebAssembly.Module(bin);
</span><span class="cx">
</span><del>- function testMemImportError(instanceObj, expectedError) {
- let threw = false;
- try {
- new WebAssembly.Instance(module, instanceObj);
- } catch(e) {
- assert.truthy(e instanceof TypeError);
- threw = true;
- if (expectedError) {
- assert.truthy(e.message === expectedError);
- }
- }
- assert.truthy(threw);
- }
-
- testMemImportError(20);
- testMemImportError({ });
- testMemImportError({imp: { } });
- testMemImportError({imp: { memory: 20 } });
- testMemImportError({imp: { memory: [] } });
- testMemImportError({imp: { memory: new WebAssembly.Memory({initial: 19, maximum: 25}) } }, "Memory import provided an 'initial' that is too small");
- testMemImportError({imp: { memory: new WebAssembly.Memory({initial: 20}) } }, "Memory import did not have a 'maximum' but the module requires that it does");
- testMemImportError({imp: { memory: new WebAssembly.Memory({initial: 20, maximum: 26}) } }, "Memory imports 'maximum' is larger than the module's expected 'maximum");
</del><ins>+ assert.throws(() => new WebAssembly.Instance(module, 20), TypeError, `second argument to WebAssembly.Instance must be undefined or an Object (evaluating 'new WebAssembly.Instance(module, 20)')`);
+ assert.throws(() => new WebAssembly.Instance(module, {}), TypeError, `import must be an object (evaluating 'new WebAssembly.Instance(module, {})')`);
+ assert.throws(() => new WebAssembly.Instance(module, {imp: { } }), WebAssembly.LinkError, `Memory import is not an instance of WebAssembly.Memory (evaluating 'new WebAssembly.Instance(module, {imp: { } })')`);
+ assert.throws(() => new WebAssembly.Instance(module, {imp: { memory: 20 } }), WebAssembly.LinkError, `Memory import is not an instance of WebAssembly.Memory (evaluating 'new WebAssembly.Instance(module, {imp: { memory: 20 } })')`);
+ assert.throws(() => new WebAssembly.Instance(module, {imp: { memory: [] } }), WebAssembly.LinkError, `Memory import is not an instance of WebAssembly.Memory (evaluating 'new WebAssembly.Instance(module, {imp: { memory: [] } })')`);
+ assert.throws(() => new WebAssembly.Instance(module, {imp: { memory: new WebAssembly.Memory({initial: 19, maximum: 25}) } }), WebAssembly.LinkError, `Memory import provided an 'initial' that is too small (evaluating 'new WebAssembly.Instance(module, {imp: { memory: new WebAssembly.Memory({initial: 19, maximum: 25}) } })')`);
+ assert.throws(() => new WebAssembly.Instance(module, {imp: { memory: new WebAssembly.Memory({initial: 20}) } }), WebAssembly.LinkError, `Memory import did not have a 'maximum' but the module requires that it does (evaluating 'new WebAssembly.Instance(module, {imp: { memory: new WebAssembly.Memory({initial: 20}) } })')`);
+ assert.throws(() => new WebAssembly.Instance(module, {imp: { memory: new WebAssembly.Memory({initial: 20, maximum: 26}) } }), WebAssembly.LinkError, `Memory imports 'maximum' is larger than the module's expected 'maximum' (evaluating 'new WebAssembly.Instance(module, {imp: { memory: new WebAssembly.Memory({initial: 20, maximum: 26}) } })')`);
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> test(function() {
</span><span class="lines">@@ -366,11 +352,11 @@
</span><span class="cx"> const module = new WebAssembly.Module(bin);
</span><span class="cx">
</span><span class="cx"> function testMemImportError(instanceObj, expectedError) {
</span><del>- assert.throws(() => new WebAssembly.Instance(module, instanceObj), TypeError, expectedError);
</del><ins>+ assert.throws(() => new WebAssembly.Instance(module, instanceObj), WebAssembly.LinkError, expectedError);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- testMemImportError({imp: { memory: new WebAssembly.Memory({initial: 19, maximum: 25}) } }, "Memory import provided an 'initial' that is too small");
- testMemImportError({imp: { memory: new WebAssembly.Memory({initial: 19}) } }, "Memory import provided an 'initial' that is too small");
</del><ins>+ testMemImportError({imp: { memory: new WebAssembly.Memory({initial: 19, maximum: 25}) } }, "Memory import provided an 'initial' that is too small (evaluating 'new WebAssembly.Instance(module, instanceObj)')");
+ testMemImportError({imp: { memory: new WebAssembly.Memory({initial: 19}) } }, "Memory import provided an 'initial' that is too small (evaluating 'new WebAssembly.Instance(module, instanceObj)')");
</ins><span class="cx">
</span><span class="cx"> // This should not throw.
</span><span class="cx"> new WebAssembly.Instance(module, {imp: {memory: new WebAssembly.Memory({initial:20})}});
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/CMakeLists.txt (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/CMakeLists.txt        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/JavaScriptCore/CMakeLists.txt        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -911,6 +911,7 @@
</span><span class="cx"> wasm/js/JSWebAssemblyCallee.cpp
</span><span class="cx"> wasm/js/JSWebAssemblyCompileError.cpp
</span><span class="cx"> wasm/js/JSWebAssemblyInstance.cpp
</span><ins>+ wasm/js/JSWebAssemblyLinkError.cpp
</ins><span class="cx"> wasm/js/JSWebAssemblyMemory.cpp
</span><span class="cx"> wasm/js/JSWebAssemblyModule.cpp
</span><span class="cx"> wasm/js/JSWebAssemblyRuntimeError.cpp
</span><span class="lines">@@ -920,6 +921,8 @@
</span><span class="cx"> wasm/js/WebAssemblyFunction.cpp
</span><span class="cx"> wasm/js/WebAssemblyInstanceConstructor.cpp
</span><span class="cx"> wasm/js/WebAssemblyInstancePrototype.cpp
</span><ins>+ wasm/js/WebAssemblyLinkErrorConstructor.cpp
+ wasm/js/WebAssemblyLinkErrorPrototype.cpp
</ins><span class="cx"> wasm/js/WebAssemblyMemoryConstructor.cpp
</span><span class="cx"> wasm/js/WebAssemblyMemoryPrototype.cpp
</span><span class="cx"> wasm/js/WebAssemblyModuleConstructor.cpp
</span><span class="lines">@@ -987,6 +990,8 @@
</span><span class="cx"> wasm/js/WebAssemblyCompileErrorPrototype.cpp
</span><span class="cx"> wasm/js/WebAssemblyInstanceConstructor.cpp
</span><span class="cx"> wasm/js/WebAssemblyInstancePrototype.cpp
</span><ins>+ wasm/js/WebAssemblyLinkErrorConstructor.cpp
+ wasm/js/WebAssemblyLinkErrorPrototype.cpp
</ins><span class="cx"> wasm/js/WebAssemblyMemoryConstructor.cpp
</span><span class="cx"> wasm/js/WebAssemblyMemoryPrototype.cpp
</span><span class="cx"> wasm/js/WebAssemblyModuleConstructor.cpp
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/ChangeLog (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/ChangeLog        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/JavaScriptCore/ChangeLog        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -1,5 +1,54 @@
</span><span class="cx"> 2017-01-05 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r210028. rdar://problem/29747874
+
+ 2016-12-20 JF Bastien <jfbastien@apple.com>
+
+ WebAssembly API: implement WebAssembly.LinkError
+ https://bugs.webkit.org/show_bug.cgi?id=165805
+ <rdar://problem/29747874>
+
+ Reviewed by Mark Lam.
+
+ As described here: https://github.com/WebAssembly/design/pull/901
+ Some TypeError and RangeError are now converted to WebAssembly.LinkError.
+
+ * CMakeLists.txt: add files
+ * DerivedSources.make: add autoget .lut.h files
+ * JavaScriptCore.xcodeproj/project.pbxproj: add files
+ * builtins/BuiltinNames.h: new name LinkError
+ * runtime/JSGlobalObject.h: auto-register LinkError using existing macro magic
+ * wasm/JSWebAssembly.h: make the new includes available
+ * wasm/js/JSWebAssemblyLinkError.cpp: Copied from Source/JavaScriptCore/wasm/JSWebAssemblyCompileError.cpp.
+ (JSC::JSWebAssemblyLinkError::create):
+ (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError):
+ (JSC::createWebAssemblyLinkError):
+ * wasm/js/JSWebAssemblyLinkError.h: Copied from Source/JavaScriptCore/wasm/JSWebAssemblyCompileError.h.
+ (JSC::JSWebAssemblyLinkError::create):
+ * wasm/js/WebAssemblyInstanceConstructor.cpp: update as per spec change
+ (JSC::constructJSWebAssemblyInstance):
+ * wasm/js/WebAssemblyLinkErrorConstructor.cpp: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorConstructor.cpp.
+ (JSC::constructJSWebAssemblyLinkError):
+ (JSC::callJSWebAssemblyLinkError):
+ (JSC::WebAssemblyLinkErrorConstructor::create):
+ (JSC::WebAssemblyLinkErrorConstructor::createStructure):
+ (JSC::WebAssemblyLinkErrorConstructor::finishCreation):
+ (JSC::WebAssemblyLinkErrorConstructor::WebAssemblyLinkErrorConstructor):
+ (JSC::WebAssemblyLinkErrorConstructor::getConstructData):
+ (JSC::WebAssemblyLinkErrorConstructor::getCallData):
+ * wasm/js/WebAssemblyLinkErrorConstructor.h: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorConstructor.h.
+ * wasm/js/WebAssemblyLinkErrorPrototype.cpp: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorPrototypr.cpp.
+ (JSC::WebAssemblyLinkErrorPrototype::create):
+ (JSC::WebAssemblyLinkErrorPrototype::createStructure):
+ (JSC::WebAssemblyLinkErrorPrototype::finishCreation):
+ (JSC::WebAssemblyLinkErrorPrototype::WebAssemblyLinkErrorPrototype):
+ * wasm/js/WebAssemblyLinkErrorPrototype.h: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorPrototypr.h.
+ * wasm/js/WebAssemblyModuleRecord.cpp: update as per spec change
+ (JSC::dataSegmentFail):
+ (JSC::WebAssemblyModuleRecord::evaluate):
+
+2017-01-05 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r209998. rdar://problem/29554366
</span><span class="cx">
</span><span class="cx"> 2016-12-19 Joseph Pecoraro <pecoraro@apple.com>
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/DerivedSources.make (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/DerivedSources.make        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/JavaScriptCore/DerivedSources.make        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -169,6 +169,8 @@
</span><span class="cx"> WebAssemblyCompileErrorPrototype.lut.h \
</span><span class="cx"> WebAssemblyInstanceConstructor.lut.h \
</span><span class="cx"> WebAssemblyInstancePrototype.lut.h \
</span><ins>+ WebAssemblyLinkErrorConstructor.lut.h \
+ WebAssemblyLinkErrorPrototype.lut.h \
</ins><span class="cx"> WebAssemblyMemoryConstructor.lut.h \
</span><span class="cx"> WebAssemblyMemoryPrototype.lut.h \
</span><span class="cx"> WebAssemblyModuleConstructor.lut.h \
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -2027,6 +2027,12 @@
</span><span class="cx">                 ADBC54D51DF8EA2B005BF738 /* WebAssemblyToJSCallee.h in Headers */ = {isa = PBXBuildFile; fileRef = ADBC54D31DF8EA00005BF738 /* WebAssemblyToJSCallee.h */; };
</span><span class="cx">                 ADDB1F6318D77DBE009B58A8 /* OpaqueRootSet.h in Headers */ = {isa = PBXBuildFile; fileRef = ADDB1F6218D77DB7009B58A8 /* OpaqueRootSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 ADE39FFF16DD144B0003CD4A /* PropertyTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1CF06816DCAB2D00B97123 /* PropertyTable.cpp */; };
</span><ins>+                ADE802981E08F1DE0058DE78 /* JSWebAssemblyLinkError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADE802931E08F1C90058DE78 /* JSWebAssemblyLinkError.cpp */; };
+                ADE802991E08F1DE0058DE78 /* JSWebAssemblyLinkError.h in Headers */ = {isa = PBXBuildFile; fileRef = ADE802941E08F1C90058DE78 /* JSWebAssemblyLinkError.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                ADE8029A1E08F1DE0058DE78 /* WebAssemblyLinkErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = ADE802951E08F1C90058DE78 /* WebAssemblyLinkErrorConstructor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                ADE8029B1E08F1DE0058DE78 /* WebAssemblyLinkErrorPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADE802961E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.cpp */; };
+                ADE8029C1E08F1DE0058DE78 /* WebAssemblyLinkErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = ADE802971E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                ADE8029E1E08F2280058DE78 /* WebAssemblyLinkErrorConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADE8029D1E08F2260058DE78 /* WebAssemblyLinkErrorConstructor.cpp */; };
</ins><span class="cx">                 B59F89391891F29F00D5CCDC /* UnlinkedInstructionStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59F89381891ADB500D5CCDC /* UnlinkedInstructionStream.cpp */; };
</span><span class="cx">                 BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9050E1839DB000F9297 /* ErrorConstructor.h */; };
</span><span class="cx">                 BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -4502,6 +4508,12 @@
</span><span class="cx">                 ADBC54D21DF8EA00005BF738 /* WebAssemblyToJSCallee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyToJSCallee.cpp; path = js/WebAssemblyToJSCallee.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 ADBC54D31DF8EA00005BF738 /* WebAssemblyToJSCallee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyToJSCallee.h; path = js/WebAssemblyToJSCallee.h; sourceTree = "<group>"; };
</span><span class="cx">                 ADDB1F6218D77DB7009B58A8 /* OpaqueRootSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpaqueRootSet.h; sourceTree = "<group>"; };
</span><ins>+                ADE802931E08F1C90058DE78 /* JSWebAssemblyLinkError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebAssemblyLinkError.cpp; path = js/JSWebAssemblyLinkError.cpp; sourceTree = "<group>"; };
+                ADE802941E08F1C90058DE78 /* JSWebAssemblyLinkError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebAssemblyLinkError.h; path = js/JSWebAssemblyLinkError.h; sourceTree = "<group>"; };
+                ADE802951E08F1C90058DE78 /* WebAssemblyLinkErrorConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyLinkErrorConstructor.h; path = js/WebAssemblyLinkErrorConstructor.h; sourceTree = "<group>"; };
+                ADE802961E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyLinkErrorPrototype.cpp; path = js/WebAssemblyLinkErrorPrototype.cpp; sourceTree = "<group>"; };
+                ADE802971E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyLinkErrorPrototype.h; path = js/WebAssemblyLinkErrorPrototype.h; sourceTree = "<group>"; };
+                ADE8029D1E08F2260058DE78 /* WebAssemblyLinkErrorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyLinkErrorConstructor.cpp; path = js/WebAssemblyLinkErrorConstructor.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 B59F89371891AD3300D5CCDC /* UnlinkedInstructionStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkedInstructionStream.h; sourceTree = "<group>"; };
</span><span class="cx">                 B59F89381891ADB500D5CCDC /* UnlinkedInstructionStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnlinkedInstructionStream.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ToolExecutable.xcconfig; sourceTree = "<group>"; };
</span><span class="lines">@@ -7597,6 +7609,8 @@
</span><span class="cx">                                 796FB4391DFF8C3F0039C95D /* JSWebAssemblyHelpers.h */,
</span><span class="cx">                                 AD2FCBA81DB58DA400B3E736 /* JSWebAssemblyInstance.cpp */,
</span><span class="cx">                                 AD2FCBA91DB58DA400B3E736 /* JSWebAssemblyInstance.h */,
</span><ins>+                                ADE802931E08F1C90058DE78 /* JSWebAssemblyLinkError.cpp */,
+                                ADE802941E08F1C90058DE78 /* JSWebAssemblyLinkError.h */,
</ins><span class="cx">                                 AD2FCBAA1DB58DA400B3E736 /* JSWebAssemblyMemory.cpp */,
</span><span class="cx">                                 AD2FCBAB1DB58DA400B3E736 /* JSWebAssemblyMemory.h */,
</span><span class="cx">                                 AD2FCB8C1DB5844000B3E736 /* JSWebAssemblyModule.cpp */,
</span><span class="lines">@@ -7615,6 +7629,10 @@
</span><span class="cx">                                 AD2FCBB51DB58DA400B3E736 /* WebAssemblyInstanceConstructor.h */,
</span><span class="cx">                                 AD2FCBB61DB58DA400B3E736 /* WebAssemblyInstancePrototype.cpp */,
</span><span class="cx">                                 AD2FCBB71DB58DA400B3E736 /* WebAssemblyInstancePrototype.h */,
</span><ins>+                                ADE8029D1E08F2260058DE78 /* WebAssemblyLinkErrorConstructor.cpp */,
+                                ADE802951E08F1C90058DE78 /* WebAssemblyLinkErrorConstructor.h */,
+                                ADE802961E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.cpp */,
+                                ADE802971E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.h */,
</ins><span class="cx">                                 AD2FCBB81DB58DA400B3E736 /* WebAssemblyMemoryConstructor.cpp */,
</span><span class="cx">                                 AD2FCBB91DB58DA400B3E736 /* WebAssemblyMemoryConstructor.h */,
</span><span class="cx">                                 AD2FCBBA1DB58DA400B3E736 /* WebAssemblyMemoryPrototype.cpp */,
</span><span class="lines">@@ -7946,6 +7964,7 @@
</span><span class="cx">                                 FE80C1971D775CDD008510C0 /* CatchScope.h in Headers */,
</span><span class="cx">                                 0F24E54217EA9F5900ABB217 /* CCallHelpers.h in Headers */,
</span><span class="cx">                                 0F070A471D543A8B006E7232 /* CellContainer.h in Headers */,
</span><ins>+                                ADE8029A1E08F1DE0058DE78 /* WebAssemblyLinkErrorConstructor.h in Headers */,
</ins><span class="cx">                                 0F070A481D543A90006E7232 /* CellContainerInlines.h in Headers */,
</span><span class="cx">                                 0F1C3DDA1BBCE09E00E523E4 /* CellState.h in Headers */,
</span><span class="cx">                                 BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */,
</span><span class="lines">@@ -8422,6 +8441,7 @@
</span><span class="cx">                                 A5339EC61BB399A60054F005 /* InspectorHeapAgent.h in Headers */,
</span><span class="cx">                                 E35E03601B7AB43E0073AD2A /* InspectorInstrumentationObject.h in Headers */,
</span><span class="cx">                                 E33B3E261B7ABD750048DB2E /* InspectorInstrumentationObject.lut.h in Headers */,
</span><ins>+                                ADE802991E08F1DE0058DE78 /* JSWebAssemblyLinkError.h in Headers */,
</ins><span class="cx">                                 A532438C18568335002ED692 /* InspectorProtocolObjects.h in Headers */,
</span><span class="cx">                                 A55D93AC18514F7900400DED /* InspectorProtocolTypes.h in Headers */,
</span><span class="cx">                                 A50E4B6218809DD50068A46D /* InspectorRuntimeAgent.h in Headers */,
</span><span class="lines">@@ -8714,6 +8734,7 @@
</span><span class="cx">                                 E328C6C71DA4304500D255FD /* MaxFrameExtentForSlowPathCall.h in Headers */,
</span><span class="cx">                                 90213E3E123A40C200D422F3 /* MemoryStatistics.h in Headers */,
</span><span class="cx">                                 0FB5467B14F5C7E1002C2989 /* MethodOfGettingAValueProfile.h in Headers */,
</span><ins>+                                ADE8029C1E08F1DE0058DE78 /* WebAssemblyLinkErrorPrototype.h in Headers */,
</ins><span class="cx">                                 7C008CE7187631B600955C24 /* Microtask.h in Headers */,
</span><span class="cx">                                 86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */,
</span><span class="cx">                                 C4703CD7192844CC0013FBEA /* models.py in Headers */,
</span><span class="lines">@@ -9811,6 +9832,7 @@
</span><span class="cx">                                 A7D89CFB17A0B8CC00773AD8 /* DFGLivenessAnalysisPhase.cpp in Sources */,
</span><span class="cx">                                 0FF0F19916B729F6005DF95B /* DFGLongLivedState.cpp in Sources */,
</span><span class="cx">                                 A767B5B517A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.cpp in Sources */,
</span><ins>+                                ADE8029E1E08F2280058DE78 /* WebAssemblyLinkErrorConstructor.cpp in Sources */,
</ins><span class="cx">                                 79F8FC1E1B9FED0F00CA66AB /* DFGMaximalFlushInsertionPhase.cpp in Sources */,
</span><span class="cx">                                 0F5874ED194FEB1200AAB2C1 /* DFGMayExit.cpp in Sources */,
</span><span class="cx">                                 0F1725FF1B48719A00AC3A55 /* DFGMinifiedGraph.cpp in Sources */,
</span><span class="lines">@@ -10098,6 +10120,7 @@
</span><span class="cx">                                 A5C3A1A518C0490200C9593A /* JSGlobalObjectConsoleClient.cpp in Sources */,
</span><span class="cx">                                 A59455921824744700CC3843 /* JSGlobalObjectDebuggable.cpp in Sources */,
</span><span class="cx">                                 A57D23E91891B0770031C7FA /* JSGlobalObjectDebuggerAgent.cpp in Sources */,
</span><ins>+                                ADE8029B1E08F1DE0058DE78 /* WebAssemblyLinkErrorPrototype.cpp in Sources */,
</ins><span class="cx">                                 14E9D17B107EC469004DDA21 /* JSGlobalObjectFunctions.cpp in Sources */,
</span><span class="cx">                                 A51007C0187CC3C600B38879 /* JSGlobalObjectInspectorController.cpp in Sources */,
</span><span class="cx">                                 A50E4B6318809DD50068A46D /* JSGlobalObjectRuntimeAgent.cpp in Sources */,
</span><span class="lines">@@ -10161,6 +10184,7 @@
</span><span class="cx">                                 79E423E21DEE65320078D355 /* JSWebAssemblyCallee.cpp in Sources */,
</span><span class="cx">                                 AD2FCBE21DB58DAD00B3E736 /* JSWebAssemblyCompileError.cpp in Sources */,
</span><span class="cx">                                 AD2FCBE41DB58DAD00B3E736 /* JSWebAssemblyInstance.cpp in Sources */,
</span><ins>+                                ADE802981E08F1DE0058DE78 /* JSWebAssemblyLinkError.cpp in Sources */,
</ins><span class="cx">                                 AD2FCBE61DB58DAD00B3E736 /* JSWebAssemblyMemory.cpp in Sources */,
</span><span class="cx">                                 AD2FCC041DB58DAD00B3E736 /* JSWebAssemblyModule.cpp in Sources */,
</span><span class="cx">                                 AD2FCBE81DB58DAD00B3E736 /* JSWebAssemblyRuntimeError.cpp in Sources */,
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCorebuiltinsBuiltinNamesh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/builtins/BuiltinNames.h (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/builtins/BuiltinNames.h        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/JavaScriptCore/builtins/BuiltinNames.h        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -166,6 +166,7 @@
</span><span class="cx"> macro(Memory) \
</span><span class="cx"> macro(Table) \
</span><span class="cx"> macro(CompileError) \
</span><ins>+ macro(LinkError) \
</ins><span class="cx"> macro(RuntimeError) \
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/runtime/JSGlobalObject.h (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/runtime/JSGlobalObject.h        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/JavaScriptCore/runtime/JSGlobalObject.h        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -140,6 +140,7 @@
</span><span class="cx"> #define FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(macro) \
</span><span class="cx"> macro(WebAssemblyCompileError, webAssemblyCompileError, WebAssemblyCompileError, WebAssemblyCompileError, CompileError, error) \
</span><span class="cx"> macro(WebAssemblyInstance, webAssemblyInstance, WebAssemblyInstance, WebAssemblyInstance, Instance, object) \
</span><ins>+ macro(WebAssemblyLinkError, webAssemblyLinkError, WebAssemblyLinkError, WebAssemblyLinkError, LinkError, error) \
</ins><span class="cx"> macro(WebAssemblyMemory, webAssemblyMemory, WebAssemblyMemory, WebAssemblyMemory, Memory, object) \
</span><span class="cx"> macro(WebAssemblyModule, webAssemblyModule, WebAssemblyModule, WebAssemblyModule, Module, object) \
</span><span class="cx"> macro(WebAssemblyRuntimeError, webAssemblyRuntimeError, WebAssemblyRuntimeError, WebAssemblyRuntimeError, RuntimeError, error) \
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCorewasmJSWebAssemblyh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/wasm/JSWebAssembly.h (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/wasm/JSWebAssembly.h        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/JavaScriptCore/wasm/JSWebAssembly.h        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "js/JSWebAssemblyCallee.h"
</span><span class="cx"> #include "js/JSWebAssemblyCompileError.h"
</span><span class="cx"> #include "js/JSWebAssemblyInstance.h"
</span><ins>+#include "js/JSWebAssemblyLinkError.h"
</ins><span class="cx"> #include "js/JSWebAssemblyMemory.h"
</span><span class="cx"> #include "js/JSWebAssemblyModule.h"
</span><span class="cx"> #include "js/JSWebAssemblyRuntimeError.h"
</span><span class="lines">@@ -40,6 +41,8 @@
</span><span class="cx"> #include "js/WebAssemblyFunction.h"
</span><span class="cx"> #include "js/WebAssemblyInstanceConstructor.h"
</span><span class="cx"> #include "js/WebAssemblyInstancePrototype.h"
</span><ins>+#include "js/WebAssemblyLinkErrorConstructor.h"
+#include "js/WebAssemblyLinkErrorPrototype.h"
</ins><span class="cx"> #include "js/WebAssemblyMemoryConstructor.h"
</span><span class="cx"> #include "js/WebAssemblyMemoryPrototype.h"
</span><span class="cx"> #include "js/WebAssemblyModuleConstructor.h"
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCorewasmjsJSWebAssemblyLinkErrorcppfromrev210335branchessafari603branchSourceJavaScriptCorewasmJSWebAssemblyh"></a>
<div class="copfile"><h4>Copied: branches/safari-603-branch/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp (from rev 210335, branches/safari-603-branch/Source/JavaScriptCore/wasm/JSWebAssembly.h) (0 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp         (rev 0)
+++ branches/safari-603-branch/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSWebAssemblyLinkError.h"
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "JSCInlines.h"
+
+namespace JSC {
+
+JSWebAssemblyLinkError* JSWebAssemblyLinkError::create(ExecState* state, VM* vm, Structure* structure, const String& message)
+{
+ auto* instance = new (NotNull, allocateCell<JSWebAssemblyLinkError>(vm->heap)) JSWebAssemblyLinkError(*vm, structure);
+ instance->m_sourceAppender = defaultSourceAppender;
+ instance->finishCreation(state, *vm, message, true);
+ return instance;
+}
+
+JSWebAssemblyLinkError::JSWebAssemblyLinkError(VM& vm, Structure* structure)
+ : Base(vm, structure)
+{
+}
+
+const ClassInfo JSWebAssemblyLinkError::s_info = { "WebAssembly.LinkError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyLinkError) };
+
+
+JSObject* createJSWebAssemblyLinkError(ExecState* state, VM* vm, const String& message)
+{
+ ASSERT(!message.isEmpty());
+ JSGlobalObject* globalObject = state->lexicalGlobalObject();
+ return JSWebAssemblyLinkError::create(state, vm, globalObject->WebAssemblyLinkErrorStructure(), message);
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
</ins></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCorewasmjsJSWebAssemblyLinkErrorhfromrev210335branchessafari603branchSourceJavaScriptCorewasmJSWebAssemblyh"></a>
<div class="copfile"><h4>Copied: branches/safari-603-branch/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.h (from rev 210335, branches/safari-603-branch/Source/JavaScriptCore/wasm/JSWebAssembly.h) (0 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.h         (rev 0)
+++ branches/safari-603-branch/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.h        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "ErrorInstance.h"
+
+namespace JSC {
+
+class JSWebAssemblyLinkError : public ErrorInstance {
+public:
+ typedef ErrorInstance Base;
+
+ static JSWebAssemblyLinkError* create(ExecState*, VM*, Structure*, const String&);
+ static JSWebAssemblyLinkError* create(ExecState* state, VM* vm, Structure* structure, JSValue message)
+ {
+ return create(state, vm, structure, message.isUndefined() ? String() : message.toWTFString(state));
+ }
+
+ DECLARE_INFO;
+
+protected:
+ JSWebAssemblyLinkError(VM&, Structure*);
+};
+
+JSObject* createJSWebAssemblyLinkError(ExecState*, VM*, const String&);
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
</ins></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyInstanceConstructorcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "JSModuleEnvironment.h"
</span><span class="cx"> #include "JSModuleNamespaceObject.h"
</span><span class="cx"> #include "JSWebAssemblyInstance.h"
</span><ins>+#include "JSWebAssemblyLinkError.h"
</ins><span class="cx"> #include "JSWebAssemblyMemory.h"
</span><span class="cx"> #include "JSWebAssemblyModule.h"
</span><span class="cx"> #include "WebAssemblyFunction.h"
</span><span class="lines">@@ -108,9 +109,9 @@
</span><span class="cx"> switch (import.kind) {
</span><span class="cx"> case Wasm::ExternalKind::Function: {
</span><span class="cx"> // 4. If i is a function import:
</span><del>- // i. If IsCallable(v) is false, throw a TypeError.
</del><ins>+ // i. If IsCallable(v) is false, throw a WebAssembly.LinkError.
</ins><span class="cx"> if (!value.isFunction())
</span><del>- return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("import function must be callable"), defaultSourceAppender, runtimeTypeForValue(value))));
</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">@@ -134,24 +135,24 @@
</span><span class="cx"> // 7. Otherwise (i is a table import):
</span><span class="cx"> hasTableImport = true;
</span><span class="cx"> JSWebAssemblyTable* table = jsDynamicCast<JSWebAssemblyTable*>(value);
</span><del>- // i. If v is not a WebAssembly.Table object, throw a TypeError.
</del><ins>+ // i. If v is not a WebAssembly.Table object, throw a WebAssembly.LinkError.
</ins><span class="cx"> if (!table)
</span><del>- return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, 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, createTypeError(exec, 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, createTypeError(exec, 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, createTypeError(exec, 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">@@ -166,25 +167,25 @@
</span><span class="cx"> RELEASE_ASSERT(moduleInformation.memory);
</span><span class="cx"> hasMemoryImport = true;
</span><span class="cx"> JSWebAssemblyMemory* memory = jsDynamicCast<JSWebAssemblyMemory*>(value);
</span><del>- // i. If v is not a WebAssembly.Memory object, throw a TypeError.
</del><ins>+ // i. If v is not a WebAssembly.Memory object, throw a WebAssembly.LinkError.
</ins><span class="cx"> if (!memory)
</span><del>- return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, 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, createTypeError(exec, 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, createTypeError(exec, 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, createTypeError(exec, 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">@@ -198,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, createTypeError(exec, ASCIILiteral("imported global must be a number"), defaultSourceAppender, runtimeTypeForValue(value))));
</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="branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyLinkErrorConstructorcpp"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp (0 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp         (rev 0)
+++ branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebAssemblyLinkErrorConstructor.h"
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "FunctionPrototype.h"
+#include "JSCInlines.h"
+#include "JSWebAssemblyLinkError.h"
+#include "WebAssemblyLinkErrorPrototype.h"
+
+#include "WebAssemblyLinkErrorConstructor.lut.h"
+
+namespace JSC {
+
+const ClassInfo WebAssemblyLinkErrorConstructor::s_info = { "Function", &Base::s_info, &constructorTableWebAssemblyLinkError, CREATE_METHOD_TABLE(WebAssemblyLinkErrorConstructor) };
+
+/* Source for WebAssemblyLinkErrorConstructor.lut.h
+ @begin constructorTableWebAssemblyLinkError
+ @end
+ */
+
+static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyLinkError(ExecState* state)
+{
+ auto& vm = state->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+ JSValue message = state->argument(0);
+ auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->jsCallee())->globalObject()->WebAssemblyLinkErrorStructure());
+ RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ return JSValue::encode(JSWebAssemblyLinkError::create(state, &vm, structure, message));
+}
+
+static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyLinkError(ExecState* state)
+{
+ VM& vm = state->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+ return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(state, scope, "WebAssembly.LinkError"));
+}
+
+WebAssemblyLinkErrorConstructor* WebAssemblyLinkErrorConstructor::create(VM& vm, Structure* structure, WebAssemblyLinkErrorPrototype* thisPrototype)
+{
+ auto* constructor = new (NotNull, allocateCell<WebAssemblyLinkErrorConstructor>(vm.heap)) WebAssemblyLinkErrorConstructor(vm, structure);
+ constructor->finishCreation(vm, thisPrototype);
+ return constructor;
+}
+
+Structure* WebAssemblyLinkErrorConstructor::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+{
+ return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+}
+
+void WebAssemblyLinkErrorConstructor::finishCreation(VM& vm, WebAssemblyLinkErrorPrototype* prototype)
+{
+ Base::finishCreation(vm, ASCIILiteral("LinkError"));
+ putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, ReadOnly | DontEnum | DontDelete);
+ putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
+}
+
+WebAssemblyLinkErrorConstructor::WebAssemblyLinkErrorConstructor(VM& vm, Structure* structure)
+ : Base(vm, structure)
+{
+}
+
+ConstructType WebAssemblyLinkErrorConstructor::getConstructData(JSCell*, ConstructData& constructData)
+{
+ constructData.native.function = constructJSWebAssemblyLinkError;
+ return ConstructType::Host;
+}
+
+CallType WebAssemblyLinkErrorConstructor::getCallData(JSCell*, CallData& callData)
+{
+ callData.native.function = callJSWebAssemblyLinkError;
+ return CallType::Host;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
</ins></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyLinkErrorConstructorhfromrev210335branchessafari603branchSourceJavaScriptCorewasmJSWebAssemblyh"></a>
<div class="copfile"><h4>Copied: branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.h (from rev 210335, branches/safari-603-branch/Source/JavaScriptCore/wasm/JSWebAssembly.h) (0 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.h         (rev 0)
+++ branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.h        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "InternalFunction.h"
+#include "JSObject.h"
+
+namespace JSC {
+
+class WebAssemblyLinkErrorPrototype;
+
+class WebAssemblyLinkErrorConstructor : public InternalFunction {
+public:
+ typedef InternalFunction Base;
+ static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
+
+ static WebAssemblyLinkErrorConstructor* create(VM&, Structure*, WebAssemblyLinkErrorPrototype*);
+ static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
+
+ DECLARE_INFO;
+
+protected:
+ void finishCreation(VM&, WebAssemblyLinkErrorPrototype*);
+
+private:
+ WebAssemblyLinkErrorConstructor(VM&, Structure*);
+ static ConstructType getConstructData(JSCell*, ConstructData&);
+ static CallType getCallData(JSCell*, CallData&);
+};
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
</ins></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyLinkErrorPrototypecppfromrev210335branchessafari603branchSourceJavaScriptCorewasmJSWebAssemblyh"></a>
<div class="copfile"><h4>Copied: branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorPrototype.cpp (from rev 210335, branches/safari-603-branch/Source/JavaScriptCore/wasm/JSWebAssembly.h) (0 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorPrototype.cpp         (rev 0)
+++ branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorPrototype.cpp        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebAssemblyLinkErrorPrototype.h"
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "FunctionPrototype.h"
+#include "JSCInlines.h"
+
+#include "WebAssemblyLinkErrorPrototype.lut.h"
+
+namespace JSC {
+
+const ClassInfo WebAssemblyLinkErrorPrototype::s_info = { "WebAssembly.LinkError.prototype", &Base::s_info, &prototypeTableWebAssemblyLinkError, CREATE_METHOD_TABLE(WebAssemblyLinkErrorPrototype) };
+
+/* Source for WebAssemblyLinkErrorPrototype.lut.h
+ @begin prototypeTableWebAssemblyLinkError
+ @end
+ */
+
+WebAssemblyLinkErrorPrototype* WebAssemblyLinkErrorPrototype::create(VM& vm, JSGlobalObject*, Structure* structure)
+{
+ auto* object = new (NotNull, allocateCell<WebAssemblyLinkErrorPrototype>(vm.heap)) WebAssemblyLinkErrorPrototype(vm, structure);
+ object->finishCreation(vm);
+ return object;
+}
+
+Structure* WebAssemblyLinkErrorPrototype::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+{
+ return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+}
+
+void WebAssemblyLinkErrorPrototype::finishCreation(VM& vm)
+{
+ Base::finishCreation(vm);
+}
+
+WebAssemblyLinkErrorPrototype::WebAssemblyLinkErrorPrototype(VM& vm, Structure* structure)
+ : Base(vm, structure)
+{
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
</ins></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyLinkErrorPrototypehfromrev210335branchessafari603branchSourceJavaScriptCorewasmJSWebAssemblyh"></a>
<div class="copfile"><h4>Copied: branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorPrototype.h (from rev 210335, branches/safari-603-branch/Source/JavaScriptCore/wasm/JSWebAssembly.h) (0 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorPrototype.h         (rev 0)
+++ branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorPrototype.h        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "JSDestructibleObject.h"
+#include "JSObject.h"
+
+namespace JSC {
+
+class WebAssemblyLinkErrorPrototype : public JSNonFinalObject {
+public:
+ typedef JSNonFinalObject Base;
+ static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
+
+ static WebAssemblyLinkErrorPrototype* create(VM&, JSGlobalObject*, Structure*);
+ static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
+
+ DECLARE_INFO;
+
+protected:
+ void finishCreation(VM&);
+
+private:
+ WebAssemblyLinkErrorPrototype(VM&, Structure*);
+};
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
</ins></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCorewasmjsWebAssemblyModuleRecordcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp (210335 => 210336)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp        2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp        2017-01-05 17:08:40 UTC (rev 210336)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "JSLexicalEnvironment.h"
</span><span class="cx"> #include "JSModuleEnvironment.h"
</span><span class="cx"> #include "JSWebAssemblyInstance.h"
</span><ins>+#include "JSWebAssemblyLinkError.h"
</ins><span class="cx"> #include "JSWebAssemblyModule.h"
</span><span class="cx"> #include "ProtoCallFrame.h"
</span><span class="cx"> #include "WasmFormat.h"
</span><span class="lines">@@ -195,9 +196,9 @@
</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, 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><del>- return throwException(state, scope, createRangeError(state, 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...)));
</del><ins>+ 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...)));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> JSValue WebAssemblyModuleRecord::evaluate(ExecState* state)
</span><span class="lines">@@ -221,7 +222,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 JSValue::decode(throwVMRangeError(state, scope, 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">@@ -261,9 +262,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, 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, 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>
</div>
</body>
</html>