diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-03-04 22:15:18 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-03-04 22:15:18 -0800 |
commit | a96bf5cbb71ee5923f4f534db49cedeccf6d51d0 (patch) | |
tree | 86a0a230a3c892064678d4a0af5deb99f43c5d90 /src | |
parent | d576691b9a62dbae733e86af69569e9de1a2abb5 (diff) | |
parent | e9be280e476026af4ecb0b0bc839e0a9d967168d (diff) | |
download | binaryen-a96bf5cbb71ee5923f4f534db49cedeccf6d51d0.tar.gz binaryen-a96bf5cbb71ee5923f4f534db49cedeccf6d51d0.tar.bz2 binaryen-a96bf5cbb71ee5923f4f534db49cedeccf6d51d0.zip |
Merge pull request #228 from WebAssembly/integrate-wasm-fixes
Integrate wasm fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/js/wasm.js-post.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index 7f36776b8..b2ec40b00 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -88,6 +88,14 @@ function integrateWasmJS(Module) { }; } + var WasmTypes = { + none: 0, + i32: 1, + i64: 2, + f32: 3, + f64: 4 + }; + // wasm lacks globals, so asm2wasm maps them into locations in memory. that information cannot // be present in the wasm output of asm2wasm, so we store it in a side file. If we load asm2wasm // output, either generated ahead of time or on the client, we need to apply those mapped @@ -116,10 +124,14 @@ function integrateWasmJS(Module) { // Load the wasm module var binary = Module['readBinary'](Module['wasmCodeFile']); // Create an instance of the module using native support in the JS engine. - info['global'] = { 'Math': global.Math }; + info['global'] = { + 'Math': global.Math, + 'NaN': NaN, + 'Infinity': Infinity + }; info['env'] = env; var instance; - instance = Wasm.instantiateModule(binary.buffer, info); + instance = Wasm.instantiateModule(binary, info); mergeMemory(instance.memory); applyMappedGlobals(); @@ -130,14 +142,6 @@ function integrateWasmJS(Module) { return; } - var WasmTypes = { - none: 0, - i32: 1, - i64: 2, - f32: 3, - f64: 4 - }; - // Use wasm.js to polyfill and execute code in a wasm interpreter. var wasmJS = WasmJS({}); |