WebAssembly JS API: add Module.sections
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Jan 2017 19:27:01 +0000 (19:27 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Jan 2017 19:27:01 +0000 (19:27 +0000)
commit26c1640f7b436f3484501f1a3982e2a005548c35
treeba23a03d01896c56802e9cbe9703d5c1a4671c1d
parentb4c14def939c8339ba9f4a3d9f768a0f17db187f
WebAssembly JS API: add Module.sections
https://bugs.webkit.org/show_bug.cgi?id=165159
<rdar://problem/29760326>

Reviewed by Mark Lam.

JSTests:

As described here: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodulecustomsections

* wasm/Builder.js: allow custom sections to be duplicated
* wasm/js-api/Module.customSection.js: Added.
(assert.throws.WebAssembly.Module.prototype.customSections):
(assert.eq):

Source/JavaScriptCore:

As described in: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodulecustomsections

This was added for Emscripten, and is likely to be used soon.

* wasm/WasmFormat.h: custom sections are just name + bytes
* wasm/WasmModuleParser.cpp: parse them, instead of skipping over
* wasm/WasmModuleParser.h:
* wasm/js/WebAssemblyModulePrototype.cpp: construct the Array of
ArrayBuffer as described in the spec
(JSC::webAssemblyModuleProtoCustomSections):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/wasm/Builder.js
JSTests/wasm/js-api/Module.customSection.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wasm/WasmFormat.h
Source/JavaScriptCore/wasm/WasmModuleParser.cpp
Source/JavaScriptCore/wasm/WasmModuleParser.h
Source/JavaScriptCore/wasm/js/WebAssemblyModulePrototype.cpp