Diff
Modified: branches/safari-603-branch/JSTests/ChangeLog (210417 => 210418)
--- branches/safari-603-branch/JSTests/ChangeLog 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/JSTests/ChangeLog 2017-01-06 01:49:05 UTC (rev 210418)
@@ -1,5 +1,37 @@
2017-01-05 Matthew Hanson <[email protected]>
+ Merge r210073. rdar://problem/29762017
+
+ 2016-12-21 JF Bastien <[email protected]>
+
+ WebAssembly JS API: cleanup & pass VM around to {Compile/Runtime}Error
+ https://bugs.webkit.org/show_bug.cgi?id=166295
+ <rdar://problem/29762017>
+
+ Reviewed by Mark Lam.
+
+ Update tests to generate new error messages. Adapt some to use the
+ assert.js module.
+
+ * wasm/assert.js: allow filtering out sometimes-useless source
+ location information. Return the exception so that further
+ processing can occur on it as desired.
+ * wasm/function-tests/exceptions.js:
+ * wasm/function-tests/trap-load-2.js:
+ (assert): Deleted.
+ (i.catch): Deleted.
+ * wasm/function-tests/trap-load.js:
+ (assert): Deleted.
+ (i.catch): Deleted.
+ * wasm/function-tests/trap-store-2.js:
+ (import.Builder.from.string_appeared_here.assert): Deleted.
+ (i.catch): Deleted.
+ * wasm/function-tests/trap-store.js:
+ (import.Builder.from.string_appeared_here.assert): Deleted.
+ (i.catch): Deleted.
+
+2017-01-05 Matthew Hanson <[email protected]>
+
Merge r210244. rdar://problem/29844107
2017-01-03 JF Bastien <[email protected]>
Modified: branches/safari-603-branch/JSTests/wasm/assert.js (210417 => 210418)
--- branches/safari-603-branch/JSTests/wasm/assert.js 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/JSTests/wasm/assert.js 2017-01-06 01:49:05 UTC (rev 210418)
@@ -111,12 +111,20 @@
_fail(`Expected: "${lhs}" > "${rhs}"`, msg);
};
+// Ignore source information at the end of the error message if the expected message didn't specify that information. Sometimes it changes, or it's tricky to get just right.
+const _sourceRe = new RegExp(/ \(evaluating '.*'\)/);
+
const _throws = (func, type, message, ...args) => {
try {
func(...args);
} catch (e) {
- if (e instanceof type && e.message === message)
- return;
+ if (e instanceof type) {
+ if (e.message === message)
+ return e;
+ const cleanMessage = e.message.replace(_sourceRe, '');
+ if (cleanMessage === message)
+ return e;
+ }
_fail(`Expected to throw a ${type.name} with message "${message}", got ${e.name} with message "${e.message}"`);
}
_fail(`Expected to throw a ${type.name} with message "${message}"`);
Modified: branches/safari-603-branch/JSTests/wasm/function-tests/exceptions.js (210417 => 210418)
--- branches/safari-603-branch/JSTests/wasm/function-tests/exceptions.js 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/JSTests/wasm/function-tests/exceptions.js 2017-01-06 01:49:05 UTC (rev 210418)
@@ -45,7 +45,7 @@
assert.eq(table.get(0), null);
for (let i = 0; i < 1000; i++) {
- assert.throws(() => foo(0, i), WebAssembly.RuntimeError, "call_indirect to a null table entry");
+ assert.throws(() => foo(0, i), WebAssembly.RuntimeError, "call_indirect to a null table entry (evaluating 'func(...args)')");
}
table.set(0, foo);
@@ -52,11 +52,11 @@
assert.eq(table.get(0), foo);
for (let i = 0; i < 1000; i++) {
- assert.throws(() => foo(1 + i, i), WebAssembly.RuntimeError, "Out of bounds call_indirect");
+ assert.throws(() => foo(1 + i, i), WebAssembly.RuntimeError, "Out of bounds call_indirect (evaluating 'func(...args)')");
}
for (let i = 0; i < 1000; i++) {
- assert.throws(() => foo(0, i), WebAssembly.RuntimeError, "call_indirect to a signature that does not match");
+ assert.throws(() => foo(0, i), WebAssembly.RuntimeError, "call_indirect to a signature that does not match (evaluating 'func(...args)')");
}
table.set(0, bar);
Modified: branches/safari-603-branch/JSTests/wasm/function-tests/trap-load.js (210417 => 210418)
--- branches/safari-603-branch/JSTests/wasm/function-tests/trap-load.js 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/JSTests/wasm/function-tests/trap-load.js 2017-01-06 01:49:05 UTC (rev 210418)
@@ -1,4 +1,5 @@
import Builder from '../Builder.js'
+import * as assert from '../assert.js'
const pageSize = 64 * 1024;
const numPages = 10;
@@ -22,11 +23,6 @@
const module = new WebAssembly.Module(bin);
const foo = new WebAssembly.Instance(module, {a: {b: new WebAssembly.Memory({initial: numPages})}}).exports.foo;
-function assert(b) {
- if (!b)
- throw new Error("Bad")
-}
-
function wasmFrameCountFromError(e) {
let stackFrames = e.stack.split("\n").filter((s) => s.indexOf("<wasm>@[wasm code]") !== -1);
return stackFrames.length;
@@ -33,16 +29,8 @@
}
for (let i = 0; i < 1000; i++) {
- let threw = false;
- try {
- foo(numPages * pageSize + 1);
- } catch(e) {
- assert(e instanceof WebAssembly.RuntimeError);
- assert(e.message === "Out of bounds memory access");
- threw = true;
- assert(wasmFrameCountFromError(e) === 2);
- }
- assert(threw);
+ const e = assert.throws(() => foo(numPages * pageSize + 1), WebAssembly.RuntimeError, "Out of bounds memory access (evaluating 'func(...args)')");
+ assert.eq(wasmFrameCountFromError(e), 2);
}
{
Modified: branches/safari-603-branch/JSTests/wasm/function-tests/trap-store.js (210417 => 210418)
--- branches/safari-603-branch/JSTests/wasm/function-tests/trap-store.js 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/JSTests/wasm/function-tests/trap-store.js 2017-01-06 01:49:05 UTC (rev 210418)
@@ -1,10 +1,6 @@
import Builder from '../Builder.js'
+import * as assert from '../assert.js'
-function assert(b) {
- if (!b)
- throw new Error("Bad")
-}
-
const pageSize = 64 * 1024;
const numPages = 10;
@@ -28,17 +24,8 @@
const module = new WebAssembly.Module(bin);
const foo = new WebAssembly.Instance(module, {a: {b: new WebAssembly.Memory({initial: numPages})}}).exports.foo;
- for (let i = 0; i < 10000; i++) {
- let threw = false;
- try {
- foo(i, numPages * pageSize + 1);
- } catch(e) {
- assert(e instanceof WebAssembly.RuntimeError);
- assert(e.message === "Out of bounds memory access");
- threw = true;
- }
- assert(threw);
- }
+ for (let i = 0; i < 10000; i++)
+ assert.throws(() => foo(i, numPages * pageSize + 1), WebAssembly.RuntimeError, "Out of bounds memory access (evaluating 'func(...args)')");
}
Modified: branches/safari-603-branch/Source/_javascript_Core/ChangeLog (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/ChangeLog 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/ChangeLog 2017-01-06 01:49:05 UTC (rev 210418)
@@ -1,5 +1,44 @@
2017-01-05 Matthew Hanson <[email protected]>
+ Merge r210073. rdar://problem/29762017
+
+ 2016-12-21 JF Bastien <[email protected]>
+
+ WebAssembly JS API: cleanup & pass VM around to {Compile/Runtime}Error
+ https://bugs.webkit.org/show_bug.cgi?id=166295
+ <rdar://problem/29762017>
+
+ Reviewed by Mark Lam.
+
+ Rename the create* functions, and pass VM around, as suggested for
+ LinkError in #165805.
+
+ At the same time, use the default source appender when
+ constructing these error types, which gives a nice map back to the
+ original source as part of the error message. This is clearer when
+ using the current frame, so add that as well.
+
+ * jit/ThunkGenerators.cpp:
+ (JSC::throwExceptionFromWasmThunkGenerator):
+ * wasm/js/JSWebAssemblyCompileError.cpp:
+ (JSC::JSWebAssemblyCompileError::create):
+ (JSC::createJSWebAssemblyCompileError):
+ (JSC::createWebAssemblyCompileError): Deleted.
+ * wasm/js/JSWebAssemblyCompileError.h:
+ (JSC::JSWebAssemblyCompileError::create):
+ * wasm/js/JSWebAssemblyRuntimeError.cpp:
+ (JSC::JSWebAssemblyRuntimeError::create):
+ * wasm/js/JSWebAssemblyRuntimeError.h:
+ (JSC::JSWebAssemblyRuntimeError::create):
+ * wasm/js/WebAssemblyCompileErrorConstructor.cpp:
+ (JSC::constructJSWebAssemblyCompileError):
+ * wasm/js/WebAssemblyModuleConstructor.cpp:
+ (JSC::WebAssemblyModuleConstructor::createModule):
+ * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
+ (JSC::constructJSWebAssemblyRuntimeError):
+
+2017-01-05 Matthew Hanson <[email protected]>
+
Merge r210244. rdar://problem/29844107
2017-01-03 JF Bastien <[email protected]>
Modified: branches/safari-603-branch/Source/_javascript_Core/jit/ThunkGenerators.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/jit/ThunkGenerators.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/jit/ThunkGenerators.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -1155,8 +1155,7 @@
auto throwScope = DECLARE_THROW_SCOPE(*vm);
JSGlobalObject* globalObject = vm->topJSWebAssemblyInstance->globalObject();
- JSWebAssemblyRuntimeError* error = JSWebAssemblyRuntimeError::create(
- exec, globalObject->WebAssemblyRuntimeErrorStructure(), Wasm::errorMessageForExceptionType(type));
+ JSWebAssemblyRuntimeError* error = JSWebAssemblyRuntimeError::create(exec, *vm, globalObject->WebAssemblyRuntimeErrorStructure(), Wasm::errorMessageForExceptionType(type));
throwException(exec, throwScope, error);
}
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -32,10 +32,11 @@
namespace JSC {
-JSWebAssemblyCompileError* JSWebAssemblyCompileError::create(ExecState* state, Structure* structure, const String& message, bool useCurrentFrame)
+JSWebAssemblyCompileError* JSWebAssemblyCompileError::create(ExecState* state, VM& vm, Structure* structure, const String& message)
{
- auto& vm = state->vm();
auto* instance = new (NotNull, allocateCell<JSWebAssemblyCompileError>(vm.heap)) JSWebAssemblyCompileError(vm, structure);
+ instance->m_sourceAppender = defaultSourceAppender;
+ bool useCurrentFrame = true;
instance->finishCreation(state, vm, message, useCurrentFrame);
return instance;
}
@@ -48,11 +49,11 @@
const ClassInfo JSWebAssemblyCompileError::s_info = { "WebAssembly.CompileError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyCompileError) };
-JSObject* createWebAssemblyCompileError(ExecState* exec, const String& message)
+JSObject* createJSWebAssemblyCompileError(ExecState* state, VM& vm, const String& message)
{
ASSERT(!message.isEmpty());
- JSGlobalObject* globalObject = exec->lexicalGlobalObject();
- return ErrorInstance::create(exec, globalObject->vm(), globalObject->WebAssemblyCompileErrorStructure(), message, defaultSourceAppender, TypeNothing, true);
+ JSGlobalObject* globalObject = state->lexicalGlobalObject();
+ return JSWebAssemblyCompileError::create(state, vm, globalObject->WebAssemblyCompileErrorStructure(), message);
}
} // namespace JSC
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.h (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.h 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.h 2017-01-06 01:49:05 UTC (rev 210418)
@@ -35,10 +35,10 @@
public:
typedef ErrorInstance Base;
- static JSWebAssemblyCompileError* create(ExecState*, Structure*, const String&, bool);
- static JSWebAssemblyCompileError* create(ExecState* exec, Structure* structure, JSValue message, bool useCurrentFrame)
+ static JSWebAssemblyCompileError* create(ExecState*, VM&, Structure*, const String&);
+ static JSWebAssemblyCompileError* create(ExecState* state, VM& vm, Structure* structure, JSValue message)
{
- return create(exec, structure, message.isUndefined() ? String() : message.toWTFString(exec), useCurrentFrame);
+ return create(state, vm, structure, message.isUndefined() ? String() : message.toWTFString(state));
}
DECLARE_INFO;
@@ -47,7 +47,7 @@
JSWebAssemblyCompileError(VM&, Structure*);
};
-JSObject* createWebAssemblyCompileError(ExecState*, const String&);
+JSObject* createJSWebAssemblyCompileError(ExecState*, VM&, const String&);
} // namespace JSC
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -32,11 +32,12 @@
namespace JSC {
-JSWebAssemblyLinkError* JSWebAssemblyLinkError::create(ExecState* state, VM* vm, Structure* structure, const String& message)
+JSWebAssemblyLinkError* JSWebAssemblyLinkError::create(ExecState* state, VM& vm, Structure* structure, const String& message)
{
- auto* instance = new (NotNull, allocateCell<JSWebAssemblyLinkError>(vm->heap)) JSWebAssemblyLinkError(*vm, structure);
+ auto* instance = new (NotNull, allocateCell<JSWebAssemblyLinkError>(vm.heap)) JSWebAssemblyLinkError(vm, structure);
instance->m_sourceAppender = defaultSourceAppender;
- instance->finishCreation(state, *vm, message, true);
+ bool useCurrentFrame = true;
+ instance->finishCreation(state, vm, message, useCurrentFrame);
return instance;
}
@@ -48,7 +49,7 @@
const ClassInfo JSWebAssemblyLinkError::s_info = { "WebAssembly.LinkError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyLinkError) };
-JSObject* createJSWebAssemblyLinkError(ExecState* state, VM* vm, const String& message)
+JSObject* createJSWebAssemblyLinkError(ExecState* state, VM& vm, const String& message)
{
ASSERT(!message.isEmpty());
JSGlobalObject* globalObject = state->lexicalGlobalObject();
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.h (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.h 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.h 2017-01-06 01:49:05 UTC (rev 210418)
@@ -35,8 +35,8 @@
public:
typedef ErrorInstance Base;
- static JSWebAssemblyLinkError* create(ExecState*, VM*, Structure*, const String&);
- static JSWebAssemblyLinkError* create(ExecState* state, VM* vm, Structure* structure, JSValue message)
+ 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));
}
@@ -47,7 +47,7 @@
JSWebAssemblyLinkError(VM&, Structure*);
};
-JSObject* createJSWebAssemblyLinkError(ExecState*, VM*, const String&);
+JSObject* createJSWebAssemblyLinkError(ExecState*, VM&, const String&);
} // namespace JSC
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -32,10 +32,11 @@
namespace JSC {
-JSWebAssemblyRuntimeError* JSWebAssemblyRuntimeError::create(ExecState* state, Structure* structure, const String& message, bool useCurrentFrame)
+JSWebAssemblyRuntimeError* JSWebAssemblyRuntimeError::create(ExecState* state, VM& vm, Structure* structure, const String& message)
{
- auto& vm = state->vm();
auto* instance = new (NotNull, allocateCell<JSWebAssemblyRuntimeError>(vm.heap)) JSWebAssemblyRuntimeError(vm, structure);
+ instance->m_sourceAppender = defaultSourceAppender;
+ bool useCurrentFrame = true;
instance->finishCreation(state, vm, message, useCurrentFrame);
return instance;
}
@@ -47,6 +48,7 @@
const ClassInfo JSWebAssemblyRuntimeError::s_info = { "WebAssembly.RuntimeError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyRuntimeError) };
+
} // namespace JSC
#endif // ENABLE(WEBASSEMBLY)
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.h (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.h 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.h 2017-01-06 01:49:05 UTC (rev 210418)
@@ -35,10 +35,10 @@
public:
typedef ErrorInstance Base;
- static JSWebAssemblyRuntimeError* create(ExecState*, Structure*, const String&, bool useCurrentFrame = true);
- static JSWebAssemblyRuntimeError* create(ExecState* exec, Structure* structure, JSValue message, bool useCurrentFrame)
+ static JSWebAssemblyRuntimeError* create(ExecState*, VM&, Structure*, const String&);
+ static JSWebAssemblyRuntimeError* create(ExecState* state, VM& vm, Structure* structure, JSValue message)
{
- return create(exec, structure, message.isUndefined() ? String() : message.toWTFString(exec), useCurrentFrame);
+ return create(state, vm, structure, message.isUndefined() ? String() : message.toWTFString(state));
}
DECLARE_INFO;
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorConstructor.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorConstructor.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyCompileErrorConstructor.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -51,7 +51,7 @@
JSValue message = state->argument(0);
auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->jsCallee())->globalObject()->WebAssemblyCompileErrorStructure());
RETURN_IF_EXCEPTION(scope, encodedJSValue());
- return JSValue::encode(JSWebAssemblyCompileError::create(state, structure, message, false));
+ return JSValue::encode(JSWebAssemblyCompileError::create(state, vm, structure, message));
}
static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyCompileError(ExecState* state)
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -111,7 +111,7 @@
// 4. If i is a function import:
// i. If IsCallable(v) is false, throw a WebAssembly.LinkError.
if (!value.isFunction())
- return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("import function must be callable"))));
+ 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)) {
@@ -137,22 +137,22 @@
JSWebAssemblyTable* table = jsDynamicCast<JSWebAssemblyTable*>(value);
// i. If v is not a WebAssembly.Table object, throw a WebAssembly.LinkError.
if (!table)
- return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, 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, createJSWebAssemblyLinkError(exec, &vm, 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, createJSWebAssemblyLinkError(exec, &vm, 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, createJSWebAssemblyLinkError(exec, &vm, 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'"))));
}
}
@@ -169,23 +169,23 @@
JSWebAssemblyMemory* memory = jsDynamicCast<JSWebAssemblyMemory*>(value);
// i. If v is not a WebAssembly.Memory object, throw a WebAssembly.LinkError.
if (!memory)
- return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, &vm, 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, createJSWebAssemblyLinkError(exec, &vm, 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, createJSWebAssemblyLinkError(exec, &vm, 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, createJSWebAssemblyLinkError(exec, &vm, 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.
@@ -199,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, createJSWebAssemblyLinkError(exec, &vm, ASCIILiteral("imported global must be a number"))));
+ 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:
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorConstructor.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorConstructor.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyLinkErrorConstructor.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -51,7 +51,7 @@
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));
+ return JSValue::encode(JSWebAssemblyLinkError::create(state, vm, structure, message));
}
static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyLinkError(ExecState* state)
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -84,7 +84,7 @@
// On failure, a new WebAssembly.CompileError is thrown.
plan.run();
if (plan.failed())
- return throwException(state, scope, createWebAssemblyCompileError(state, plan.errorMessage()));
+ return throwException(state, scope, createJSWebAssemblyCompileError(state, vm, plan.errorMessage()));
// On success, a new WebAssembly.Module object is returned with [[Module]] set to the validated Ast.module.
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -197,7 +197,7 @@
}
template <typename Scope, typename N, typename ...Args>
-NEVER_INLINE static JSValue dataSegmentFail(ExecState* state, VM* vm, 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, 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...)));
}
@@ -223,7 +223,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 throwException(state, scope, createJSWebAssemblyLinkError(state, &vm, 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.
@@ -264,9 +264,9 @@
for (auto& segment : data) {
if (segment->sizeInBytes) {
if (UNLIKELY(sizeInBytes < segment->sizeInBytes))
- return dataSegmentFail(state, &vm, 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, &vm, 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);
}
}
Modified: branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp (210417 => 210418)
--- branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp 2017-01-06 01:48:58 UTC (rev 210417)
+++ branches/safari-603-branch/Source/_javascript_Core/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp 2017-01-06 01:49:05 UTC (rev 210418)
@@ -51,7 +51,7 @@
JSValue message = state->argument(0);
auto* structure = InternalFunction::createSubclassStructure(state, state->newTarget(), asInternalFunction(state->jsCallee())->globalObject()->WebAssemblyRuntimeErrorStructure());
RETURN_IF_EXCEPTION(scope, encodedJSValue());
- return JSValue::encode(JSWebAssemblyRuntimeError::create(state, structure, message, false));
+ return JSValue::encode(JSWebAssemblyRuntimeError::create(state, vm, structure, message));
}
static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyRuntimeError(ExecState* state)