From 04889b818323309d1b6ddd2b628409a83dcf4ba1 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 4 Mar 2016 21:57:32 -0800 Subject: move WasmTypes in integrateWasmJS to the right place --- src/js/wasm.js-post.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index 7f36776b8..caeadf837 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 @@ -130,14 +138,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({}); -- cgit v1.2.3 From a0fe0c518d95a90137d7a28898add5eee1532142 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 4 Mar 2016 21:57:57 -0800 Subject: send a typed array to instantiateMemory --- src/js/wasm.js-post.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index caeadf837..347f85923 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -127,7 +127,7 @@ function integrateWasmJS(Module) { info['global'] = { 'Math': global.Math }; info['env'] = env; var instance; - instance = Wasm.instantiateModule(binary.buffer, info); + instance = Wasm.instantiateModule(binary, info); mergeMemory(instance.memory); applyMappedGlobals(); -- cgit v1.2.3 From e9be280e476026af4ecb0b0bc839e0a9d967168d Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 4 Mar 2016 22:00:47 -0800 Subject: place NaN and Infinity on global --- src/js/wasm.js-post.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index 347f85923..b2ec40b00 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -124,7 +124,11 @@ 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, info); -- cgit v1.2.3