WebAssembly JS API: implement start function
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2016 02:34:02 +0000 (02:34 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2016 02:34:02 +0000 (02:34 +0000)
commit746fc5ea4283e3441e1b6e327e75d6b10cfbfda3
tree1a682503a601effc2ac0e91d4d61b596effe9b60
parent79a0a072f50bb6707dd6abe97656455c7891008e
WebAssembly JS API: implement start function
https://bugs.webkit.org/show_bug.cgi?id=165150

Reviewed by Saam Barati.

JSTests:

* wasm/Builder.js: allow building a .Start()
* wasm/Builder_WebAssemblyBinary.js:
* wasm/js-api/test_Start.js: Added.
(const.emitters.Start): serialize a start section
* wasm/self-test/test_BuilderJSON.js: validate the start section's content

Source/JavaScriptCore:

* wasm/WasmFormat.h: pass the start function around
* wasm/WasmModuleParser.cpp:
(JSC::Wasm::ModuleParser::parseTable): mark unreachable code
(JSC::Wasm::ModuleParser::parseGlobal): mark unreachable code
(JSC::Wasm::ModuleParser::parseStart): mark unreachable code
(JSC::Wasm::ModuleParser::parseElement): mark unreachable code
(JSC::Wasm::ModuleParser::parseData): mark unreachable code
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction): NFC: call the new function below
(JSC::WebAssemblyFunction::call): separate this out so that the start function can use it
* wasm/js/WebAssemblyFunction.h:
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::visitChildren): visit the start function
(JSC::WebAssemblyModuleRecord::link): handle start function
(JSC::WebAssemblyModuleRecord::evaluate): call the start function, if present
* wasm/js/WebAssemblyModuleRecord.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209642 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
JSTests/ChangeLog
JSTests/wasm/Builder.js
JSTests/wasm/Builder_WebAssemblyBinary.js
JSTests/wasm/js-api/test_Start.js [new file with mode: 0644]
JSTests/wasm/self-test/test_BuilderJSON.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wasm/WasmFormat.cpp
Source/JavaScriptCore/wasm/WasmFormat.h
Source/JavaScriptCore/wasm/WasmModuleParser.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h
Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.h