WebAssembly: Implement the WebAssembly.compile and WebAssembly.validate
https://bugs.webkit.org/show_bug.cgi?id=165936

Reviewed by Mark Lam.

JSTests:

* wasm/js-api/Module-compile.js: Added.
(async.testPromiseAPI):
* wasm/js-api/test_basic_api.js:
(const.c.in.constructorProperties.switch):
* wasm/js-api/validate.js: Added.
(assert.truthy.WebAssembly.validate.builder.WebAssembly):

Source/JavaScriptCore:

The APIs are documented here:
- https://github.com/WebAssembly/design/blob/master/JS.md#webassemblycompile
- https://github.com/WebAssembly/design/blob/master/JS.md#webassemblyvalidate

* wasm/JSWebAssembly.cpp:
(JSC::webAssemblyCompileFunc):
(JSC::webAssemblyValidateFunc):
(JSC::JSWebAssembly::finishCreation):
* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::parseAndValidateModule):
(JSC::Wasm::Plan::run):
* wasm/WasmPlan.h:
* wasm/js/JSWebAssemblyHelpers.h:
(JSC::getWasmBufferFromValue):
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::constructJSWebAssemblyModule):
(JSC::callJSWebAssemblyModule):
(JSC::WebAssemblyModuleConstructor::createModule):
* wasm/js/WebAssemblyModuleConstructor.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@209979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
11 files changed