summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/js/wasm.js-post.js24
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({});