WebAssembly JS API: cleanup & pass VM around to {Compile/Runtime}Error
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Dec 2016 20:34:04 +0000 (20:34 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Dec 2016 20:34:04 +0000 (20:34 +0000)
commit9d13bb7dac44ee07c39037a9e81bd2731d8afa37
tree4507da60f7570ba48707d25b86a36e225ab9908c
parenteab6a62fbc5d14da8c182875312fa755854f13bb
WebAssembly JS API: cleanup & pass VM around to {Compile/Runtime}Error
https://bugs.webkit.org/show_bug.cgi?id=166295
<rdar://problem/29762017>

Reviewed by Mark Lam.

JSTests:

Update tests to generate new error messages. Adapt some to use the
assert.js module.

* wasm/assert.js: allow filtering out sometimes-useless source
location information. Return the exception so that further
processing can occur on it as desired.
* wasm/function-tests/exceptions.js:
* wasm/function-tests/trap-load-2.js:
(assert): Deleted.
(i.catch): Deleted.
* wasm/function-tests/trap-load.js:
(assert): Deleted.
(i.catch): Deleted.
* wasm/function-tests/trap-store-2.js:
(import.Builder.from.string_appeared_here.assert): Deleted.
(i.catch): Deleted.
* wasm/function-tests/trap-store.js:
(import.Builder.from.string_appeared_here.assert): Deleted.
(i.catch): Deleted.

Source/JavaScriptCore:

Rename the create* functions, and pass VM around, as suggested for
LinkError in #165805.

At the same time, use the default source appender when
constructing these error types, which gives a nice map back to the
original source as part of the error message. This is clearer when
using the current frame, so add that as well.

* jit/ThunkGenerators.cpp:
(JSC::throwExceptionFromWasmThunkGenerator):
* wasm/js/JSWebAssemblyCompileError.cpp:
(JSC::JSWebAssemblyCompileError::create):
(JSC::createJSWebAssemblyCompileError):
(JSC::createWebAssemblyCompileError): Deleted.
* wasm/js/JSWebAssemblyCompileError.h:
(JSC::JSWebAssemblyCompileError::create):
* wasm/js/JSWebAssemblyRuntimeError.cpp:
(JSC::JSWebAssemblyRuntimeError::create):
* wasm/js/JSWebAssemblyRuntimeError.h:
(JSC::JSWebAssemblyRuntimeError::create):
* wasm/js/WebAssemblyCompileErrorConstructor.cpp:
(JSC::constructJSWebAssemblyCompileError):
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::WebAssemblyModuleConstructor::createModule):
* wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
(JSC::constructJSWebAssemblyRuntimeError):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@210073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
JSTests/ChangeLog
JSTests/wasm/assert.js
JSTests/wasm/function-tests/exceptions.js
JSTests/wasm/function-tests/trap-load-2.js
JSTests/wasm/function-tests/trap-load.js
JSTests/wasm/function-tests/trap-store-2.js
JSTests/wasm/function-tests/trap-store.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/jit/ThunkGenerators.cpp
Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.cpp
Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.h
Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp
Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.h
Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.cpp
Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h
Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp