summaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-28 19:02:38 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-28 19:02:38 -0800
commit5c19367f08d59d0edb17f7acdafe122e1d10e2a6 (patch)
tree59d74f359dda8f677e9e51f7441469a983da9447 /src/js
parent2d43e52b3ae1589d0f3127373e92a689e651ed33 (diff)
downloadbinaryen-5c19367f08d59d0edb17f7acdafe122e1d10e2a6.tar.gz
binaryen-5c19367f08d59d0edb17f7acdafe122e1d10e2a6.tar.bz2
binaryen-5c19367f08d59d0edb17f7acdafe122e1d10e2a6.zip
optionally emit mappedGlobals in asm2wasm, and use that to help when parsing s-expressions
Diffstat (limited to 'src/js')
-rw-r--r--src/js/post.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/js/post.js b/src/js/post.js
index 4377ed797..2ef25e30c 100644
--- a/src/js/post.js
+++ b/src/js/post.js
@@ -84,6 +84,9 @@ function integrateWasmJS(Module) {
Module['asm'] = function(global, env, providedBuffer) {
assert(providedBuffer === Module['buffer']); // we should not even need to pass it as a 3rd arg for wasm, but that's the asm.js way.
+ info.global = global;
+ info.env = env;
+
// 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
// this copy in wasm.js polyfilling, but to be as close as possible to real wasm,
@@ -112,16 +115,12 @@ function integrateWasmJS(Module) {
if (method == 'asm2wasm') {
wasmJS['_load_asm2wasm'](temp);
} else {
- wasmJS['_load_s_expr2wasm'](temp);
+ wasmJS['_load_s_expr2wasm'](temp, Module['read'](Module['wasmCodeFile'] + '.mappedGlobals'));
}
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;
- wasmJS['_load_mapped_globals'](); // now that we have global and env, we can ready the provided imported globals, copying them to their mapped locations.
return wasmJS['asmExports'];
};
}