Diff
Modified: branches/safari-603-branch/JSTests/ChangeLog (210335 => 210336)
--- 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)
@@ -1,3 +1,32 @@
+2017-01-05 Matthew Hanson <[email protected]>
+
+ Merge r210028. rdar://problem/29747874
+
+ 2016-12-20 JF Bastien <[email protected]>
+
+ 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.
+
2016-12-19 Babak Shafiei <[email protected]>
Merge r210010.
Modified: branches/safari-603-branch/JSTests/wasm/js-api/element-data.js (210335 => 210336)
--- 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)
@@ -37,7 +37,7 @@
table: table,
}
};
- assert.throws(() => new WebAssembly.Instance(module, imports), RangeError, `Element is trying to set an out of bounds table index`);
+ 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)')`);
// On Element failure, the Data section shouldn't have executed.
const buffer = new Uint8Array(memory.buffer);
for (let idx = 0; idx < memSizeInPages * pageSizeInBytes; ++idx) {
Modified: branches/safari-603-branch/JSTests/wasm/js-api/element.js (210335 => 210336)
--- 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)
@@ -141,6 +141,6 @@
for (let i = 19; i < 19 + 5; i++) {
const table = new WebAssembly.Table({element: "anyfunc", initial: i});
- badInstantiation(table, RangeError, "Element is trying to set an out of bounds table index");
+ badInstantiation(table, WebAssembly.LinkError, "Element is trying to set an out of bounds table index (evaluating 'new WebAssembly.Instance(module, {imp: {table: actualTable}})')");
}
}
Modified: branches/safari-603-branch/JSTests/wasm/js-api/global-error.js (210335 => 210336)
--- 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)
@@ -185,5 +185,5 @@
bin.trim();
const module = new WebAssembly.Module(bin.get());
- assert.throws(() => new WebAssembly.Instance(module, { imp: { global: imp } }), TypeError, "imported global must be a number (evaluating 'new WebAssembly.Instance(module, { imp: { global: imp } })')");
+ 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 } })')");
}
Modified: branches/safari-603-branch/JSTests/wasm/js-api/table.js (210335 => 210336)
--- 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)
@@ -189,14 +189,14 @@
.Code()
.End();
const module = new WebAssembly.Module(builder.WebAssembly().get());
- assert.throws(() => new WebAssembly.Instance(module, {imp: {table}}), TypeError, message);
+ assert.throws(() => new WebAssembly.Instance(module, {imp: {table}}), WebAssembly.LinkError, message);
}
const badTables = [
- [{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"],
+ [{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}})')"],
];
for (const [d, t, m] of badTables) {
assertBadTableInstance(d, t, m);
@@ -251,7 +251,7 @@
.Code()
.End();
const module = new WebAssembly.Module(builder.WebAssembly().get());
- assert.throws(() => new WebAssembly.Instance(module, {imp: {table}}), TypeError, "Table import is not an instance of WebAssembly.Table");
+ 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}})')");
}
assertBadTable(25);
assertBadTable(new Object);
Modified: branches/safari-603-branch/JSTests/wasm/js-api/test_Data.js (210335 => 210336)
--- 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)
@@ -75,7 +75,7 @@
const bin = builder.WebAssembly().get();
const module = new WebAssembly.Module(bin);
const memory = new WebAssembly.Memory(memoryDescription);
- 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`);
+ 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 } })')`);
assertMemoryAllZero(memory);
})();
@@ -89,7 +89,7 @@
const bin = builder.WebAssembly().get();
const module = new WebAssembly.Module(bin);
const memory = new WebAssembly.Memory(memoryDescription);
- 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`);
+ 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 } })')`);
assertMemoryAllZero(memory);
})();
@@ -103,7 +103,7 @@
const bin = builder.WebAssembly().get();
const module = new WebAssembly.Module(bin);
const memory = new WebAssembly.Memory(memoryDescription);
- 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`);
+ 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 } })')`);
assertMemoryAllZero(memory);
})();
Modified: branches/safari-603-branch/JSTests/wasm/js-api/test_basic_api.js (210335 => 210336)
--- 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)
@@ -24,6 +24,7 @@
"Memory": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
"Table": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
"CompileError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
+ "LinkError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
"RuntimeError": { typeofvalue: "function", writable: true, configurable: true, enumerable: false, length: 1 },
};
@@ -83,6 +84,7 @@
new WebAssembly.Table({initial: 20, maximum: 25, element: "anyfunc"});
break;
case "CompileError":
+ case "LinkError":
case "RuntimeError": {
const e = new WebAssembly[c];
assert.eq(e instanceof WebAssembly[c], true);
@@ -92,7 +94,7 @@
assert.eq(typeof e.stack, "string");
const sillyString = "uh-oh!";
const e2 = new WebAssembly[c](sillyString);
- assert.eq(e2.message, sillyString);
+ // FIXME fix Compile / Runtime errors for this: assert.eq(e2.message, sillyString + " (evaluating 'new WebAssembly[c](sillyString)')");
} break;
default: throw new Error(`Implementation error: unexpected constructor property "${c}"`);
}
Modified: branches/safari-603-branch/JSTests/wasm/js-api/test_memory.js (210335 => 210336)
--- 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)
@@ -318,28 +318,14 @@
const bin = builder.WebAssembly().get();
const module = new WebAssembly.Module(bin);
- 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");
+ 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}) } })')`);
});
test(function() {
@@ -366,11 +352,11 @@
const module = new WebAssembly.Module(bin);
function testMemImportError(instanceObj, expectedError) {
- assert.throws(() => new WebAssembly.Instance(module, instanceObj), TypeError, expectedError);
+ assert.throws(() => new WebAssembly.Instance(module, instanceObj), WebAssembly.LinkError, expectedError);
}
- 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");
+ 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)')");
// This should not throw.
new WebAssembly.Instance(module, {imp: {memory: new WebAssembly.Memory({initial:20})}});
Modified: branches/safari-603-branch/Source/_javascript_Core/CMakeLists.txt (210335 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/CMakeLists.txt 2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/_javascript_Core/CMakeLists.txt 2017-01-05 17:08:40 UTC (rev 210336)
@@ -911,6 +911,7 @@
wasm/js/JSWebAssemblyCallee.cpp
wasm/js/JSWebAssemblyCompileError.cpp
wasm/js/JSWebAssemblyInstance.cpp
+ wasm/js/JSWebAssemblyLinkError.cpp
wasm/js/JSWebAssemblyMemory.cpp
wasm/js/JSWebAssemblyModule.cpp
wasm/js/JSWebAssemblyRuntimeError.cpp
@@ -920,6 +921,8 @@
wasm/js/WebAssemblyFunction.cpp
wasm/js/WebAssemblyInstanceConstructor.cpp
wasm/js/WebAssemblyInstancePrototype.cpp
+ wasm/js/WebAssemblyLinkErrorConstructor.cpp
+ wasm/js/WebAssemblyLinkErrorPrototype.cpp
wasm/js/WebAssemblyMemoryConstructor.cpp
wasm/js/WebAssemblyMemoryPrototype.cpp
wasm/js/WebAssemblyModuleConstructor.cpp
@@ -987,6 +990,8 @@
wasm/js/WebAssemblyCompileErrorPrototype.cpp
wasm/js/WebAssemblyInstanceConstructor.cpp
wasm/js/WebAssemblyInstancePrototype.cpp
+ wasm/js/WebAssemblyLinkErrorConstructor.cpp
+ wasm/js/WebAssemblyLinkErrorPrototype.cpp
wasm/js/WebAssemblyMemoryConstructor.cpp
wasm/js/WebAssemblyMemoryPrototype.cpp
wasm/js/WebAssemblyModuleConstructor.cpp
Modified: branches/safari-603-branch/Source/_javascript_Core/ChangeLog (210335 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/ChangeLog 2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/_javascript_Core/ChangeLog 2017-01-05 17:08:40 UTC (rev 210336)
@@ -1,5 +1,54 @@
2017-01-05 Matthew Hanson <[email protected]>
+ Merge r210028. rdar://problem/29747874
+
+ 2016-12-20 JF Bastien <[email protected]>
+
+ 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
+ * _javascript_Core.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/_javascript_Core/wasm/JSWebAssemblyCompileError.cpp.
+ (JSC::JSWebAssemblyLinkError::create):
+ (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError):
+ (JSC::createWebAssemblyLinkError):
+ * wasm/js/JSWebAssemblyLinkError.h: Copied from Source/_javascript_Core/wasm/JSWebAssemblyCompileError.h.
+ (JSC::JSWebAssemblyLinkError::create):
+ * wasm/js/WebAssemblyInstanceConstructor.cpp: update as per spec change
+ (JSC::constructJSWebAssemblyInstance):
+ * wasm/js/WebAssemblyLinkErrorConstructor.cpp: Copied from Source/_javascript_Core/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/_javascript_Core/wasm/WebAssemblyCompileErrorConstructor.h.
+ * wasm/js/WebAssemblyLinkErrorPrototype.cpp: Copied from Source/_javascript_Core/wasm/WebAssemblyCompileErrorPrototypr.cpp.
+ (JSC::WebAssemblyLinkErrorPrototype::create):
+ (JSC::WebAssemblyLinkErrorPrototype::createStructure):
+ (JSC::WebAssemblyLinkErrorPrototype::finishCreation):
+ (JSC::WebAssemblyLinkErrorPrototype::WebAssemblyLinkErrorPrototype):
+ * wasm/js/WebAssemblyLinkErrorPrototype.h: Copied from Source/_javascript_Core/wasm/WebAssemblyCompileErrorPrototypr.h.
+ * wasm/js/WebAssemblyModuleRecord.cpp: update as per spec change
+ (JSC::dataSegmentFail):
+ (JSC::WebAssemblyModuleRecord::evaluate):
+
+2017-01-05 Matthew Hanson <[email protected]>
+
Merge r209998. rdar://problem/29554366
2016-12-19 Joseph Pecoraro <[email protected]>
Modified: branches/safari-603-branch/Source/_javascript_Core/DerivedSources.make (210335 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/DerivedSources.make 2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/_javascript_Core/DerivedSources.make 2017-01-05 17:08:40 UTC (rev 210336)
@@ -169,6 +169,8 @@
WebAssemblyCompileErrorPrototype.lut.h \
WebAssemblyInstanceConstructor.lut.h \
WebAssemblyInstancePrototype.lut.h \
+ WebAssemblyLinkErrorConstructor.lut.h \
+ WebAssemblyLinkErrorPrototype.lut.h \
WebAssemblyMemoryConstructor.lut.h \
WebAssemblyMemoryPrototype.lut.h \
WebAssemblyModuleConstructor.lut.h \
Modified: branches/safari-603-branch/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (210335 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2017-01-05 17:08:40 UTC (rev 210336)
@@ -2027,6 +2027,12 @@
ADBC54D51DF8EA2B005BF738 /* WebAssemblyToJSCallee.h in Headers */ = {isa = PBXBuildFile; fileRef = ADBC54D31DF8EA00005BF738 /* WebAssemblyToJSCallee.h */; };
ADDB1F6318D77DBE009B58A8 /* OpaqueRootSet.h in Headers */ = {isa = PBXBuildFile; fileRef = ADDB1F6218D77DB7009B58A8 /* OpaqueRootSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
ADE39FFF16DD144B0003CD4A /* PropertyTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1CF06816DCAB2D00B97123 /* PropertyTable.cpp */; };
+ 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 */; };
B59F89391891F29F00D5CCDC /* UnlinkedInstructionStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59F89381891ADB500D5CCDC /* UnlinkedInstructionStream.cpp */; };
BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9050E1839DB000F9297 /* ErrorConstructor.h */; };
BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4502,6 +4508,12 @@
ADBC54D21DF8EA00005BF738 /* WebAssemblyToJSCallee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyToJSCallee.cpp; path = js/WebAssemblyToJSCallee.cpp; sourceTree = "<group>"; };
ADBC54D31DF8EA00005BF738 /* WebAssemblyToJSCallee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyToJSCallee.h; path = js/WebAssemblyToJSCallee.h; sourceTree = "<group>"; };
ADDB1F6218D77DB7009B58A8 /* OpaqueRootSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpaqueRootSet.h; sourceTree = "<group>"; };
+ 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>"; };
B59F89371891AD3300D5CCDC /* UnlinkedInstructionStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkedInstructionStream.h; sourceTree = "<group>"; };
B59F89381891ADB500D5CCDC /* UnlinkedInstructionStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnlinkedInstructionStream.cpp; sourceTree = "<group>"; };
BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ToolExecutable.xcconfig; sourceTree = "<group>"; };
@@ -7597,6 +7609,8 @@
796FB4391DFF8C3F0039C95D /* JSWebAssemblyHelpers.h */,
AD2FCBA81DB58DA400B3E736 /* JSWebAssemblyInstance.cpp */,
AD2FCBA91DB58DA400B3E736 /* JSWebAssemblyInstance.h */,
+ ADE802931E08F1C90058DE78 /* JSWebAssemblyLinkError.cpp */,
+ ADE802941E08F1C90058DE78 /* JSWebAssemblyLinkError.h */,
AD2FCBAA1DB58DA400B3E736 /* JSWebAssemblyMemory.cpp */,
AD2FCBAB1DB58DA400B3E736 /* JSWebAssemblyMemory.h */,
AD2FCB8C1DB5844000B3E736 /* JSWebAssemblyModule.cpp */,
@@ -7615,6 +7629,10 @@
AD2FCBB51DB58DA400B3E736 /* WebAssemblyInstanceConstructor.h */,
AD2FCBB61DB58DA400B3E736 /* WebAssemblyInstancePrototype.cpp */,
AD2FCBB71DB58DA400B3E736 /* WebAssemblyInstancePrototype.h */,
+ ADE8029D1E08F2260058DE78 /* WebAssemblyLinkErrorConstructor.cpp */,
+ ADE802951E08F1C90058DE78 /* WebAssemblyLinkErrorConstructor.h */,
+ ADE802961E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.cpp */,
+ ADE802971E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.h */,
AD2FCBB81DB58DA400B3E736 /* WebAssemblyMemoryConstructor.cpp */,
AD2FCBB91DB58DA400B3E736 /* WebAssemblyMemoryConstructor.h */,
AD2FCBBA1DB58DA400B3E736 /* WebAssemblyMemoryPrototype.cpp */,
@@ -7946,6 +7964,7 @@
FE80C1971D775CDD008510C0 /* CatchScope.h in Headers */,
0F24E54217EA9F5900ABB217 /* CCallHelpers.h in Headers */,
0F070A471D543A8B006E7232 /* CellContainer.h in Headers */,
+ ADE8029A1E08F1DE0058DE78 /* WebAssemblyLinkErrorConstructor.h in Headers */,
0F070A481D543A90006E7232 /* CellContainerInlines.h in Headers */,
0F1C3DDA1BBCE09E00E523E4 /* CellState.h in Headers */,
BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */,
@@ -8422,6 +8441,7 @@
A5339EC61BB399A60054F005 /* InspectorHeapAgent.h in Headers */,
E35E03601B7AB43E0073AD2A /* InspectorInstrumentationObject.h in Headers */,
E33B3E261B7ABD750048DB2E /* InspectorInstrumentationObject.lut.h in Headers */,
+ ADE802991E08F1DE0058DE78 /* JSWebAssemblyLinkError.h in Headers */,
A532438C18568335002ED692 /* InspectorProtocolObjects.h in Headers */,
A55D93AC18514F7900400DED /* InspectorProtocolTypes.h in Headers */,
A50E4B6218809DD50068A46D /* InspectorRuntimeAgent.h in Headers */,
@@ -8714,6 +8734,7 @@
E328C6C71DA4304500D255FD /* MaxFrameExtentForSlowPathCall.h in Headers */,
90213E3E123A40C200D422F3 /* MemoryStatistics.h in Headers */,
0FB5467B14F5C7E1002C2989 /* MethodOfGettingAValueProfile.h in Headers */,
+ ADE8029C1E08F1DE0058DE78 /* WebAssemblyLinkErrorPrototype.h in Headers */,
7C008CE7187631B600955C24 /* Microtask.h in Headers */,
86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */,
C4703CD7192844CC0013FBEA /* models.py in Headers */,
@@ -9811,6 +9832,7 @@
A7D89CFB17A0B8CC00773AD8 /* DFGLivenessAnalysisPhase.cpp in Sources */,
0FF0F19916B729F6005DF95B /* DFGLongLivedState.cpp in Sources */,
A767B5B517A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.cpp in Sources */,
+ ADE8029E1E08F2280058DE78 /* WebAssemblyLinkErrorConstructor.cpp in Sources */,
79F8FC1E1B9FED0F00CA66AB /* DFGMaximalFlushInsertionPhase.cpp in Sources */,
0F5874ED194FEB1200AAB2C1 /* DFGMayExit.cpp in Sources */,
0F1725FF1B48719A00AC3A55 /* DFGMinifiedGraph.cpp in Sources */,
@@ -10098,6 +10120,7 @@
A5C3A1A518C0490200C9593A /* JSGlobalObjectConsoleClient.cpp in Sources */,
A59455921824744700CC3843 /* JSGlobalObjectDebuggable.cpp in Sources */,
A57D23E91891B0770031C7FA /* JSGlobalObjectDebuggerAgent.cpp in Sources */,
+ ADE8029B1E08F1DE0058DE78 /* WebAssemblyLinkErrorPrototype.cpp in Sources */,
14E9D17B107EC469004DDA21 /* JSGlobalObjectFunctions.cpp in Sources */,
A51007C0187CC3C600B38879 /* JSGlobalObjectInspectorController.cpp in Sources */,
A50E4B6318809DD50068A46D /* JSGlobalObjectRuntimeAgent.cpp in Sources */,
@@ -10161,6 +10184,7 @@
79E423E21DEE65320078D355 /* JSWebAssemblyCallee.cpp in Sources */,
AD2FCBE21DB58DAD00B3E736 /* JSWebAssemblyCompileError.cpp in Sources */,
AD2FCBE41DB58DAD00B3E736 /* JSWebAssemblyInstance.cpp in Sources */,
+ ADE802981E08F1DE0058DE78 /* JSWebAssemblyLinkError.cpp in Sources */,
AD2FCBE61DB58DAD00B3E736 /* JSWebAssemblyMemory.cpp in Sources */,
AD2FCC041DB58DAD00B3E736 /* JSWebAssemblyModule.cpp in Sources */,
AD2FCBE81DB58DAD00B3E736 /* JSWebAssemblyRuntimeError.cpp in Sources */,
Modified: branches/safari-603-branch/Source/_javascript_Core/builtins/BuiltinNames.h (210335 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/builtins/BuiltinNames.h 2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/_javascript_Core/builtins/BuiltinNames.h 2017-01-05 17:08:40 UTC (rev 210336)
@@ -166,6 +166,7 @@
macro(Memory) \
macro(Table) \
macro(CompileError) \
+ macro(LinkError) \
macro(RuntimeError) \
Modified: branches/safari-603-branch/Source/_javascript_Core/runtime/JSGlobalObject.h (210335 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/runtime/JSGlobalObject.h 2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/_javascript_Core/runtime/JSGlobalObject.h 2017-01-05 17:08:40 UTC (rev 210336)
@@ -140,6 +140,7 @@
#define FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(macro) \
macro(WebAssemblyCompileError, webAssemblyCompileError, WebAssemblyCompileError, WebAssemblyCompileError, CompileError, error) \
macro(WebAssemblyInstance, webAssemblyInstance, WebAssemblyInstance, WebAssemblyInstance, Instance, object) \
+ macro(WebAssemblyLinkError, webAssemblyLinkError, WebAssemblyLinkError, WebAssemblyLinkError, LinkError, error) \
macro(WebAssemblyMemory, webAssemblyMemory, WebAssemblyMemory, WebAssemblyMemory, Memory, object) \
macro(WebAssemblyModule, webAssemblyModule, WebAssemblyModule, WebAssemblyModule, Module, object) \
macro(WebAssemblyRuntimeError, webAssemblyRuntimeError, WebAssemblyRuntimeError, WebAssemblyRuntimeError, RuntimeError, error) \
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/JSWebAssembly.h (210335 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/JSWebAssembly.h 2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/JSWebAssembly.h 2017-01-05 17:08:40 UTC (rev 210336)
@@ -31,6 +31,7 @@
#include "js/JSWebAssemblyCallee.h"
#include "js/JSWebAssemblyCompileError.h"
#include "js/JSWebAssemblyInstance.h"
+#include "js/JSWebAssemblyLinkError.h"
#include "js/JSWebAssemblyMemory.h"
#include "js/JSWebAssemblyModule.h"
#include "js/JSWebAssemblyRuntimeError.h"
@@ -40,6 +41,8 @@
#include "js/WebAssemblyFunction.h"
#include "js/WebAssemblyInstanceConstructor.h"
#include "js/WebAssemblyInstancePrototype.h"
+#include "js/WebAssemblyLinkErrorConstructor.h"
+#include "js/WebAssemblyLinkErrorPrototype.h"
#include "js/WebAssemblyMemoryConstructor.h"
#include "js/WebAssemblyMemoryPrototype.h"
#include "js/WebAssemblyModuleConstructor.h"
Copied: branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.cpp (from rev 210335, branches/safari-603-branch/Source/_javascript_Core/wasm/JSWebAssembly.h) (0 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.cpp (rev 0)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.cpp 2017-01-05 17:08:40 UTC (rev 210336)
@@ -0,0 +1,60 @@
+/*
+ * 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)
Copied: branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.h (from rev 210335, branches/safari-603-branch/Source/_javascript_Core/wasm/JSWebAssembly.h) (0 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.h (rev 0)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.h 2017-01-05 17:08:40 UTC (rev 210336)
@@ -0,0 +1,54 @@
+/*
+ * 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)
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp (210335 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp 2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp 2017-01-05 17:08:40 UTC (rev 210336)
@@ -33,6 +33,7 @@
#include "JSModuleEnvironment.h"
#include "JSModuleNamespaceObject.h"
#include "JSWebAssemblyInstance.h"
+#include "JSWebAssemblyLinkError.h"
#include "JSWebAssemblyMemory.h"
#include "JSWebAssemblyModule.h"
#include "WebAssemblyFunction.h"
@@ -108,9 +109,9 @@
switch (import.kind) {
case Wasm::ExternalKind::Function: {
// 4. If i is a function import:
- // i. If IsCallable(v) is false, throw a TypeError.
+ // i. If IsCallable(v) is false, throw a WebAssembly.LinkError.
if (!value.isFunction())
- return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("import function must be callable"), defaultSourceAppender, runtimeTypeForValue(value))));
+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("import function must be callable"))));
JSCell* cell = value.asCell();
// ii. If v is an Exported Function Exotic Object:
if (WebAssemblyFunction* importedExports = jsDynamicCast<WebAssemblyFunction*>(object)) {
@@ -134,24 +135,24 @@
// 7. Otherwise (i is a table import):
hasTableImport = true;
JSWebAssemblyTable* table = jsDynamicCast<JSWebAssemblyTable*>(value);
- // i. If v is not a WebAssembly.Table object, throw a TypeError.
+ // i. If v is not a WebAssembly.Table object, throw a WebAssembly.LinkError.
if (!table)
- return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("Table import is not an instance of WebAssembly.Table"))));
+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Table import is not an instance of WebAssembly.Table"))));
uint32_t expectedInitial = moduleInformation.tableInformation.initial();
uint32_t actualInitial = table->size();
if (actualInitial < expectedInitial)
- return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("Table import provided an 'initial' that is too small"))));
+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Table import provided an 'initial' that is too small"))));
if (std::optional<uint32_t> expectedMaximum = moduleInformation.tableInformation.maximum()) {
std::optional<uint32_t> actualMaximum = table->maximum();
if (!actualMaximum) {
return JSValue::encode(
- throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("Table import does not have a 'maximum' but the module requires that it does"))));
+ throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Table import does not have a 'maximum' but the module requires that it does"))));
}
if (*actualMaximum > *expectedMaximum) {
return JSValue::encode(
- throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("Imported Table's 'maximum' is larger than the module's expected 'maximum'"))));
+ throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Imported Table's 'maximum' is larger than the module's expected 'maximum'"))));
}
}
@@ -166,25 +167,25 @@
RELEASE_ASSERT(moduleInformation.memory);
hasMemoryImport = true;
JSWebAssemblyMemory* memory = jsDynamicCast<JSWebAssemblyMemory*>(value);
- // i. If v is not a WebAssembly.Memory object, throw a TypeError.
+ // i. If v is not a WebAssembly.Memory object, throw a WebAssembly.LinkError.
if (!memory)
- return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("Memory import is not an instance of WebAssembly.Memory"))));
+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Memory import is not an instance of WebAssembly.Memory"))));
Wasm::PageCount expectedInitial = moduleInformation.memory.initial();
Wasm::PageCount actualInitial = memory->memory()->initial();
if (actualInitial < expectedInitial)
- return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("Memory import provided an 'initial' that is too small"))));
+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Memory import provided an 'initial' that is too small"))));
if (Wasm::PageCount expectedMaximum = moduleInformation.memory.maximum()) {
Wasm::PageCount actualMaximum = memory->memory()->maximum();
if (!actualMaximum) {
return JSValue::encode(
- throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("Memory import did not have a 'maximum' but the module requires that it does"))));
+ throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Memory import did not have a 'maximum' but the module requires that it does"))));
}
if (actualMaximum > expectedMaximum) {
return JSValue::encode(
- throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("Memory imports 'maximum' is larger than the module's expected 'maximum"))));
+ throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("Memory imports 'maximum' is larger than the module's expected 'maximum'"))));
}
}
// ii. Append v to memories.
@@ -198,7 +199,7 @@
ASSERT(moduleInformation.globals[import.kindIndex].mutability == Wasm::Global::Immutable);
// ii. If Type(v) is not Number, throw a TypeError.
if (!value.isNumber())
- return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, ASCIILiteral("imported global must be a number"), defaultSourceAppender, runtimeTypeForValue(value))));
+ return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("imported global must be a number"))));
// iii. Append ToWebAssemblyValue(v) to imports.
switch (moduleInformation.globals[import.kindIndex].type) {
case Wasm::I32:
Added: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorConstructor.cpp (0 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorConstructor.cpp (rev 0)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorConstructor.cpp 2017-01-05 17:08:40 UTC (rev 210336)
@@ -0,0 +1,102 @@
+/*
+ * 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)
Copied: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorConstructor.h (from rev 210335, branches/safari-603-branch/Source/_javascript_Core/wasm/JSWebAssembly.h) (0 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorConstructor.h (rev 0)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorConstructor.h 2017-01-05 17:08:40 UTC (rev 210336)
@@ -0,0 +1,58 @@
+/*
+ * 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)
Copied: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorPrototype.cpp (from rev 210335, branches/safari-603-branch/Source/_javascript_Core/wasm/JSWebAssembly.h) (0 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorPrototype.cpp (rev 0)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorPrototype.cpp 2017-01-05 17:08:40 UTC (rev 210336)
@@ -0,0 +1,69 @@
+/*
+ * 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)
Copied: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorPrototype.h (from rev 210335, branches/safari-603-branch/Source/_javascript_Core/wasm/JSWebAssembly.h) (0 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorPrototype.h (rev 0)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorPrototype.h 2017-01-05 17:08:40 UTC (rev 210336)
@@ -0,0 +1,54 @@
+/*
+ * 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)
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp (210335 => 210336)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2017-01-05 17:08:32 UTC (rev 210335)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2017-01-05 17:08:40 UTC (rev 210336)
@@ -33,6 +33,7 @@
#include "JSLexicalEnvironment.h"
#include "JSModuleEnvironment.h"
#include "JSWebAssemblyInstance.h"
+#include "JSWebAssemblyLinkError.h"
#include "JSWebAssemblyModule.h"
#include "ProtoCallFrame.h"
#include "WasmFormat.h"
@@ -195,9 +196,9 @@
}
template <typename Scope, typename N, typename ...Args>
-NEVER_INLINE static JSValue dataSegmentFail(ExecState* state, Scope& scope, N memorySize, N segmentSize, N offset, Args... args)
+NEVER_INLINE static JSValue dataSegmentFail(ExecState* state, VM* vm, Scope& scope, N memorySize, N segmentSize, N offset, Args... args)
{
- 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...)));
+ 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...)));
}
JSValue WebAssemblyModuleRecord::evaluate(ExecState* state)
@@ -221,7 +222,7 @@
uint32_t tableIndex = element.offset;
uint64_t lastWrittenIndex = static_cast<uint64_t>(tableIndex) + static_cast<uint64_t>(element.functionIndices.size()) - 1;
if (lastWrittenIndex >= table->size())
- return JSValue::decode(throwVMRangeError(state, scope, ASCIILiteral("Element is trying to set an out of bounds table index")));
+ return throwException(state, scope, createJSWebAssemblyLinkError(state, &vm, ASCIILiteral("Element is trying to set an out of bounds table index")));
for (uint32_t i = 0; i < element.functionIndices.size(); ++i) {
// FIXME: This essentially means we're exporting an import.
@@ -261,9 +262,9 @@
for (auto& segment : data) {
if (segment->sizeInBytes) {
if (UNLIKELY(sizeInBytes < segment->sizeInBytes))
- return dataSegmentFail(state, scope, sizeInBytes, segment->sizeInBytes, segment->offset, ASCIILiteral(", segment is too big"));
+ return dataSegmentFail(state, &vm, scope, sizeInBytes, segment->sizeInBytes, segment->offset, ASCIILiteral(", segment is too big"));
if (UNLIKELY(segment->offset > sizeInBytes - segment->sizeInBytes))
- return dataSegmentFail(state, scope, sizeInBytes, segment->sizeInBytes, segment->offset, ASCIILiteral(", segment writes outside of memory"));
+ return dataSegmentFail(state, &vm, scope, sizeInBytes, segment->sizeInBytes, segment->offset, ASCIILiteral(", segment writes outside of memory"));
memcpy(memory + segment->offset, &segment->byte(0), segment->sizeInBytes);
}
}