summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-03-04 21:50:54 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-03-04 21:50:54 -0800
commitd576691b9a62dbae733e86af69569e9de1a2abb5 (patch)
tree309279e88c58a7faf27d3efba42f18abcbf74a24 /src
parent463842bd3456abda471e4031c100d2586fae9783 (diff)
parent2a36300d4318a0a7b7275eac4939d4badfe74877 (diff)
downloadbinaryen-d576691b9a62dbae733e86af69569e9de1a2abb5.tar.gz
binaryen-d576691b9a62dbae733e86af69569e9de1a2abb5.tar.bz2
binaryen-d576691b9a62dbae733e86af69569e9de1a2abb5.zip
Merge pull request #227 from WebAssembly/integrate-wasm-fixes
Integrate wasm fixes
Diffstat (limited to 'src')
-rw-r--r--src/js/wasm.js-post.js12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js
index e5e745af2..7f36776b8 100644
--- a/src/js/wasm.js-post.js
+++ b/src/js/wasm.js-post.js
@@ -97,7 +97,7 @@ function integrateWasmJS(Module) {
for (var name in mappedGlobals) {
var global = mappedGlobals[name];
if (!global.import) continue; // non-imports are initialized to zero in the typed array anyhow, so nothing to do here
- var value = wasmJS['lookupImport'](global.module, global.base);
+ var value = lookupImport(global.module, global.base);
var address = global.address;
switch (global.type) {
case WasmTypes.i32: Module['HEAP32'][address >> 2] = value; break;
@@ -108,7 +108,7 @@ function integrateWasmJS(Module) {
}
}
- if (typeof WASM === 'object' || typeof wasmEval === 'function') {
+ if (typeof Wasm === 'object') {
// Provide an "asm.js function" for the application, called to "link" the asm.js module. We instantiate
// the wasm module at that time, and it receives imports and provides exports and so forth, the app
// doesn't need to care that it is wasm and not asm.
@@ -119,13 +119,7 @@ function integrateWasmJS(Module) {
info['global'] = { 'Math': global.Math };
info['env'] = env;
var instance;
- if (typeof WASM === 'object') {
- instance = WASM.instantiateModule(binary, info);
- } else if (typeof wasmEval === 'function') {
- instance = wasmEval(binary.buffer, info);
- } else {
- throw 'how to wasm?';
- }
+ instance = Wasm.instantiateModule(binary.buffer, info);
mergeMemory(instance.memory);
applyMappedGlobals();