WebAssembly: Implement the WebAssembly.instantiate API
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Mar 2017 07:38:41 +0000 (07:38 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Mar 2017 07:38:41 +0000 (07:38 +0000)
commitc0e05b944ae183c7ad04bcee594b0cafa96db721
tree086851bcd31d91242c7acabfcfea6a28770fa09b
parent2ce1df9124ac0cf43848e09c73f09b839275033c
WebAssembly: Implement the WebAssembly.instantiate API
https://bugs.webkit.org/show_bug.cgi?id=165982
<rdar://problem/29760110>

Reviewed by Keith Miller.

JSTests:

* wasm/js-api/web-assembly-instantiate.js: Added.
(assert.eq.async.test):
(assert.eq):
(assert.truthy.async.test):
(assert.truthy):

Source/JavaScriptCore:

This patch is a straight forward implementation of the WebAssembly.instantiate
API: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblyinstantiate

I implemented the API in a synchronous manner. We should make it
asynchronous: https://bugs.webkit.org/show_bug.cgi?id=169187

* wasm/JSWebAssembly.cpp:
(JSC::webAssemblyCompileFunc):
(JSC::webAssemblyInstantiateFunc):
(JSC::JSWebAssembly::finishCreation):
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::constructJSWebAssemblyInstance):
(JSC::WebAssemblyInstanceConstructor::createInstance):
* wasm/js/WebAssemblyInstanceConstructor.h:
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::constructJSWebAssemblyModule):
(JSC::WebAssemblyModuleConstructor::createModule):
* wasm/js/WebAssemblyModuleConstructor.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@213506 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/wasm/js-api/web-assembly-instantiate.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wasm/JSWebAssembly.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.h
Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.h