diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-03-11 14:25:42 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-03-11 14:25:57 -0800 |
commit | b3e7a79fc90ac61641723974296c90624742e92a (patch) | |
tree | af200d07af8f3c2f2bf9784d71c1faf5a263c4c7 /src/js/wasm.js-post.js | |
parent | 0df60eadd9bcba09b0288ad5b5733cd79aed490f (diff) | |
download | binaryen-b3e7a79fc90ac61641723974296c90624742e92a.tar.gz binaryen-b3e7a79fc90ac61641723974296c90624742e92a.tar.bz2 binaryen-b3e7a79fc90ac61641723974296c90624742e92a.zip |
log failures in wasm/js integration
Diffstat (limited to 'src/js/wasm.js-post.js')
-rw-r--r-- | src/js/wasm.js-post.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index e81a4f7b8..e3ab2bb4f 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -140,11 +140,19 @@ function integrateWasmJS(Module) { function doJustAsm() { eval(Module['read'](asmjsCodeFile)); - return typeof Module['asm'] === 'function'; // evalling the asm.js file should set this + if (typeof Module['asm'] !== 'function') { + // evalling the asm.js file should have set this + Module['printErr']('asm evalling did not set the module properly'); + return false; + } + return true; } function doNativeWasm() { - if (typeof Wasm !== 'object') return false; + if (typeof Wasm !== 'object') { + Module['printErr']('no native wasm support detected'); + return false; + } // 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 @@ -182,7 +190,10 @@ function integrateWasmJS(Module) { } function doWasmPolyfill(method) { - if (typeof WasmJS !== 'function') return false; // not built with wasm.js polyfill? + if (typeof WasmJS !== 'function') { + Module['printErr']('WasmJS not detected - polyfill not bundled?'); + return false; + } // Use wasm.js to polyfill and execute code in a wasm interpreter. var wasmJS = WasmJS({}); @@ -247,7 +258,7 @@ function integrateWasmJS(Module) { var methods = method.split(','); for (var i = 0; i < methods.length; i++) { var curr = methods[i]; - //console.log('using wasm/js method: ' + curr); + //Module['printErr']('using wasm/js method: ' + curr); if (curr === 'native-wasm') { if (doNativeWasm()) return; } else if (curr === 'just-asm') { @@ -258,5 +269,6 @@ function integrateWasmJS(Module) { throw 'bad method: ' + curr; } } + throw 'no wasm method succeeded'; } |