summaryrefslogtreecommitdiff
path: root/src/js/post.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-28 12:17:52 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-28 12:59:22 -0800
commit6d36e9640efa7bbefc05e4db0fc6c97d79053c9b (patch)
tree7bab27202fda1d6b67888d607ad43d697a0b6d21 /src/js/post.js
parent86491ff1fb2a7bebc357b28db74385785c0644ef (diff)
downloadbinaryen-6d36e9640efa7bbefc05e4db0fc6c97d79053c9b.tar.gz
binaryen-6d36e9640efa7bbefc05e4db0fc6c97d79053c9b.tar.bz2
binaryen-6d36e9640efa7bbefc05e4db0fc6c97d79053c9b.zip
refactor wasm.js so that it will be able to support multiple wasm loading methods
Diffstat (limited to 'src/js/post.js')
-rw-r--r--src/js/post.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/js/post.js b/src/js/post.js
index 596831595..72cd836ba 100644
--- a/src/js/post.js
+++ b/src/js/post.js
@@ -84,6 +84,7 @@ function integrateWasmJS(Module) {
// Generate a module instance of the asm.js converted into wasm.
var code = Module['read'](Module['asmjsCodeFile']);
+ // TODO: support wasm s-expression loading here
// wasm code would create its own buffer, at this time. But static init code might have
// written to the buffer already, and we must copy it over. We could just avoid
@@ -106,9 +107,11 @@ function integrateWasmJS(Module) {
var temp = wasmJS['_malloc'](code.length + 1);
wasmJS['writeAsciiToMemory'](code, temp);
- wasmJS['_load_asm'](temp);
+ wasmJS['_load_asm2wasm'](temp);
wasmJS['_free'](temp);
+ wasmJS['_instantiate'](temp);
+
// write the provided data to a location the wasm instance can get at it.
info.global = global;
info.env = env;