diff options
119 files changed, 331 insertions, 165 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h index cc4d363ec..05ba2ace9 100644 --- a/src/wasm2js.h +++ b/src/wasm2js.h @@ -53,6 +53,8 @@ namespace wasm { using namespace cashew; +static IString importObject("importObject"); + // Appends extra to block, flattening out if extra is a block as well void flattenAppend(Ref ast, Ref extra) { int index; @@ -411,7 +413,21 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) { Ref ret = ValueBuilder::makeToplevel(); Ref asmFunc = ValueBuilder::makeFunction(funcName); ret[1]->push_back(asmFunc); - ValueBuilder::appendArgumentToFunction(asmFunc, ENV); + ValueBuilder::appendArgumentToFunction(asmFunc, importObject); + + // Retrieve `env` object from info. Older version of emscripten pass `env` + // *as* `info` so for now we make this conditional. + // TODO(sbc): Remove the makeBinary here once emscripten change has landed. + Ref envVar = ValueBuilder::makeVar(); + asmFunc[3]->push_back(envVar); + ValueBuilder::appendToVar( + envVar, + ENV, + ValueBuilder::makeBinary( + ValueBuilder::makeDot(ValueBuilder::makeName(importObject), + ValueBuilder::makeName(ENV)), + "||", + ValueBuilder::makeName(importObject))); // add memory import if (!wasm->memories.empty()) { @@ -2570,7 +2586,7 @@ void Wasm2JSGlue::emitPre() { } void Wasm2JSGlue::emitPreEmscripten() { - out << "function instantiate(asmLibraryArg) {\n"; + out << "function instantiate(info) {\n"; } void Wasm2JSGlue::emitPreES6() { @@ -2617,7 +2633,7 @@ void Wasm2JSGlue::emitPost() { } void Wasm2JSGlue::emitPostEmscripten() { - out << " return asmFunc(asmLibraryArg);\n}\n"; + out << " return asmFunc(info);\n}\n"; } void Wasm2JSGlue::emitPostES6() { diff --git a/test/binaryen.js/emit_asmjs.js.txt b/test/binaryen.js/emit_asmjs.js.txt index 90babcb90..2d9a18331 100644 --- a/test/binaryen.js/emit_asmjs.js.txt +++ b/test/binaryen.js/emit_asmjs.js.txt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js.asserts.js b/test/wasm2js.asserts.js index 2770c07dd..b3cf64d4c 100644 --- a/test/wasm2js.asserts.js +++ b/test/wasm2js.asserts.js @@ -30,7 +30,8 @@ return (actual_lo | 0) == (expected_lo | 0) && (actual_hi | 0) == (expected_hi | 0); } -function asmFunc0(env) { +function asmFunc0(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js.traps.js b/test/wasm2js.traps.js index d3b672dd1..350f55947 100644 --- a/test/wasm2js.traps.js +++ b/test/wasm2js.traps.js @@ -30,7 +30,8 @@ return (actual_lo | 0) == (expected_lo | 0) && (actual_hi | 0) == (expected_hi | 0); } -function asmFunc0(env) { +function asmFunc0(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/add_div.2asm.js b/test/wasm2js/add_div.2asm.js index f160dcbc8..def3ae357 100644 --- a/test/wasm2js/add_div.2asm.js +++ b/test/wasm2js/add_div.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/add_div.2asm.js.opt b/test/wasm2js/add_div.2asm.js.opt index 1e575d9f5..edf698e20 100644 --- a/test/wasm2js/add_div.2asm.js.opt +++ b/test/wasm2js/add_div.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/atomic_fence.2asm.js b/test/wasm2js/atomic_fence.2asm.js index 2caca85e6..fb64bda35 100644 --- a/test/wasm2js/atomic_fence.2asm.js +++ b/test/wasm2js/atomic_fence.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(1507328); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/atomic_fence.2asm.js.opt b/test/wasm2js/atomic_fence.2asm.js.opt index 666988ae6..eb4e06541 100644 --- a/test/wasm2js/atomic_fence.2asm.js.opt +++ b/test/wasm2js/atomic_fence.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/atomics_32.2asm.js b/test/wasm2js/atomics_32.2asm.js index 1eb03343c..a7322cceb 100644 --- a/test/wasm2js/atomics_32.2asm.js +++ b/test/wasm2js/atomics_32.2asm.js @@ -94,7 +94,8 @@ memorySegments[1] = base64DecodeToExistingUint8Array(new Uint8Array(6), 0, "d29y bufferView.set(memorySegments[segment].subarray(offset, offset + size), dest); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(16777216); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/atomics_32.2asm.js.opt b/test/wasm2js/atomics_32.2asm.js.opt index 8d2a205d1..0810affa3 100644 --- a/test/wasm2js/atomics_32.2asm.js.opt +++ b/test/wasm2js/atomics_32.2asm.js.opt @@ -94,7 +94,8 @@ memorySegments[1] = base64DecodeToExistingUint8Array(new Uint8Array(6), 0, "d29y bufferView.set(memorySegments[segment].subarray(offset, offset + size), dest); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(16777216); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/base64.2asm.js b/test/wasm2js/base64.2asm.js index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/base64.2asm.js +++ b/test/wasm2js/base64.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/base64.2asm.js.opt b/test/wasm2js/base64.2asm.js.opt index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/base64.2asm.js.opt +++ b/test/wasm2js/base64.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/br.2asm.js b/test/wasm2js/br.2asm.js index ccd6bff3a..c31ff032c 100644 --- a/test/wasm2js/br.2asm.js +++ b/test/wasm2js/br.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/br_table.2asm.js b/test/wasm2js/br_table.2asm.js index be7b89b9f..8ca71f287 100644 --- a/test/wasm2js/br_table.2asm.js +++ b/test/wasm2js/br_table.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/br_table_hoisting.2asm.js b/test/wasm2js/br_table_hoisting.2asm.js index 9bf6abdac..091c669b4 100644 --- a/test/wasm2js/br_table_hoisting.2asm.js +++ b/test/wasm2js/br_table_hoisting.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/br_table_hoisting.2asm.js.opt b/test/wasm2js/br_table_hoisting.2asm.js.opt index 422c33af1..81e25acb8 100644 --- a/test/wasm2js/br_table_hoisting.2asm.js.opt +++ b/test/wasm2js/br_table_hoisting.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/br_table_temp.2asm.js b/test/wasm2js/br_table_temp.2asm.js index 32850d080..d45976452 100644 --- a/test/wasm2js/br_table_temp.2asm.js +++ b/test/wasm2js/br_table_temp.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/br_table_temp.2asm.js.opt b/test/wasm2js/br_table_temp.2asm.js.opt index 5c7d88a16..7a3da66b9 100644 --- a/test/wasm2js/br_table_temp.2asm.js.opt +++ b/test/wasm2js/br_table_temp.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/br_table_to_loop.2asm.js b/test/wasm2js/br_table_to_loop.2asm.js index 0d33a87e4..419b0e10f 100644 --- a/test/wasm2js/br_table_to_loop.2asm.js +++ b/test/wasm2js/br_table_to_loop.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/br_table_to_loop.2asm.js.opt b/test/wasm2js/br_table_to_loop.2asm.js.opt index b69dcdd3d..2bd56bfa5 100644 --- a/test/wasm2js/br_table_to_loop.2asm.js.opt +++ b/test/wasm2js/br_table_to_loop.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/break-drop.2asm.js b/test/wasm2js/break-drop.2asm.js index a3fc7a961..c103a0397 100644 --- a/test/wasm2js/break-drop.2asm.js +++ b/test/wasm2js/break-drop.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/bulk-memory.2asm.js b/test/wasm2js/bulk-memory.2asm.js index a517931fb..4ba96d034 100644 --- a/test/wasm2js/bulk-memory.2asm.js +++ b/test/wasm2js/bulk-memory.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -35,7 +36,8 @@ var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } bufferView.fill(value, dest, dest + size); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); @@ -143,7 +145,8 @@ function initActiveSegments(imports) { bufferView.copyWithin(dest, source, source + size); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); @@ -229,7 +232,8 @@ memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(4), 0, "qrvM bufferView.set(memorySegments[segment].subarray(offset, offset + size), dest); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); @@ -344,7 +348,8 @@ function initActiveSegments(imports) { bufferView.set(memorySegments[segment].subarray(offset, offset + size), dest); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/bulk-memory.2asm.js.opt b/test/wasm2js/bulk-memory.2asm.js.opt index 4febf1a84..d6a690909 100644 --- a/test/wasm2js/bulk-memory.2asm.js.opt +++ b/test/wasm2js/bulk-memory.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -35,7 +36,8 @@ var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } bufferView.fill(value, dest, dest + size); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); @@ -143,7 +145,8 @@ function initActiveSegments(imports) { bufferView.copyWithin(dest, source, source + size); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); @@ -229,7 +232,8 @@ memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(4), 0, "qrvM bufferView.set(memorySegments[segment].subarray(offset, offset + size), dest); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); @@ -302,7 +306,8 @@ var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } export var init = retasmFunc.init; export var load8_u = retasmFunc.load8_u; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/comments.2asm.js b/test/wasm2js/comments.2asm.js index 5689ecdc5..25508ff66 100644 --- a/test/wasm2js/comments.2asm.js +++ b/test/wasm2js/comments.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -21,7 +22,8 @@ function asmFunc(env) { var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } }); -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/conversions-modified.2asm.js b/test/wasm2js/conversions-modified.2asm.js index 6f4ec810f..33986c906 100644 --- a/test/wasm2js/conversions-modified.2asm.js +++ b/test/wasm2js/conversions-modified.2asm.js @@ -30,7 +30,8 @@ import { setTempRet0 } from 'env'; f32ScratchView[2] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/conversions-modified.2asm.js.opt b/test/wasm2js/conversions-modified.2asm.js.opt index 1b96f428c..434f6df30 100644 --- a/test/wasm2js/conversions-modified.2asm.js.opt +++ b/test/wasm2js/conversions-modified.2asm.js.opt @@ -30,7 +30,8 @@ import { setTempRet0 } from 'env'; f32ScratchView[2] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/deterministic.2asm.js b/test/wasm2js/deterministic.2asm.js index 8049c3f63..9cb65651c 100644 --- a/test/wasm2js/deterministic.2asm.js +++ b/test/wasm2js/deterministic.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.memory; var buffer = memory.buffer; var HEAP8 = new Int8Array(buffer); diff --git a/test/wasm2js/deterministic.2asm.js.opt b/test/wasm2js/deterministic.2asm.js.opt index b6b137d71..6f6be3f85 100644 --- a/test/wasm2js/deterministic.2asm.js.opt +++ b/test/wasm2js/deterministic.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.memory; var buffer = memory.buffer; var HEAP8 = new Int8Array(buffer); diff --git a/test/wasm2js/dot_import.2asm.js b/test/wasm2js/dot_import.2asm.js index bfeb025b8..da0cfb125 100644 --- a/test/wasm2js/dot_import.2asm.js +++ b/test/wasm2js/dot_import.2asm.js @@ -1,6 +1,7 @@ import { ba_se } from 'mod.ule'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/dot_import.2asm.js.opt b/test/wasm2js/dot_import.2asm.js.opt index bfeb025b8..da0cfb125 100644 --- a/test/wasm2js/dot_import.2asm.js.opt +++ b/test/wasm2js/dot_import.2asm.js.opt @@ -1,6 +1,7 @@ import { ba_se } from 'mod.ule'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/dynamicLibrary.2asm.js b/test/wasm2js/dynamicLibrary.2asm.js index 03f8b79ed..0a8866445 100644 --- a/test/wasm2js/dynamicLibrary.2asm.js +++ b/test/wasm2js/dynamicLibrary.2asm.js @@ -36,7 +36,8 @@ function Table(ret) { function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, imports[memoryBase], "ZHluYW1pYyBkYXRh"); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.memory; var buffer = memory.buffer; var HEAP8 = new Int8Array(buffer); diff --git a/test/wasm2js/dynamicLibrary.2asm.js.opt b/test/wasm2js/dynamicLibrary.2asm.js.opt index c86293805..9c418ffd3 100644 --- a/test/wasm2js/dynamicLibrary.2asm.js.opt +++ b/test/wasm2js/dynamicLibrary.2asm.js.opt @@ -36,7 +36,8 @@ function Table(ret) { function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, imports[memoryBase], "ZHluYW1pYyBkYXRh"); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.memory; var buffer = memory.buffer; var HEAP8 = new Int8Array(buffer); diff --git a/test/wasm2js/empty_export.2asm.js b/test/wasm2js/empty_export.2asm.js index a4e12d569..8ecf44c0b 100644 --- a/test/wasm2js/empty_export.2asm.js +++ b/test/wasm2js/empty_export.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/empty_export.2asm.js.opt b/test/wasm2js/empty_export.2asm.js.opt index a4e12d569..8ecf44c0b 100644 --- a/test/wasm2js/empty_export.2asm.js.opt +++ b/test/wasm2js/empty_export.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/empty_table.2asm.js b/test/wasm2js/empty_table.2asm.js index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/empty_table.2asm.js +++ b/test/wasm2js/empty_table.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/emscripten-grow-no.2asm.js b/test/wasm2js/emscripten-grow-no.2asm.js index d349b622a..8176105dd 100644 --- a/test/wasm2js/emscripten-grow-no.2asm.js +++ b/test/wasm2js/emscripten-grow-no.2asm.js @@ -1,4 +1,4 @@ -function instantiate(asmLibraryArg) { +function instantiate(info) { var bufferView; var base64ReverseLookup = new Uint8Array(123/*'z'+1*/); for (var i = 25; i >= 0; --i) { @@ -23,7 +23,8 @@ function instantiate(asmLibraryArg) { function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, 1600, "YWJj"); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.memory; var buffer = memory.buffer; var HEAP8 = new Int8Array(buffer); @@ -72,5 +73,5 @@ function asmFunc(env) { }; } - return asmFunc(asmLibraryArg); + return asmFunc(info); } diff --git a/test/wasm2js/emscripten-grow-no.2asm.js.opt b/test/wasm2js/emscripten-grow-no.2asm.js.opt index d349b622a..8176105dd 100644 --- a/test/wasm2js/emscripten-grow-no.2asm.js.opt +++ b/test/wasm2js/emscripten-grow-no.2asm.js.opt @@ -1,4 +1,4 @@ -function instantiate(asmLibraryArg) { +function instantiate(info) { var bufferView; var base64ReverseLookup = new Uint8Array(123/*'z'+1*/); for (var i = 25; i >= 0; --i) { @@ -23,7 +23,8 @@ function instantiate(asmLibraryArg) { function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, 1600, "YWJj"); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.memory; var buffer = memory.buffer; var HEAP8 = new Int8Array(buffer); @@ -72,5 +73,5 @@ function asmFunc(env) { }; } - return asmFunc(asmLibraryArg); + return asmFunc(info); } diff --git a/test/wasm2js/emscripten-grow-yes.2asm.js b/test/wasm2js/emscripten-grow-yes.2asm.js index 6f02ce3cc..4167e7741 100644 --- a/test/wasm2js/emscripten-grow-yes.2asm.js +++ b/test/wasm2js/emscripten-grow-yes.2asm.js @@ -1,4 +1,4 @@ -function instantiate(asmLibraryArg) { +function instantiate(info) { var bufferView; var base64ReverseLookup = new Uint8Array(123/*'z'+1*/); for (var i = 25; i >= 0; --i) { @@ -23,7 +23,8 @@ function instantiate(asmLibraryArg) { function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, 1600, "YWJj"); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.memory; var buffer = memory.buffer; memory.grow = __wasm_memory_grow; @@ -101,5 +102,5 @@ function asmFunc(env) { }; } - return asmFunc(asmLibraryArg); + return asmFunc(info); } diff --git a/test/wasm2js/emscripten-grow-yes.2asm.js.opt b/test/wasm2js/emscripten-grow-yes.2asm.js.opt index 6f02ce3cc..4167e7741 100644 --- a/test/wasm2js/emscripten-grow-yes.2asm.js.opt +++ b/test/wasm2js/emscripten-grow-yes.2asm.js.opt @@ -1,4 +1,4 @@ -function instantiate(asmLibraryArg) { +function instantiate(info) { var bufferView; var base64ReverseLookup = new Uint8Array(123/*'z'+1*/); for (var i = 25; i >= 0; --i) { @@ -23,7 +23,8 @@ function instantiate(asmLibraryArg) { function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, 1600, "YWJj"); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.memory; var buffer = memory.buffer; memory.grow = __wasm_memory_grow; @@ -101,5 +102,5 @@ function asmFunc(env) { }; } - return asmFunc(asmLibraryArg); + return asmFunc(info); } diff --git a/test/wasm2js/emscripten.2asm.js b/test/wasm2js/emscripten.2asm.js index d411b62a9..5a574a3b3 100644 --- a/test/wasm2js/emscripten.2asm.js +++ b/test/wasm2js/emscripten.2asm.js @@ -1,4 +1,4 @@ -function instantiate(asmLibraryArg) { +function instantiate(info) { var bufferView; var base64ReverseLookup = new Uint8Array(123/*'z'+1*/); for (var i = 25; i >= 0; --i) { @@ -24,7 +24,8 @@ function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, 1024, "aGVsbG8sIHdvcmxkIQoAAJwMAAAtKyAgIDBYMHgAKG51bGwpAAAAAAAAAAAAAAAAEQAKABEREQAAAAAFAAAAAAAACQAAAAALAAAAAAAAAAARAA8KERERAwoHAAETCQsLAAAJBgsAAAsABhEAAAAREREAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAEQAKChEREQAKAAACAAkLAAAACQALAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAADAAAAAAJDAAAAAAADAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAANAAAABA0AAAAACQ4AAAAAAA4AAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAADwAAAAAPAAAAAAkQAAAAAAAQAAAQAAASAAAAEhISAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAASEhIAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAAKAAAAAAoAAAAACQsAAAAAAAsAAAsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAwMTIzNDU2Nzg5QUJDREVGLTBYKzBYIDBYLTB4KzB4IDB4AGluZgBJTkYAbmFuAE5BTgAuAA=="); base64DecodeToExistingUint8Array(bufferView, 1600, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(16777216); var FUNCTION_TABLE = env.table; var HEAP8 = new Int8Array(buffer); @@ -231,5 +232,5 @@ function asmFunc(env) { }; } - return asmFunc(asmLibraryArg); + return asmFunc(info); } diff --git a/test/wasm2js/emscripten.2asm.js.opt b/test/wasm2js/emscripten.2asm.js.opt index 57df79dfc..88fe0866a 100644 --- a/test/wasm2js/emscripten.2asm.js.opt +++ b/test/wasm2js/emscripten.2asm.js.opt @@ -1,4 +1,4 @@ -function instantiate(asmLibraryArg) { +function instantiate(info) { var bufferView; var base64ReverseLookup = new Uint8Array(123/*'z'+1*/); for (var i = 25; i >= 0; --i) { @@ -36,7 +36,8 @@ function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, 1501, "DA=="); base64DecodeToExistingUint8Array(bufferView, 1513, "DAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAwMTIzNDU2Nzg5QUJDREVGLTBYKzBYIDBYLTB4KzB4IDB4AGluZgBJTkYAbmFuAE5BTgAu"); } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(16777216); var FUNCTION_TABLE = env.table; var HEAP8 = new Int8Array(buffer); @@ -226,5 +227,5 @@ function asmFunc(env) { }; } - return asmFunc(asmLibraryArg); + return asmFunc(info); } diff --git a/test/wasm2js/endianness.2asm.js b/test/wasm2js/endianness.2asm.js index 5d32183cb..380121f9b 100644 --- a/test/wasm2js/endianness.2asm.js +++ b/test/wasm2js/endianness.2asm.js @@ -31,7 +31,8 @@ import { setTempRet0 } from 'env'; return f32ScratchView[2]; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/excess_fallthrough.2asm.js b/test/wasm2js/excess_fallthrough.2asm.js index b1dff9245..378a50df3 100644 --- a/test/wasm2js/excess_fallthrough.2asm.js +++ b/test/wasm2js/excess_fallthrough.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/excess_fallthrough.2asm.js.opt b/test/wasm2js/excess_fallthrough.2asm.js.opt index d54b292f4..cebc82e03 100644 --- a/test/wasm2js/excess_fallthrough.2asm.js.opt +++ b/test/wasm2js/excess_fallthrough.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/export_global.2asm.js b/test/wasm2js/export_global.2asm.js index 7db0d3a20..1ebd971d1 100644 --- a/test/wasm2js/export_global.2asm.js +++ b/test/wasm2js/export_global.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/export_global.2asm.js.opt b/test/wasm2js/export_global.2asm.js.opt index eb4e88090..a79005c55 100644 --- a/test/wasm2js/export_global.2asm.js.opt +++ b/test/wasm2js/export_global.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/f32.2asm.js b/test/wasm2js/f32.2asm.js index bc4c387a2..61943bbdf 100644 --- a/test/wasm2js/f32.2asm.js +++ b/test/wasm2js/f32.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/f32_cmp.2asm.js b/test/wasm2js/f32_cmp.2asm.js index 54ba6033b..edb07308f 100644 --- a/test/wasm2js/f32_cmp.2asm.js +++ b/test/wasm2js/f32_cmp.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/f64_cmp.2asm.js b/test/wasm2js/f64_cmp.2asm.js index 127beaadb..8ea8e3d1c 100644 --- a/test/wasm2js/f64_cmp.2asm.js +++ b/test/wasm2js/f64_cmp.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/fac.2asm.js b/test/wasm2js/fac.2asm.js index e8b31b14f..d911c421b 100644 --- a/test/wasm2js/fac.2asm.js +++ b/test/wasm2js/fac.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/float-ops.2asm.js b/test/wasm2js/float-ops.2asm.js index 4ae8dbc43..9fe0fbad4 100644 --- a/test/wasm2js/float-ops.2asm.js +++ b/test/wasm2js/float-ops.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/float-ops.2asm.js.opt b/test/wasm2js/float-ops.2asm.js.opt index a78785a62..d9ba62568 100644 --- a/test/wasm2js/float-ops.2asm.js.opt +++ b/test/wasm2js/float-ops.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/float_literals-modified.2asm.js b/test/wasm2js/float_literals-modified.2asm.js index aaa086d83..f0bf16baf 100644 --- a/test/wasm2js/float_literals-modified.2asm.js +++ b/test/wasm2js/float_literals-modified.2asm.js @@ -18,7 +18,8 @@ import { setTempRet0 } from 'env'; f32ScratchView[2] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/float_literals-modified.2asm.js.opt b/test/wasm2js/float_literals-modified.2asm.js.opt index 9ae915a51..03587e00e 100644 --- a/test/wasm2js/float_literals-modified.2asm.js.opt +++ b/test/wasm2js/float_literals-modified.2asm.js.opt @@ -14,7 +14,8 @@ import { setTempRet0 } from 'env'; f64ScratchView[0] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/float_misc.2asm.js b/test/wasm2js/float_misc.2asm.js index bbf3b8975..ab29ed020 100644 --- a/test/wasm2js/float_misc.2asm.js +++ b/test/wasm2js/float_misc.2asm.js @@ -29,7 +29,8 @@ f32ScratchView[2] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/forward.2asm.js b/test/wasm2js/forward.2asm.js index 1dff26c05..95203a423 100644 --- a/test/wasm2js/forward.2asm.js +++ b/test/wasm2js/forward.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/func-ptr-offset.2asm.js b/test/wasm2js/func-ptr-offset.2asm.js index 48156f91f..3f3e2b028 100644 --- a/test/wasm2js/func-ptr-offset.2asm.js +++ b/test/wasm2js/func-ptr-offset.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/func-ptr-offset.2asm.js.opt b/test/wasm2js/func-ptr-offset.2asm.js.opt index 0666c1ee3..806989efa 100644 --- a/test/wasm2js/func-ptr-offset.2asm.js.opt +++ b/test/wasm2js/func-ptr-offset.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/func_ptrs.2asm.js b/test/wasm2js/func_ptrs.2asm.js index eef4acd32..0adb50fdb 100644 --- a/test/wasm2js/func_ptrs.2asm.js +++ b/test/wasm2js/func_ptrs.2asm.js @@ -1,6 +1,7 @@ import { print_i32 } from 'spectest'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -50,7 +51,8 @@ export var two = retasmFunc.two; export var three = retasmFunc.three; export var four = retasmFunc.four; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -106,7 +108,8 @@ var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } export var callt = retasmFunc.callt; export var callu = retasmFunc.callu; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/get-set-local.2asm.js b/test/wasm2js/get-set-local.2asm.js index cfd7e65cd..315b5143e 100644 --- a/test/wasm2js/get-set-local.2asm.js +++ b/test/wasm2js/get-set-local.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/get-set-local.2asm.js.opt b/test/wasm2js/get-set-local.2asm.js.opt index 9a6cb0757..c457a4b90 100644 --- a/test/wasm2js/get-set-local.2asm.js.opt +++ b/test/wasm2js/get-set-local.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/get_local.2asm.js b/test/wasm2js/get_local.2asm.js index bac4f7538..bdc8a6c72 100644 --- a/test/wasm2js/get_local.2asm.js +++ b/test/wasm2js/get_local.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/global_i64.2asm.js b/test/wasm2js/global_i64.2asm.js index 85c7a8cdf..6c6f7cc94 100644 --- a/test/wasm2js/global_i64.2asm.js +++ b/test/wasm2js/global_i64.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/global_i64.2asm.js.opt b/test/wasm2js/global_i64.2asm.js.opt index fd42701a3..2ae651690 100644 --- a/test/wasm2js/global_i64.2asm.js.opt +++ b/test/wasm2js/global_i64.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/grow-memory-tricky.2asm.js b/test/wasm2js/grow-memory-tricky.2asm.js index 44e7d816f..e3acd45e6 100644 --- a/test/wasm2js/grow-memory-tricky.2asm.js +++ b/test/wasm2js/grow-memory-tricky.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/grow-memory-tricky.2asm.js.opt b/test/wasm2js/grow-memory-tricky.2asm.js.opt index 793feef27..1b64e1530 100644 --- a/test/wasm2js/grow-memory-tricky.2asm.js.opt +++ b/test/wasm2js/grow-memory-tricky.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/grow_memory.2asm.js b/test/wasm2js/grow_memory.2asm.js index 62de4bb90..6b5c663fc 100644 --- a/test/wasm2js/grow_memory.2asm.js +++ b/test/wasm2js/grow_memory.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/i32.2asm.js b/test/wasm2js/i32.2asm.js index 2bc41be51..893fe7474 100644 --- a/test/wasm2js/i32.2asm.js +++ b/test/wasm2js/i32.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-add-sub.2asm.js b/test/wasm2js/i64-add-sub.2asm.js index 683c4f299..a9cc11036 100644 --- a/test/wasm2js/i64-add-sub.2asm.js +++ b/test/wasm2js/i64-add-sub.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-add-sub.2asm.js.opt b/test/wasm2js/i64-add-sub.2asm.js.opt index 62f464829..6c992b4b4 100644 --- a/test/wasm2js/i64-add-sub.2asm.js.opt +++ b/test/wasm2js/i64-add-sub.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-ctz.2asm.js b/test/wasm2js/i64-ctz.2asm.js index d799b51b9..77fc303dc 100644 --- a/test/wasm2js/i64-ctz.2asm.js +++ b/test/wasm2js/i64-ctz.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-ctz.2asm.js.opt b/test/wasm2js/i64-ctz.2asm.js.opt index 5fc52a8f0..92a271b76 100644 --- a/test/wasm2js/i64-ctz.2asm.js.opt +++ b/test/wasm2js/i64-ctz.2asm.js.opt @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-lowering.2asm.js b/test/wasm2js/i64-lowering.2asm.js index deaecb161..300ce0766 100644 --- a/test/wasm2js/i64-lowering.2asm.js +++ b/test/wasm2js/i64-lowering.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-lowering.2asm.js.opt b/test/wasm2js/i64-lowering.2asm.js.opt index 6d90214d2..e79c1571c 100644 --- a/test/wasm2js/i64-lowering.2asm.js.opt +++ b/test/wasm2js/i64-lowering.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-rotate.2asm.js b/test/wasm2js/i64-rotate.2asm.js index 22d8a2378..749c2d0b4 100644 --- a/test/wasm2js/i64-rotate.2asm.js +++ b/test/wasm2js/i64-rotate.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-rotate.2asm.js.opt b/test/wasm2js/i64-rotate.2asm.js.opt index 9aeec1118..83232748d 100644 --- a/test/wasm2js/i64-rotate.2asm.js.opt +++ b/test/wasm2js/i64-rotate.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-select.2asm.js b/test/wasm2js/i64-select.2asm.js index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/i64-select.2asm.js +++ b/test/wasm2js/i64-select.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-select.2asm.js.opt b/test/wasm2js/i64-select.2asm.js.opt index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/i64-select.2asm.js.opt +++ b/test/wasm2js/i64-select.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-shifts.2asm.js b/test/wasm2js/i64-shifts.2asm.js index 63de706f9..669412062 100644 --- a/test/wasm2js/i64-shifts.2asm.js +++ b/test/wasm2js/i64-shifts.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/i64-shifts.2asm.js.opt b/test/wasm2js/i64-shifts.2asm.js.opt index 4981ca880..3914b5095 100644 --- a/test/wasm2js/i64-shifts.2asm.js.opt +++ b/test/wasm2js/i64-shifts.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/if_unreachable.2asm.js b/test/wasm2js/if_unreachable.2asm.js index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/if_unreachable.2asm.js +++ b/test/wasm2js/if_unreachable.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/if_unreachable.2asm.js.opt b/test/wasm2js/if_unreachable.2asm.js.opt index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/if_unreachable.2asm.js.opt +++ b/test/wasm2js/if_unreachable.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/indirect-select.2asm.js b/test/wasm2js/indirect-select.2asm.js index 5ae506771..1f279dbc5 100644 --- a/test/wasm2js/indirect-select.2asm.js +++ b/test/wasm2js/indirect-select.2asm.js @@ -1,6 +1,7 @@ import { table } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var FUNCTION_TABLE = env.table; var Math_imul = Math.imul; var Math_fround = Math.fround; diff --git a/test/wasm2js/indirect-select.2asm.js.opt b/test/wasm2js/indirect-select.2asm.js.opt index b4a4752c2..5389157f8 100644 --- a/test/wasm2js/indirect-select.2asm.js.opt +++ b/test/wasm2js/indirect-select.2asm.js.opt @@ -1,6 +1,7 @@ import { table } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var FUNCTION_TABLE = env.table; var Math_imul = Math.imul; var Math_fround = Math.fround; diff --git a/test/wasm2js/int_exprs.2asm.js b/test/wasm2js/int_exprs.2asm.js index b4e212526..2887fec6d 100644 --- a/test/wasm2js/int_exprs.2asm.js +++ b/test/wasm2js/int_exprs.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -238,7 +239,8 @@ export var i64_no_fold_cmp_s_offset = retasmFunc.i64_no_fold_cmp_s_offset; export var i64_no_fold_cmp_u_offset = retasmFunc.i64_no_fold_cmp_u_offset; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -321,7 +323,8 @@ var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }, export var i64_no_fold_wrap_extend_s = retasmFunc.i64_no_fold_wrap_extend_s; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -403,7 +406,8 @@ var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }, export var i64_no_fold_wrap_extend_u = retasmFunc.i64_no_fold_wrap_extend_u; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -600,7 +604,8 @@ export var i64_no_fold_shl_shr_s = retasmFunc.i64_no_fold_shl_shr_s; export var i64_no_fold_shl_shr_u = retasmFunc.i64_no_fold_shl_shr_u; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -797,7 +802,8 @@ export var i64_no_fold_shr_s_shl = retasmFunc.i64_no_fold_shr_s_shl; export var i64_no_fold_shr_u_shl = retasmFunc.i64_no_fold_shr_u_shl; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -1609,7 +1615,8 @@ export var i64_no_fold_div_s_mul = retasmFunc.i64_no_fold_div_s_mul; export var i64_no_fold_div_u_mul = retasmFunc.i64_no_fold_div_u_mul; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -2327,7 +2334,8 @@ export var i64_no_fold_div_s_self = retasmFunc.i64_no_fold_div_s_self; export var i64_no_fold_div_u_self = retasmFunc.i64_no_fold_div_u_self; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -3027,7 +3035,8 @@ export var i64_no_fold_rem_s_self = retasmFunc.i64_no_fold_rem_s_self; export var i64_no_fold_rem_u_self = retasmFunc.i64_no_fold_rem_u_self; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -3839,7 +3848,8 @@ export var i64_no_fold_mul_div_s = retasmFunc.i64_no_fold_mul_div_s; export var i64_no_fold_mul_div_u = retasmFunc.i64_no_fold_mul_div_u; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -4491,7 +4501,8 @@ export var i32_no_fold_div_s_2 = retasmFunc.i32_no_fold_div_s_2; export var i64_no_fold_div_s_2 = retasmFunc.i64_no_fold_div_s_2; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -5125,7 +5136,8 @@ export var i32_no_fold_rem_s_2 = retasmFunc.i32_no_fold_rem_s_2; export var i64_no_fold_rem_s_2 = retasmFunc.i64_no_fold_rem_s_2; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -5843,7 +5855,8 @@ export var i64_div_s_0 = retasmFunc.i64_div_s_0; export var i64_div_u_0 = retasmFunc.i64_div_u_0; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -6561,7 +6574,8 @@ export var i64_div_s_3 = retasmFunc.i64_div_s_3; export var i64_div_u_3 = retasmFunc.i64_div_u_3; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -7279,7 +7293,8 @@ export var i64_div_s_5 = retasmFunc.i64_div_s_5; export var i64_div_u_5 = retasmFunc.i64_div_u_5; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -7997,7 +8012,8 @@ export var i64_div_s_7 = retasmFunc.i64_div_s_7; export var i64_div_u_7 = retasmFunc.i64_div_u_7; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -8697,7 +8713,8 @@ export var i64_rem_s_3 = retasmFunc.i64_rem_s_3; export var i64_rem_u_3 = retasmFunc.i64_rem_u_3; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -9397,7 +9414,8 @@ export var i64_rem_s_5 = retasmFunc.i64_rem_s_5; export var i64_rem_u_5 = retasmFunc.i64_rem_u_5; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -10097,7 +10115,8 @@ export var i64_rem_s_7 = retasmFunc.i64_rem_s_7; export var i64_rem_u_7 = retasmFunc.i64_rem_u_7; import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/labels.2asm.js b/test/wasm2js/labels.2asm.js index 4841f82f1..8026a56c7 100644 --- a/test/wasm2js/labels.2asm.js +++ b/test/wasm2js/labels.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/left-to-right.2asm.js b/test/wasm2js/left-to-right.2asm.js index 66cc39443..491c8c39a 100644 --- a/test/wasm2js/left-to-right.2asm.js +++ b/test/wasm2js/left-to-right.2asm.js @@ -26,7 +26,8 @@ f32ScratchView[2] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/minified-memory.2asm.js b/test/wasm2js/minified-memory.2asm.js index 657ef011b..f8643a54d 100644 --- a/test/wasm2js/minified-memory.2asm.js +++ b/test/wasm2js/minified-memory.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.a; var buffer = memory.buffer; memory.grow = __wasm_memory_grow; diff --git a/test/wasm2js/minified-memory.2asm.js.opt b/test/wasm2js/minified-memory.2asm.js.opt index 6a3e3a5d9..298e015df 100644 --- a/test/wasm2js/minified-memory.2asm.js.opt +++ b/test/wasm2js/minified-memory.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var memory = env.a; var buffer = memory.buffer; memory.grow = __wasm_memory_grow; diff --git a/test/wasm2js/minus_minus.2asm.js b/test/wasm2js/minus_minus.2asm.js index 569cbbc3e..1e09c55ef 100644 --- a/test/wasm2js/minus_minus.2asm.js +++ b/test/wasm2js/minus_minus.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/minus_minus.2asm.js.opt b/test/wasm2js/minus_minus.2asm.js.opt index 9eea55865..d3b1b08f9 100644 --- a/test/wasm2js/minus_minus.2asm.js.opt +++ b/test/wasm2js/minus_minus.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/nested-selects.2asm.js b/test/wasm2js/nested-selects.2asm.js index 458eb7456..a6396c2b1 100644 --- a/test/wasm2js/nested-selects.2asm.js +++ b/test/wasm2js/nested-selects.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/nested-selects.2asm.js.opt b/test/wasm2js/nested-selects.2asm.js.opt index 1bdeb971a..c2d980fd1 100644 --- a/test/wasm2js/nested-selects.2asm.js.opt +++ b/test/wasm2js/nested-selects.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/ordering.2asm.js b/test/wasm2js/ordering.2asm.js index 00a003ee9..832ff0d60 100644 --- a/test/wasm2js/ordering.2asm.js +++ b/test/wasm2js/ordering.2asm.js @@ -1,6 +1,7 @@ import { table } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var FUNCTION_TABLE = env.table; var Math_imul = Math.imul; var Math_fround = Math.fround; diff --git a/test/wasm2js/ordering.2asm.js.opt b/test/wasm2js/ordering.2asm.js.opt index c36f62261..d25472282 100644 --- a/test/wasm2js/ordering.2asm.js.opt +++ b/test/wasm2js/ordering.2asm.js.opt @@ -1,6 +1,7 @@ import { table } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var FUNCTION_TABLE = env.table; var Math_imul = Math.imul; var Math_fround = Math.fround; diff --git a/test/wasm2js/reinterpret.2asm.js b/test/wasm2js/reinterpret.2asm.js index 446f23479..84cde1611 100644 --- a/test/wasm2js/reinterpret.2asm.js +++ b/test/wasm2js/reinterpret.2asm.js @@ -29,7 +29,8 @@ return f32ScratchView[2]; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/reinterpret.2asm.js.opt b/test/wasm2js/reinterpret.2asm.js.opt index f8d27101b..0fff7b749 100644 --- a/test/wasm2js/reinterpret.2asm.js.opt +++ b/test/wasm2js/reinterpret.2asm.js.opt @@ -21,7 +21,8 @@ f64ScratchView[0] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/reinterpret_scratch.2asm.js b/test/wasm2js/reinterpret_scratch.2asm.js index b2c2a741b..3374c0221 100644 --- a/test/wasm2js/reinterpret_scratch.2asm.js +++ b/test/wasm2js/reinterpret_scratch.2asm.js @@ -18,7 +18,8 @@ f32ScratchView[2] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/reinterpret_scratch.2asm.js.opt b/test/wasm2js/reinterpret_scratch.2asm.js.opt index cf0bb9a04..2841115c0 100644 --- a/test/wasm2js/reinterpret_scratch.2asm.js.opt +++ b/test/wasm2js/reinterpret_scratch.2asm.js.opt @@ -14,7 +14,8 @@ f64ScratchView[0] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/set_local.2asm.js b/test/wasm2js/set_local.2asm.js index 01d504a9b..bbbe10057 100644 --- a/test/wasm2js/set_local.2asm.js +++ b/test/wasm2js/set_local.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/sign_ext.2asm.js b/test/wasm2js/sign_ext.2asm.js index 175ff0aba..eb8489991 100644 --- a/test/wasm2js/sign_ext.2asm.js +++ b/test/wasm2js/sign_ext.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/sign_ext.2asm.js.opt b/test/wasm2js/sign_ext.2asm.js.opt index d4d572c1b..deb83da63 100644 --- a/test/wasm2js/sign_ext.2asm.js.opt +++ b/test/wasm2js/sign_ext.2asm.js.opt @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/stack-modified.2asm.js b/test/wasm2js/stack-modified.2asm.js index 26b8bc26b..c77555e3b 100644 --- a/test/wasm2js/stack-modified.2asm.js +++ b/test/wasm2js/stack-modified.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/stack-modified.2asm.js.opt b/test/wasm2js/stack-modified.2asm.js.opt index 4944c5046..022279d36 100644 --- a/test/wasm2js/stack-modified.2asm.js.opt +++ b/test/wasm2js/stack-modified.2asm.js.opt @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/start_func.2asm.js b/test/wasm2js/start_func.2asm.js index f3694708a..c1e37ab70 100644 --- a/test/wasm2js/start_func.2asm.js +++ b/test/wasm2js/start_func.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/start_func.2asm.js.opt b/test/wasm2js/start_func.2asm.js.opt index 17e43c880..f7a43feff 100644 --- a/test/wasm2js/start_func.2asm.js.opt +++ b/test/wasm2js/start_func.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/switch.2asm.js b/test/wasm2js/switch.2asm.js index f0ad66338..0afe9a33f 100644 --- a/test/wasm2js/switch.2asm.js +++ b/test/wasm2js/switch.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/tee_local.2asm.js b/test/wasm2js/tee_local.2asm.js index ad6fc5880..0e94a2b6c 100644 --- a/test/wasm2js/tee_local.2asm.js +++ b/test/wasm2js/tee_local.2asm.js @@ -1,6 +1,7 @@ import { setTempRet0 } from 'env'; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/traps.2asm.js b/test/wasm2js/traps.2asm.js index bf90a8b80..920317cde 100644 --- a/test/wasm2js/traps.2asm.js +++ b/test/wasm2js/traps.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -732,7 +733,8 @@ export var no_dce_i32_div_u = retasmFunc.no_dce_i32_div_u; export var no_dce_i64_div_s = retasmFunc.no_dce_i64_div_s; export var no_dce_i64_div_u = retasmFunc.no_dce_i64_div_u; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -1447,7 +1449,8 @@ export var no_dce_i32_rem_u = retasmFunc.no_dce_i32_rem_u; export var no_dce_i64_rem_s = retasmFunc.no_dce_i64_rem_s; export var no_dce_i64_rem_u = retasmFunc.no_dce_i64_rem_u; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; @@ -1572,7 +1575,8 @@ export var no_dce_i64_trunc_f32_u = retasmFunc.no_dce_i64_trunc_f32_u; export var no_dce_i64_trunc_f64_s = retasmFunc.no_dce_i64_trunc_f64_s; export var no_dce_i64_trunc_f64_u = retasmFunc.no_dce_i64_trunc_f64_u; -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/unaligned.2asm.js b/test/wasm2js/unaligned.2asm.js index 8f8f3673b..aea6e8fbd 100644 --- a/test/wasm2js/unaligned.2asm.js +++ b/test/wasm2js/unaligned.2asm.js @@ -31,7 +31,8 @@ import { setTempRet0 } from 'env'; f32ScratchView[2] = value; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/unaligned.2asm.js.opt b/test/wasm2js/unaligned.2asm.js.opt index 1f0fd6f4c..8c61d3cbd 100644 --- a/test/wasm2js/unaligned.2asm.js.opt +++ b/test/wasm2js/unaligned.2asm.js.opt @@ -27,7 +27,8 @@ import { setTempRet0 } from 'env'; return f32ScratchView[2]; } -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var buffer = new ArrayBuffer(65536); var HEAP8 = new Int8Array(buffer); var HEAP16 = new Int16Array(buffer); diff --git a/test/wasm2js/unary-ops.2asm.js b/test/wasm2js/unary-ops.2asm.js index 703aaf347..a6f305da1 100644 --- a/test/wasm2js/unary-ops.2asm.js +++ b/test/wasm2js/unary-ops.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/unary-ops.2asm.js.opt b/test/wasm2js/unary-ops.2asm.js.opt index 7bb08bde4..473beeb96 100644 --- a/test/wasm2js/unary-ops.2asm.js.opt +++ b/test/wasm2js/unary-ops.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/unreachable-get-cycle.2asm.js b/test/wasm2js/unreachable-get-cycle.2asm.js index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/unreachable-get-cycle.2asm.js +++ b/test/wasm2js/unreachable-get-cycle.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/unreachable-get-cycle.2asm.js.opt b/test/wasm2js/unreachable-get-cycle.2asm.js.opt index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/unreachable-get-cycle.2asm.js.opt +++ b/test/wasm2js/unreachable-get-cycle.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/unreachable-insts.2asm.js b/test/wasm2js/unreachable-insts.2asm.js index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/unreachable-insts.2asm.js +++ b/test/wasm2js/unreachable-insts.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/unreachable-insts.2asm.js.opt b/test/wasm2js/unreachable-insts.2asm.js.opt index 3278e98c7..c605aa3d0 100644 --- a/test/wasm2js/unreachable-insts.2asm.js.opt +++ b/test/wasm2js/unreachable-insts.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/unreachable-later.2asm.js b/test/wasm2js/unreachable-later.2asm.js index 0259a0407..73970d344 100644 --- a/test/wasm2js/unreachable-later.2asm.js +++ b/test/wasm2js/unreachable-later.2asm.js @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; diff --git a/test/wasm2js/unreachable-later.2asm.js.opt b/test/wasm2js/unreachable-later.2asm.js.opt index b557a1692..03c208ff8 100644 --- a/test/wasm2js/unreachable-later.2asm.js.opt +++ b/test/wasm2js/unreachable-later.2asm.js.opt @@ -1,5 +1,6 @@ -function asmFunc(env) { +function asmFunc(importObject) { + var env = importObject.env || importObject; var Math_imul = Math.imul; var Math_fround = Math.fround; var Math_abs = Math.abs; |