diff options
-rw-r--r-- | src/js/wasm.js-post.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index 2e73e6b31..a0c026c91 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -187,7 +187,12 @@ function integrateWasmJS(Module) { info['global.Math'] = global.Math; info['env'] = env; var instance; - instance = Wasm.instantiateModule(getBinary(), info); + try { + instance = Wasm.instantiateModule(getBinary(), info); + } catch (e) { + Module['printErr']('failed to compile wasm module: ' + e); + return false; + } exports = instance.exports; mergeMemory(exports.memory); @@ -283,7 +288,9 @@ function integrateWasmJS(Module) { for (var i = 0; i < methods.length; i++) { var curr = methods[i]; - //Module['printErr']('using wasm/js method: ' + curr); + + Module['printErr']('trying binaryen method: ' + curr); + if (curr === 'native-wasm') { if (exports = doNativeWasm(global, env, providedBuffer)) break; } else if (curr === 'asmjs') { @@ -295,7 +302,9 @@ function integrateWasmJS(Module) { } } - if (!exports) throw 'no wasm method succeeded'; + if (!exports) throw 'no binaryen method succeeded'; + + Module['printErr']('binaryen method succeeded.'); return exports; }; |