diff options
author | Sam Clegg <sbc@chromium.org> | 2020-09-21 16:39:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-21 16:39:46 -0700 |
commit | ee00f647750f23e6c24e67424bafab39b244c835 (patch) | |
tree | e99f91b24cda95a3292eccb92fec09a0e168ca66 /test/wasm2js | |
parent | 4d6e9ea2d1796c984e3ebc38d0b6abdf8049941a (diff) | |
download | binaryen-ee00f647750f23e6c24e67424bafab39b244c835.tar.gz binaryen-ee00f647750f23e6c24e67424bafab39b244c835.tar.bz2 binaryen-ee00f647750f23e6c24e67424bafab39b244c835.zip |
wasm2js: Support exported tables (#3152)
Diffstat (limited to 'test/wasm2js')
110 files changed, 48 insertions, 158 deletions
diff --git a/test/wasm2js/add_div.2asm.js b/test/wasm2js/add_div.2asm.js index 43bee69e1..a0b4e7b37 100644 --- a/test/wasm2js/add_div.2asm.js +++ b/test/wasm2js/add_div.2asm.js @@ -25,7 +25,6 @@ function asmFunc(global, env, buffer) { return (($0 >>> 0) / (100 >>> 0) | 0) + (($0 | 0) / (-100 | 0) | 0) | 0 | 0; } - var FUNCTION_TABLE = []; return { "foo": foo }; diff --git a/test/wasm2js/add_div.2asm.js.opt b/test/wasm2js/add_div.2asm.js.opt index eb313bda1..8ce9da46c 100644 --- a/test/wasm2js/add_div.2asm.js.opt +++ b/test/wasm2js/add_div.2asm.js.opt @@ -25,7 +25,6 @@ function asmFunc(global, env, buffer) { return (($0 | 0) / -100 | 0) + (($0 >>> 0) / 100 | 0) | 0; } - var FUNCTION_TABLE = []; return { "foo": foo }; diff --git a/test/wasm2js/atomic_fence.2asm.js b/test/wasm2js/atomic_fence.2asm.js index b6694daec..76e784147 100644 --- a/test/wasm2js/atomic_fence.2asm.js +++ b/test/wasm2js/atomic_fence.2asm.js @@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/atomic_fence.2asm.js.opt b/test/wasm2js/atomic_fence.2asm.js.opt index 50fe46d11..31bb40ca2 100644 --- a/test/wasm2js/atomic_fence.2asm.js.opt +++ b/test/wasm2js/atomic_fence.2asm.js.opt @@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; return { "atomic_fence": $0 }; diff --git a/test/wasm2js/atomics_32.2asm.js b/test/wasm2js/atomics_32.2asm.js index bbc599423..98e552ca3 100644 --- a/test/wasm2js/atomics_32.2asm.js +++ b/test/wasm2js/atomics_32.2asm.js @@ -119,7 +119,6 @@ function asmFunc(global, env, buffer) { i64toi32_i32$0 = wasm2js_get_stashed_bits() | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/atomics_32.2asm.js.opt b/test/wasm2js/atomics_32.2asm.js.opt index d3b9cd1bb..8be224284 100644 --- a/test/wasm2js/atomics_32.2asm.js.opt +++ b/test/wasm2js/atomics_32.2asm.js.opt @@ -115,7 +115,6 @@ function asmFunc(global, env, buffer) { wasm2js_get_stashed_bits() | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/base64.2asm.js b/test/wasm2js/base64.2asm.js index e31607d1d..c54b71743 100644 --- a/test/wasm2js/base64.2asm.js +++ b/test/wasm2js/base64.2asm.js @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/base64.2asm.js.opt b/test/wasm2js/base64.2asm.js.opt index e31607d1d..c54b71743 100644 --- a/test/wasm2js/base64.2asm.js.opt +++ b/test/wasm2js/base64.2asm.js.opt @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/br.2asm.js b/test/wasm2js/br.2asm.js index d832d45a8..0c88764d3 100644 --- a/test/wasm2js/br.2asm.js +++ b/test/wasm2js/br.2asm.js @@ -654,7 +654,6 @@ function asmFunc(global, env, buffer) { return $0 | 0; } - var FUNCTION_TABLE = []; return { "type_i32": $1, "type_i64": $2, diff --git a/test/wasm2js/br_table.2asm.js b/test/wasm2js/br_table.2asm.js index ad333a0c2..3dec96a3f 100644 --- a/test/wasm2js/br_table.2asm.js +++ b/test/wasm2js/br_table.2asm.js @@ -13351,7 +13351,6 @@ function asmFunc(global, env, buffer) { return $0 | 0; } - var FUNCTION_TABLE = []; return { "type_i32": $1, "type_i64": $2, diff --git a/test/wasm2js/br_table_hoisting.2asm.js b/test/wasm2js/br_table_hoisting.2asm.js index 8d5e45440..45eb9cb76 100644 --- a/test/wasm2js/br_table_hoisting.2asm.js +++ b/test/wasm2js/br_table_hoisting.2asm.js @@ -176,7 +176,6 @@ function asmFunc(global, env, buffer) { zed(-10 | 0); } - var FUNCTION_TABLE = []; return { "foo1": $1, "foo2": $2, diff --git a/test/wasm2js/br_table_hoisting.2asm.js.opt b/test/wasm2js/br_table_hoisting.2asm.js.opt index f28214760..32d9125ae 100644 --- a/test/wasm2js/br_table_hoisting.2asm.js.opt +++ b/test/wasm2js/br_table_hoisting.2asm.js.opt @@ -166,7 +166,6 @@ function asmFunc(global, env, buffer) { zed(-10); } - var FUNCTION_TABLE = []; return { "foo1": $1, "foo2": $2, diff --git a/test/wasm2js/br_table_temp.2asm.js b/test/wasm2js/br_table_temp.2asm.js index 5287d1084..d2acc92cc 100644 --- a/test/wasm2js/br_table_temp.2asm.js +++ b/test/wasm2js/br_table_temp.2asm.js @@ -13197,7 +13197,6 @@ function asmFunc(global, env, buffer) { return $3_1 | 0; } - var FUNCTION_TABLE = []; return { "type_i32": $1, "type_i64": $2, diff --git a/test/wasm2js/br_table_temp.2asm.js.opt b/test/wasm2js/br_table_temp.2asm.js.opt index f588a3430..79b36521d 100644 --- a/test/wasm2js/br_table_temp.2asm.js.opt +++ b/test/wasm2js/br_table_temp.2asm.js.opt @@ -12627,7 +12627,6 @@ function asmFunc(global, env, buffer) { return $0 | 0; } - var FUNCTION_TABLE = []; return { "type_i32": dummy, "type_i64": dummy, diff --git a/test/wasm2js/br_table_to_loop.2asm.js b/test/wasm2js/br_table_to_loop.2asm.js index 9aeda2c89..a1bb85f65 100644 --- a/test/wasm2js/br_table_to_loop.2asm.js +++ b/test/wasm2js/br_table_to_loop.2asm.js @@ -42,7 +42,6 @@ function asmFunc(global, env, buffer) { } } - var FUNCTION_TABLE = []; return { "exp1": $0, "exp2": $1 diff --git a/test/wasm2js/br_table_to_loop.2asm.js.opt b/test/wasm2js/br_table_to_loop.2asm.js.opt index 276135375..f6f21127f 100644 --- a/test/wasm2js/br_table_to_loop.2asm.js.opt +++ b/test/wasm2js/br_table_to_loop.2asm.js.opt @@ -28,7 +28,6 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; return { "exp1": $0, "exp2": $1 diff --git a/test/wasm2js/break-drop.2asm.js b/test/wasm2js/break-drop.2asm.js index 41a005ec2..cfaffe956 100644 --- a/test/wasm2js/break-drop.2asm.js +++ b/test/wasm2js/break-drop.2asm.js @@ -32,7 +32,6 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; return { "br": $0, "br_if": $1, diff --git a/test/wasm2js/bulk-memory.2asm.js b/test/wasm2js/bulk-memory.2asm.js index 379f919fa..3cf4e0dc9 100644 --- a/test/wasm2js/bulk-memory.2asm.js +++ b/test/wasm2js/bulk-memory.2asm.js @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; @@ -75,7 +74,6 @@ function asmFunc(global, env, buffer) { return HEAPU8[$0_1 >> 0] | 0 | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } @@ -158,7 +156,6 @@ function asmFunc(global, env, buffer) { return HEAPU8[$0_1 >> 0] | 0 | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } @@ -241,7 +238,6 @@ function asmFunc(global, env, buffer) { return HEAPU8[$0_1 >> 0] | 0 | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } @@ -355,7 +351,6 @@ function asmFunc(global, env, buffer) { wasm2js_memory_init(1, 0, 0, 0); } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/bulk-memory.2asm.js.opt b/test/wasm2js/bulk-memory.2asm.js.opt index a4da19a5d..db449cd0e 100644 --- a/test/wasm2js/bulk-memory.2asm.js.opt +++ b/test/wasm2js/bulk-memory.2asm.js.opt @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; @@ -75,7 +74,6 @@ function asmFunc(global, env, buffer) { return HEAPU8[$0_1 | 0]; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } @@ -158,7 +156,6 @@ function asmFunc(global, env, buffer) { return HEAPU8[$0_1 | 0]; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } @@ -241,7 +238,6 @@ function asmFunc(global, env, buffer) { return HEAPU8[$0_1 | 0]; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } @@ -331,7 +327,6 @@ function asmFunc(global, env, buffer) { } } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/comments.2asm.js b/test/wasm2js/comments.2asm.js index 81100c40c..295e25fc7 100644 --- a/test/wasm2js/comments.2asm.js +++ b/test/wasm2js/comments.2asm.js @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; @@ -50,7 +49,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/conversions-modified.2asm.js b/test/wasm2js/conversions-modified.2asm.js index 4829bb49f..718cf3d1f 100644 --- a/test/wasm2js/conversions-modified.2asm.js +++ b/test/wasm2js/conversions-modified.2asm.js @@ -597,7 +597,6 @@ function asmFunc(global, env, buffer) { return $1_1 | 0; } - var FUNCTION_TABLE = []; return { "i64_extend_s_i32": legalstub$0, "i64_extend_u_i32": legalstub$1, diff --git a/test/wasm2js/conversions-modified.2asm.js.opt b/test/wasm2js/conversions-modified.2asm.js.opt index 245465e88..c4dddbb84 100644 --- a/test/wasm2js/conversions-modified.2asm.js.opt +++ b/test/wasm2js/conversions-modified.2asm.js.opt @@ -188,7 +188,6 @@ function asmFunc(global, env, buffer) { return $1; } - var FUNCTION_TABLE = []; return { "i64_extend_s_i32": legalstub$0, "i64_extend_u_i32": legalstub$1, diff --git a/test/wasm2js/deterministic.2asm.js b/test/wasm2js/deterministic.2asm.js index 675f9003c..c03a3e93c 100644 --- a/test/wasm2js/deterministic.2asm.js +++ b/test/wasm2js/deterministic.2asm.js @@ -29,7 +29,6 @@ function asmFunc(global, env, buffer) { return 1 | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/deterministic.2asm.js.opt b/test/wasm2js/deterministic.2asm.js.opt index 4f103eda8..a0272b0db 100644 --- a/test/wasm2js/deterministic.2asm.js.opt +++ b/test/wasm2js/deterministic.2asm.js.opt @@ -28,7 +28,6 @@ function asmFunc(global, env, buffer) { return 1; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/dot_import.2asm.js b/test/wasm2js/dot_import.2asm.js index 87b9971ea..07a3a51b1 100644 --- a/test/wasm2js/dot_import.2asm.js +++ b/test/wasm2js/dot_import.2asm.js @@ -26,7 +26,6 @@ function asmFunc(global, env, buffer) { base(); } - var FUNCTION_TABLE = []; return { "exported": $0 }; diff --git a/test/wasm2js/dot_import.2asm.js.opt b/test/wasm2js/dot_import.2asm.js.opt index 87b9971ea..07a3a51b1 100644 --- a/test/wasm2js/dot_import.2asm.js.opt +++ b/test/wasm2js/dot_import.2asm.js.opt @@ -26,7 +26,6 @@ function asmFunc(global, env, buffer) { base(); } - var FUNCTION_TABLE = []; return { "exported": $0 }; diff --git a/test/wasm2js/dynamicLibrary.2asm.js b/test/wasm2js/dynamicLibrary.2asm.js index 9c58da101..13b52d003 100644 --- a/test/wasm2js/dynamicLibrary.2asm.js +++ b/test/wasm2js/dynamicLibrary.2asm.js @@ -1,6 +1,17 @@ import { memoryBase } from 'env'; import { tableBase } from 'env'; +function Table(ret) { + // grow method not included; table is not growable + ret.set = function(i, func) { + this[i] = func; + }; + ret.get = function(i) { + return this[i]; + }; + return ret; +} + function asmFunc(global, env, buffer) { var memory = env.memory; var HEAP8 = new global.Int8Array(buffer); @@ -37,7 +48,7 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; + var FUNCTION_TABLE = new Table(new Array(10)); FUNCTION_TABLE[import$tableBase + 0] = foo; FUNCTION_TABLE[import$tableBase + 1] = bar; function __wasm_memory_size() { @@ -45,7 +56,8 @@ function asmFunc(global, env, buffer) { } return { - "baz": baz + "baz": baz, + "tab": FUNCTION_TABLE }; } diff --git a/test/wasm2js/dynamicLibrary.2asm.js.opt b/test/wasm2js/dynamicLibrary.2asm.js.opt index 71fa441ed..d8f0ec348 100644 --- a/test/wasm2js/dynamicLibrary.2asm.js.opt +++ b/test/wasm2js/dynamicLibrary.2asm.js.opt @@ -1,6 +1,17 @@ import { memoryBase } from 'env'; import { tableBase } from 'env'; +function Table(ret) { + // grow method not included; table is not growable + ret.set = function(i, func) { + this[i] = func; + }; + ret.get = function(i) { + return this[i]; + }; + return ret; +} + function asmFunc(global, env, buffer) { var memory = env.memory; var HEAP8 = new global.Int8Array(buffer); @@ -29,7 +40,7 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; + var FUNCTION_TABLE = new Table(new Array(10)); FUNCTION_TABLE[import$tableBase + 0] = foo; FUNCTION_TABLE[import$tableBase + 1] = foo; function __wasm_memory_size() { @@ -37,7 +48,8 @@ function asmFunc(global, env, buffer) { } return { - "baz": foo + "baz": foo, + "tab": FUNCTION_TABLE }; } diff --git a/test/wasm2js/empty_export.2asm.js b/test/wasm2js/empty_export.2asm.js index cc2bb1e8f..46326ad1e 100644 --- a/test/wasm2js/empty_export.2asm.js +++ b/test/wasm2js/empty_export.2asm.js @@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; return { "$": foo }; diff --git a/test/wasm2js/empty_export.2asm.js.opt b/test/wasm2js/empty_export.2asm.js.opt index cc2bb1e8f..46326ad1e 100644 --- a/test/wasm2js/empty_export.2asm.js.opt +++ b/test/wasm2js/empty_export.2asm.js.opt @@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; return { "$": foo }; diff --git a/test/wasm2js/empty_table.2asm.js b/test/wasm2js/empty_table.2asm.js index e31607d1d..c54b71743 100644 --- a/test/wasm2js/empty_table.2asm.js +++ b/test/wasm2js/empty_table.2asm.js @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/emscripten-grow-no.2asm.js b/test/wasm2js/emscripten-grow-no.2asm.js index dde2dd0ce..96c4c195c 100644 --- a/test/wasm2js/emscripten-grow-no.2asm.js +++ b/test/wasm2js/emscripten-grow-no.2asm.js @@ -1,5 +1,4 @@ -function instantiate(asmLibraryArg, wasmMemory, wasmTable) { - +function instantiate(asmLibraryArg, wasmMemory) { function asmFunc(global, env, buffer) { var memory = env.memory; var HEAP8 = new global.Int8Array(buffer); @@ -26,7 +25,6 @@ function asmFunc(global, env, buffer) { ; // EMSCRIPTEN_END_FUNCS ; - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/emscripten-grow-no.2asm.js.opt b/test/wasm2js/emscripten-grow-no.2asm.js.opt index dde2dd0ce..96c4c195c 100644 --- a/test/wasm2js/emscripten-grow-no.2asm.js.opt +++ b/test/wasm2js/emscripten-grow-no.2asm.js.opt @@ -1,5 +1,4 @@ -function instantiate(asmLibraryArg, wasmMemory, wasmTable) { - +function instantiate(asmLibraryArg, wasmMemory) { function asmFunc(global, env, buffer) { var memory = env.memory; var HEAP8 = new global.Int8Array(buffer); @@ -26,7 +25,6 @@ function asmFunc(global, env, buffer) { ; // EMSCRIPTEN_END_FUNCS ; - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/emscripten-grow-yes.2asm.js b/test/wasm2js/emscripten-grow-yes.2asm.js index f42a1b396..5acd1e0fe 100644 --- a/test/wasm2js/emscripten-grow-yes.2asm.js +++ b/test/wasm2js/emscripten-grow-yes.2asm.js @@ -1,5 +1,4 @@ -function instantiate(asmLibraryArg, wasmMemory, wasmTable) { - +function instantiate(asmLibraryArg, wasmMemory) { function asmFunc(global, env, buffer) { var memory = env.memory; var HEAP8 = new global.Int8Array(buffer); @@ -26,7 +25,6 @@ function asmFunc(global, env, buffer) { ; // EMSCRIPTEN_END_FUNCS ; - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/emscripten-grow-yes.2asm.js.opt b/test/wasm2js/emscripten-grow-yes.2asm.js.opt index f42a1b396..5acd1e0fe 100644 --- a/test/wasm2js/emscripten-grow-yes.2asm.js.opt +++ b/test/wasm2js/emscripten-grow-yes.2asm.js.opt @@ -1,5 +1,4 @@ -function instantiate(asmLibraryArg, wasmMemory, wasmTable) { - +function instantiate(asmLibraryArg, wasmMemory) { function asmFunc(global, env, buffer) { var memory = env.memory; var HEAP8 = new global.Int8Array(buffer); @@ -26,7 +25,6 @@ function asmFunc(global, env, buffer) { ; // EMSCRIPTEN_END_FUNCS ; - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/emscripten.2asm.js b/test/wasm2js/emscripten.2asm.js index 6f1d19bce..5d6e11b85 100644 --- a/test/wasm2js/emscripten.2asm.js +++ b/test/wasm2js/emscripten.2asm.js @@ -1,8 +1,7 @@ -function instantiate(asmLibraryArg, wasmMemory, wasmTable) { - +function instantiate(asmLibraryArg, wasmMemory) { function asmFunc(global, env, buffer) { var memory = env.memory; - var FUNCTION_TABLE = wasmTable; + var FUNCTION_TABLE = env.table; var HEAP8 = new global.Int8Array(buffer); var HEAP16 = new global.Int16Array(buffer); var HEAP32 = new global.Int32Array(buffer); diff --git a/test/wasm2js/emscripten.2asm.js.opt b/test/wasm2js/emscripten.2asm.js.opt index 2661d3c1d..7cd4868b3 100644 --- a/test/wasm2js/emscripten.2asm.js.opt +++ b/test/wasm2js/emscripten.2asm.js.opt @@ -1,8 +1,7 @@ -function instantiate(asmLibraryArg, wasmMemory, wasmTable) { - +function instantiate(asmLibraryArg, wasmMemory) { function asmFunc(global, env, buffer) { var memory = env.memory; - var FUNCTION_TABLE = wasmTable; + var FUNCTION_TABLE = env.table; var HEAP8 = new global.Int8Array(buffer); var HEAP16 = new global.Int16Array(buffer); var HEAP32 = new global.Int32Array(buffer); diff --git a/test/wasm2js/endianness.2asm.js b/test/wasm2js/endianness.2asm.js index 171af7d6c..4de4bb18e 100644 --- a/test/wasm2js/endianness.2asm.js +++ b/test/wasm2js/endianness.2asm.js @@ -649,7 +649,6 @@ function asmFunc(global, env, buffer) { return $2 | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/excess_fallthrough.2asm.js b/test/wasm2js/excess_fallthrough.2asm.js index e8b9352bd..48e67acca 100644 --- a/test/wasm2js/excess_fallthrough.2asm.js +++ b/test/wasm2js/excess_fallthrough.2asm.js @@ -42,7 +42,6 @@ function asmFunc(global, env, buffer) { abort(); } - var FUNCTION_TABLE = []; return { "foo": foo }; diff --git a/test/wasm2js/excess_fallthrough.2asm.js.opt b/test/wasm2js/excess_fallthrough.2asm.js.opt index a805107be..a6d2cc75c 100644 --- a/test/wasm2js/excess_fallthrough.2asm.js.opt +++ b/test/wasm2js/excess_fallthrough.2asm.js.opt @@ -25,7 +25,6 @@ function asmFunc(global, env, buffer) { abort(); } - var FUNCTION_TABLE = []; return { "foo": foo }; diff --git a/test/wasm2js/f32.2asm.js b/test/wasm2js/f32.2asm.js index 20683a5f8..84df7d8ee 100644 --- a/test/wasm2js/f32.2asm.js +++ b/test/wasm2js/f32.2asm.js @@ -104,7 +104,6 @@ function asmFunc(global, env, buffer) { return Math_fround(var$0 < Math_fround(0.0) ? Math_fround(Math_ceil(var$0)) : Math_fround(Math_floor(var$0))); } - var FUNCTION_TABLE = []; return { "add": $0, "sub": $1, diff --git a/test/wasm2js/f32_cmp.2asm.js b/test/wasm2js/f32_cmp.2asm.js index 0a87b29cf..a798b5297 100644 --- a/test/wasm2js/f32_cmp.2asm.js +++ b/test/wasm2js/f32_cmp.2asm.js @@ -56,7 +56,6 @@ function asmFunc(global, env, buffer) { return x >= y | 0; } - var FUNCTION_TABLE = []; return { "eq": $0, "ne": $1, diff --git a/test/wasm2js/f64_cmp.2asm.js b/test/wasm2js/f64_cmp.2asm.js index 49d06b986..47a3d0dc9 100644 --- a/test/wasm2js/f64_cmp.2asm.js +++ b/test/wasm2js/f64_cmp.2asm.js @@ -56,7 +56,6 @@ function asmFunc(global, env, buffer) { return x >= y | 0; } - var FUNCTION_TABLE = []; return { "eq": $0, "ne": $1, diff --git a/test/wasm2js/fac.2asm.js b/test/wasm2js/fac.2asm.js index f66ed55e0..f87a06aa9 100644 --- a/test/wasm2js/fac.2asm.js +++ b/test/wasm2js/fac.2asm.js @@ -572,7 +572,6 @@ function asmFunc(global, env, buffer) { return i64toi32_i32$1 | 0; } - var FUNCTION_TABLE = []; return { "fac_rec": legalstub$0, "fac_rec_named": legalstub$fac_rec_named, diff --git a/test/wasm2js/float-ops.2asm.js b/test/wasm2js/float-ops.2asm.js index 025cbe727..c1b8b29fb 100644 --- a/test/wasm2js/float-ops.2asm.js +++ b/test/wasm2js/float-ops.2asm.js @@ -460,7 +460,6 @@ function asmFunc(global, env, buffer) { return +(+$46(i64toi32_i32$0 | i64toi32_i32$3 | 0 | 0, i64toi32_i32$2 | 0)); } - var FUNCTION_TABLE = []; return { "f32_add": $1, "f32_sub": $2, diff --git a/test/wasm2js/float-ops.2asm.js.opt b/test/wasm2js/float-ops.2asm.js.opt index 17519fc2a..fd740273c 100644 --- a/test/wasm2js/float-ops.2asm.js.opt +++ b/test/wasm2js/float-ops.2asm.js.opt @@ -270,7 +270,6 @@ function asmFunc(global, env, buffer) { return +($0 >>> 0) + +($1_1 >>> 0) * 4294967296.0; } - var FUNCTION_TABLE = []; return { "f32_add": $1, "f32_sub": $2, diff --git a/test/wasm2js/float_literals-modified.2asm.js b/test/wasm2js/float_literals-modified.2asm.js index d75781a88..18821308e 100644 --- a/test/wasm2js/float_literals-modified.2asm.js +++ b/test/wasm2js/float_literals-modified.2asm.js @@ -1091,7 +1091,6 @@ function asmFunc(global, env, buffer) { return $0_1 | 0; } - var FUNCTION_TABLE = []; return { "f32_nan": $0, "f32_positive_nan": $1, diff --git a/test/wasm2js/float_literals-modified.2asm.js.opt b/test/wasm2js/float_literals-modified.2asm.js.opt index b055b21f4..70040d824 100644 --- a/test/wasm2js/float_literals-modified.2asm.js.opt +++ b/test/wasm2js/float_literals-modified.2asm.js.opt @@ -307,7 +307,6 @@ function asmFunc(global, env, buffer) { return $0_1; } - var FUNCTION_TABLE = []; return { "f32_nan": $0, "f32_positive_nan": $0, diff --git a/test/wasm2js/float_misc.2asm.js b/test/wasm2js/float_misc.2asm.js index f5b768e61..794d65675 100644 --- a/test/wasm2js/float_misc.2asm.js +++ b/test/wasm2js/float_misc.2asm.js @@ -274,7 +274,6 @@ function asmFunc(global, env, buffer) { return +(var$0 < 0.0 ? Math_ceil(var$0) : Math_floor(var$0)); } - var FUNCTION_TABLE = []; return { "f32_add": $0, "f32_sub": $1, diff --git a/test/wasm2js/forward.2asm.js b/test/wasm2js/forward.2asm.js index 3d3d5bf9b..04fdbf860 100644 --- a/test/wasm2js/forward.2asm.js +++ b/test/wasm2js/forward.2asm.js @@ -42,7 +42,6 @@ function asmFunc(global, env, buffer) { return $10 | 0; } - var FUNCTION_TABLE = []; return { "even": even, "odd": odd diff --git a/test/wasm2js/func_ptrs.2asm.js b/test/wasm2js/func_ptrs.2asm.js index 97ebf3cb3..927a838b4 100644 --- a/test/wasm2js/func_ptrs.2asm.js +++ b/test/wasm2js/func_ptrs.2asm.js @@ -41,7 +41,6 @@ function asmFunc(global, env, buffer) { print($0 | 0); } - var FUNCTION_TABLE = []; return { "one": $3, "two": $4, diff --git a/test/wasm2js/get-set-local.2asm.js b/test/wasm2js/get-set-local.2asm.js index fab3a1df5..683853437 100644 --- a/test/wasm2js/get-set-local.2asm.js +++ b/test/wasm2js/get-set-local.2asm.js @@ -63,7 +63,6 @@ function asmFunc(global, env, buffer) { return $1($3 | 0, i64toi32_i32$0 | i64toi32_i32$3 | 0 | 0, i64toi32_i32$2 | 0) | 0 | 0; } - var FUNCTION_TABLE = []; return { "check_extend_ui32": legalstub$1 }; diff --git a/test/wasm2js/get-set-local.2asm.js.opt b/test/wasm2js/get-set-local.2asm.js.opt index 4e87d20ff..99a9be9ab 100644 --- a/test/wasm2js/get-set-local.2asm.js.opt +++ b/test/wasm2js/get-set-local.2asm.js.opt @@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) { return !$2 & ($0 | 0) == ($1 | 0); } - var FUNCTION_TABLE = []; return { "check_extend_ui32": legalstub$1 }; diff --git a/test/wasm2js/get_local.2asm.js b/test/wasm2js/get_local.2asm.js index ba566a180..2e7b6ff8c 100644 --- a/test/wasm2js/get_local.2asm.js +++ b/test/wasm2js/get_local.2asm.js @@ -234,7 +234,6 @@ function asmFunc(global, env, buffer) { return +(+$9(i64toi32_i32$0 | i64toi32_i32$3 | 0 | 0, i64toi32_i32$2 | 0, Math_fround($2_1), +$3_1, $4_1 | 0, $5_1 | 0)); } - var FUNCTION_TABLE = []; return { "type_local_i32": $0, "type_local_i64": legalstub$1, diff --git a/test/wasm2js/global_i64.2asm.js b/test/wasm2js/global_i64.2asm.js index 1216d2de4..031db6447 100644 --- a/test/wasm2js/global_i64.2asm.js +++ b/test/wasm2js/global_i64.2asm.js @@ -36,7 +36,6 @@ function asmFunc(global, env, buffer) { f$hi = i64toi32_i32$0; } - var FUNCTION_TABLE = []; return { "exp": $1 }; diff --git a/test/wasm2js/global_i64.2asm.js.opt b/test/wasm2js/global_i64.2asm.js.opt index d57e44121..50542fb8c 100644 --- a/test/wasm2js/global_i64.2asm.js.opt +++ b/test/wasm2js/global_i64.2asm.js.opt @@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; return { "exp": $1 }; diff --git a/test/wasm2js/grow-memory-tricky.2asm.js b/test/wasm2js/grow-memory-tricky.2asm.js index 755b2976b..6e3dc5e63 100644 --- a/test/wasm2js/grow-memory-tricky.2asm.js +++ b/test/wasm2js/grow-memory-tricky.2asm.js @@ -36,7 +36,6 @@ function asmFunc(global, env, buffer) { return __wasm_memory_grow(1 | 0) | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/grow-memory-tricky.2asm.js.opt b/test/wasm2js/grow-memory-tricky.2asm.js.opt index 40a29264e..d0c474560 100644 --- a/test/wasm2js/grow-memory-tricky.2asm.js.opt +++ b/test/wasm2js/grow-memory-tricky.2asm.js.opt @@ -26,7 +26,6 @@ function asmFunc(global, env, buffer) { return HEAP32[0]; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/grow_memory.2asm.js b/test/wasm2js/grow_memory.2asm.js index 3b156ec85..5f8caa925 100644 --- a/test/wasm2js/grow_memory.2asm.js +++ b/test/wasm2js/grow_memory.2asm.js @@ -29,7 +29,6 @@ function asmFunc(global, env, buffer) { return __wasm_memory_size() | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/i32.2asm.js b/test/wasm2js/i32.2asm.js index 1333020f7..f8ea0161d 100644 --- a/test/wasm2js/i32.2asm.js +++ b/test/wasm2js/i32.2asm.js @@ -233,7 +233,6 @@ function asmFunc(global, env, buffer) { return ((-1 << var$2 | 0) & var$0 | 0) >>> var$2 | 0 | (((-1 >>> var$1 | 0) & var$0 | 0) << var$1 | 0) | 0 | 0; } - var FUNCTION_TABLE = []; return { "add": $0, "sub": $1, diff --git a/test/wasm2js/i64-add-sub.2asm.js b/test/wasm2js/i64-add-sub.2asm.js index 8055e41d9..f792d3b6e 100644 --- a/test/wasm2js/i64-add-sub.2asm.js +++ b/test/wasm2js/i64-add-sub.2asm.js @@ -231,7 +231,6 @@ function asmFunc(global, env, buffer) { return $2($11 | 0, i64toi32_i32$0 | 0, $17 | 0, i64toi32_i32$1 | 0, $23 | 0, i64toi32_i32$2 | 0) | 0 | 0; } - var FUNCTION_TABLE = []; return { "check_add_i64": legalstub$1, "check_sub_i64": legalstub$2 diff --git a/test/wasm2js/i64-add-sub.2asm.js.opt b/test/wasm2js/i64-add-sub.2asm.js.opt index a1dfd51f4..24b05c224 100644 --- a/test/wasm2js/i64-add-sub.2asm.js.opt +++ b/test/wasm2js/i64-add-sub.2asm.js.opt @@ -43,7 +43,6 @@ function asmFunc(global, env, buffer) { return ($4 | 0) == ($0 - $2 | 0) & ($5 | 0) == ($1_1 - (($0 >>> 0 < $2 >>> 0) + $3 | 0) | 0); } - var FUNCTION_TABLE = []; return { "check_add_i64": legalstub$1, "check_sub_i64": legalstub$2 diff --git a/test/wasm2js/i64-ctz.2asm.js b/test/wasm2js/i64-ctz.2asm.js index a0ff41079..c90710c8d 100644 --- a/test/wasm2js/i64-ctz.2asm.js +++ b/test/wasm2js/i64-ctz.2asm.js @@ -234,7 +234,6 @@ function asmFunc(global, env, buffer) { return i64toi32_i32$5 | 0; } - var FUNCTION_TABLE = []; return { "a": legalstub$popcnt64, "b": legalstub$ctz64 diff --git a/test/wasm2js/i64-ctz.2asm.js.opt b/test/wasm2js/i64-ctz.2asm.js.opt index b651dae29..44876ac37 100644 --- a/test/wasm2js/i64-ctz.2asm.js.opt +++ b/test/wasm2js/i64-ctz.2asm.js.opt @@ -76,7 +76,6 @@ function asmFunc(global, env, buffer) { return $5; } - var FUNCTION_TABLE = []; return { "a": legalstub$popcnt64, "b": legalstub$ctz64 diff --git a/test/wasm2js/i64-lowering.2asm.js b/test/wasm2js/i64-lowering.2asm.js index 095d31fb0..5a8ce4ecb 100644 --- a/test/wasm2js/i64-lowering.2asm.js +++ b/test/wasm2js/i64-lowering.2asm.js @@ -782,7 +782,6 @@ function asmFunc(global, env, buffer) { return $10($9_1 | 0, i64toi32_i32$1 | 0, $15 | 0, i64toi32_i32$2 | 0) | 0 | 0; } - var FUNCTION_TABLE = []; return { "eq_i64": legalstub$1, "ne_i64": legalstub$2, diff --git a/test/wasm2js/i64-lowering.2asm.js.opt b/test/wasm2js/i64-lowering.2asm.js.opt index f4d940863..f1003e043 100644 --- a/test/wasm2js/i64-lowering.2asm.js.opt +++ b/test/wasm2js/i64-lowering.2asm.js.opt @@ -60,7 +60,6 @@ function asmFunc(global, env, buffer) { return ($1 | 0) == ($3 | 0) & $0 >>> 0 < $2 >>> 0 | $1 >>> 0 < $3 >>> 0; } - var FUNCTION_TABLE = []; return { "eq_i64": legalstub$1, "ne_i64": legalstub$2, diff --git a/test/wasm2js/i64-rotate.2asm.js b/test/wasm2js/i64-rotate.2asm.js index ea2c97427..a219e72b9 100644 --- a/test/wasm2js/i64-rotate.2asm.js +++ b/test/wasm2js/i64-rotate.2asm.js @@ -443,7 +443,6 @@ function asmFunc(global, env, buffer) { return i64toi32_i32$5 | 0; } - var FUNCTION_TABLE = []; return { "rotl": legalstub$1, "rotr": legalstub$2 diff --git a/test/wasm2js/i64-rotate.2asm.js.opt b/test/wasm2js/i64-rotate.2asm.js.opt index a3e2091fc..7b2ff5474 100644 --- a/test/wasm2js/i64-rotate.2asm.js.opt +++ b/test/wasm2js/i64-rotate.2asm.js.opt @@ -122,7 +122,6 @@ function asmFunc(global, env, buffer) { return $0; } - var FUNCTION_TABLE = []; return { "rotl": legalstub$1, "rotr": legalstub$2 diff --git a/test/wasm2js/i64-select.2asm.js b/test/wasm2js/i64-select.2asm.js index e31607d1d..c54b71743 100644 --- a/test/wasm2js/i64-select.2asm.js +++ b/test/wasm2js/i64-select.2asm.js @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/i64-select.2asm.js.opt b/test/wasm2js/i64-select.2asm.js.opt index e31607d1d..c54b71743 100644 --- a/test/wasm2js/i64-select.2asm.js.opt +++ b/test/wasm2js/i64-select.2asm.js.opt @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/i64-shifts.2asm.js b/test/wasm2js/i64-shifts.2asm.js index 5cbd2af8b..6e91b429b 100644 --- a/test/wasm2js/i64-shifts.2asm.js +++ b/test/wasm2js/i64-shifts.2asm.js @@ -248,7 +248,6 @@ function asmFunc(global, env, buffer) { return $2($11 | 0, i64toi32_i32$0 | 0, $17 | 0, i64toi32_i32$1 | 0, $23 | 0, i64toi32_i32$2 | 0) | 0 | 0; } - var FUNCTION_TABLE = []; return { "shl_i64": legalstub$1, "shr_i64": legalstub$2 diff --git a/test/wasm2js/i64-shifts.2asm.js.opt b/test/wasm2js/i64-shifts.2asm.js.opt index f5b50d295..4d3bae5a6 100644 --- a/test/wasm2js/i64-shifts.2asm.js.opt +++ b/test/wasm2js/i64-shifts.2asm.js.opt @@ -64,7 +64,6 @@ function asmFunc(global, env, buffer) { return $2($0, $1_1, $2_1, $4, $5); } - var FUNCTION_TABLE = []; return { "shl_i64": legalstub$1, "shr_i64": legalstub$2 diff --git a/test/wasm2js/if_unreachable.2asm.js b/test/wasm2js/if_unreachable.2asm.js index e31607d1d..c54b71743 100644 --- a/test/wasm2js/if_unreachable.2asm.js +++ b/test/wasm2js/if_unreachable.2asm.js @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/if_unreachable.2asm.js.opt b/test/wasm2js/if_unreachable.2asm.js.opt index e31607d1d..c54b71743 100644 --- a/test/wasm2js/if_unreachable.2asm.js.opt +++ b/test/wasm2js/if_unreachable.2asm.js.opt @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/indirect-select.2asm.js b/test/wasm2js/indirect-select.2asm.js index d190bb082..9ac076ebc 100644 --- a/test/wasm2js/indirect-select.2asm.js +++ b/test/wasm2js/indirect-select.2asm.js @@ -1,6 +1,7 @@ -import { FUNCTION_TABLE } from 'env'; +import { table } from 'env'; function asmFunc(global, env, buffer) { + var FUNCTION_TABLE = env.table; var HEAP8 = new global.Int8Array(buffer); var HEAP16 = new global.Int16Array(buffer); var HEAP32 = new global.Int32Array(buffer); @@ -38,6 +39,6 @@ function asmFunc(global, env, buffer) { } var memasmFunc = new ArrayBuffer(65536); -var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc); +var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); },table},memasmFunc); export var foo_true = retasmFunc.foo_true; export var foo_false = retasmFunc.foo_false; diff --git a/test/wasm2js/indirect-select.2asm.js.opt b/test/wasm2js/indirect-select.2asm.js.opt index 424b91d4a..215e9941f 100644 --- a/test/wasm2js/indirect-select.2asm.js.opt +++ b/test/wasm2js/indirect-select.2asm.js.opt @@ -1,6 +1,7 @@ -import { FUNCTION_TABLE } from 'env'; +import { table } from 'env'; function asmFunc(global, env, buffer) { + var FUNCTION_TABLE = env.table; var HEAP8 = new global.Int8Array(buffer); var HEAP16 = new global.Int16Array(buffer); var HEAP32 = new global.Int32Array(buffer); @@ -38,6 +39,6 @@ function asmFunc(global, env, buffer) { } var memasmFunc = new ArrayBuffer(65536); -var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc); +var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); },table},memasmFunc); export var foo_true = retasmFunc.foo_true; export var foo_false = retasmFunc.foo_false; diff --git a/test/wasm2js/int_exprs.2asm.js b/test/wasm2js/int_exprs.2asm.js index 17267e41e..338ed2de7 100644 --- a/test/wasm2js/int_exprs.2asm.js +++ b/test/wasm2js/int_exprs.2asm.js @@ -229,7 +229,6 @@ function asmFunc(global, env, buffer) { return $3($9 | 0, i64toi32_i32$1 | 0, $15 | 0, i64toi32_i32$2 | 0) | 0 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_cmp_s_offset": $0, "i32_no_fold_cmp_u_offset": $1, @@ -325,7 +324,6 @@ function asmFunc(global, env, buffer) { return $2 | 0; } - var FUNCTION_TABLE = []; return { "i64_no_fold_wrap_extend_s": legalstub$0 }; @@ -414,7 +412,6 @@ function asmFunc(global, env, buffer) { return $2 | 0; } - var FUNCTION_TABLE = []; return { "i64_no_fold_wrap_extend_u": legalstub$0 }; @@ -612,7 +609,6 @@ function asmFunc(global, env, buffer) { return $2_1 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_shl_shr_s": $0, "i32_no_fold_shl_shr_u": $1, @@ -816,7 +812,6 @@ function asmFunc(global, env, buffer) { return $2_1 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_shr_s_shl": $0, "i32_no_fold_shr_u_shl": $1, @@ -1639,7 +1634,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_div_s_mul": $0, "i32_no_fold_div_u_mul": $1, @@ -2368,7 +2362,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_div_s_self": $0, "i32_no_fold_div_u_self": $1, @@ -3079,7 +3072,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_rem_s_self": $0, "i32_no_fold_rem_u_self": $1, @@ -3902,7 +3894,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_mul_div_s": $0, "i32_no_fold_mul_div_u": $1, @@ -4569,7 +4560,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_div_s_2": $0, "i64_no_fold_div_s_2": legalstub$1 @@ -5214,7 +5204,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_rem_s_2": $0, "i64_no_fold_rem_s_2": legalstub$1 @@ -5939,7 +5928,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_div_s_0": $0, "i32_div_u_0": $1, @@ -6668,7 +6656,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_div_s_3": $0, "i32_div_u_3": $1, @@ -7397,7 +7384,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_div_s_5": $0, "i32_div_u_5": $1, @@ -8126,7 +8112,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_div_s_7": $0, "i32_div_u_7": $1, @@ -8837,7 +8822,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_rem_s_3": $0, "i32_rem_u_3": $1, @@ -9548,7 +9532,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_rem_s_5": $0, "i32_rem_u_5": $1, @@ -10259,7 +10242,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_rem_s_7": $0, "i32_rem_u_7": $1, @@ -10926,7 +10908,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "i32_no_fold_div_neg1": $0, "i64_no_fold_div_neg1": legalstub$1 diff --git a/test/wasm2js/labels.2asm.js b/test/wasm2js/labels.2asm.js index ffc776123..d4b1c197e 100644 --- a/test/wasm2js/labels.2asm.js +++ b/test/wasm2js/labels.2asm.js @@ -327,7 +327,6 @@ function asmFunc(global, env, buffer) { return $1_1 + $2_1 | 0 | 0; } - var FUNCTION_TABLE = []; return { "block": $0, "loop1": $1, diff --git a/test/wasm2js/minified-memory.2asm.js b/test/wasm2js/minified-memory.2asm.js index 2077ef8ab..f3a9eda36 100644 --- a/test/wasm2js/minified-memory.2asm.js +++ b/test/wasm2js/minified-memory.2asm.js @@ -25,7 +25,6 @@ function asmFunc(global, env, buffer) { return HEAP32[0 >> 2] | 0 | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/minified-memory.2asm.js.opt b/test/wasm2js/minified-memory.2asm.js.opt index e5fc7e54a..2dadad349 100644 --- a/test/wasm2js/minified-memory.2asm.js.opt +++ b/test/wasm2js/minified-memory.2asm.js.opt @@ -25,7 +25,6 @@ function asmFunc(global, env, buffer) { return HEAP32[0]; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/minus_minus.2asm.js b/test/wasm2js/minus_minus.2asm.js index ae0c605d3..d0b68a755 100644 --- a/test/wasm2js/minus_minus.2asm.js +++ b/test/wasm2js/minus_minus.2asm.js @@ -28,7 +28,6 @@ function asmFunc(global, env, buffer) { $0() | 0; } - var FUNCTION_TABLE = []; return { "func_44_invoker": $1 }; diff --git a/test/wasm2js/minus_minus.2asm.js.opt b/test/wasm2js/minus_minus.2asm.js.opt index 4f791f380..6b2aec5b0 100644 --- a/test/wasm2js/minus_minus.2asm.js.opt +++ b/test/wasm2js/minus_minus.2asm.js.opt @@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; return { "func_44_invoker": $1 }; diff --git a/test/wasm2js/nested-selects.2asm.js b/test/wasm2js/nested-selects.2asm.js index 7f063a7dc..48090a1e4 100644 --- a/test/wasm2js/nested-selects.2asm.js +++ b/test/wasm2js/nested-selects.2asm.js @@ -25,7 +25,6 @@ function asmFunc(global, env, buffer) { return (($0 | 0) < (0 | 0) ? -1 : ($0 | 0) > (0 | 0) ? 1 : 0) | 0; } - var FUNCTION_TABLE = []; return { "sign": $1 }; diff --git a/test/wasm2js/nested-selects.2asm.js.opt b/test/wasm2js/nested-selects.2asm.js.opt index 9bb06d563..8f35477e3 100644 --- a/test/wasm2js/nested-selects.2asm.js.opt +++ b/test/wasm2js/nested-selects.2asm.js.opt @@ -25,7 +25,6 @@ function asmFunc(global, env, buffer) { return (($0 | 0) < 0 ? -1 : ($0 | 0) > 0) | 0; } - var FUNCTION_TABLE = []; return { "sign": $1 }; diff --git a/test/wasm2js/ordering.2asm.js b/test/wasm2js/ordering.2asm.js index f3d879a99..9f452dcd5 100644 --- a/test/wasm2js/ordering.2asm.js +++ b/test/wasm2js/ordering.2asm.js @@ -1,6 +1,7 @@ -import { FUNCTION_TABLE } from 'env'; +import { table } from 'env'; function asmFunc(global, env, buffer) { + var FUNCTION_TABLE = env.table; var HEAP8 = new global.Int8Array(buffer); var HEAP16 = new global.Int16Array(buffer); var HEAP32 = new global.Int32Array(buffer); @@ -61,5 +62,5 @@ function asmFunc(global, env, buffer) { } var memasmFunc = new ArrayBuffer(65536); -var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc); +var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); },table},memasmFunc); export var main = retasmFunc.main; diff --git a/test/wasm2js/ordering.2asm.js.opt b/test/wasm2js/ordering.2asm.js.opt index b319fb5ee..11bc171dd 100644 --- a/test/wasm2js/ordering.2asm.js.opt +++ b/test/wasm2js/ordering.2asm.js.opt @@ -1,6 +1,7 @@ -import { FUNCTION_TABLE } from 'env'; +import { table } from 'env'; function asmFunc(global, env, buffer) { + var FUNCTION_TABLE = env.table; var HEAP8 = new global.Int8Array(buffer); var HEAP16 = new global.Int16Array(buffer); var HEAP32 = new global.Int32Array(buffer); @@ -52,5 +53,5 @@ function asmFunc(global, env, buffer) { } var memasmFunc = new ArrayBuffer(65536); -var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc); +var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); },table},memasmFunc); export var main = retasmFunc.main; diff --git a/test/wasm2js/reinterpret.2asm.js b/test/wasm2js/reinterpret.2asm.js index e237552df..02eaf8469 100644 --- a/test/wasm2js/reinterpret.2asm.js +++ b/test/wasm2js/reinterpret.2asm.js @@ -98,7 +98,6 @@ function asmFunc(global, env, buffer) { return $2(i64toi32_i32$0 | i64toi32_i32$3 | 0 | 0, i64toi32_i32$2 | 0) | 0 | 0; } - var FUNCTION_TABLE = []; return { "i32_roundtrip": $1, "i64_roundtrip": legalstub$2 diff --git a/test/wasm2js/reinterpret.2asm.js.opt b/test/wasm2js/reinterpret.2asm.js.opt index 5015533ba..54f013d25 100644 --- a/test/wasm2js/reinterpret.2asm.js.opt +++ b/test/wasm2js/reinterpret.2asm.js.opt @@ -70,7 +70,6 @@ function asmFunc(global, env, buffer) { return $2($0, $1_1); } - var FUNCTION_TABLE = []; return { "i32_roundtrip": $1, "i64_roundtrip": legalstub$2 diff --git a/test/wasm2js/reinterpret_scratch.2asm.js b/test/wasm2js/reinterpret_scratch.2asm.js index 51c4565f5..032b6f206 100644 --- a/test/wasm2js/reinterpret_scratch.2asm.js +++ b/test/wasm2js/reinterpret_scratch.2asm.js @@ -48,7 +48,6 @@ function asmFunc(global, env, buffer) { return HEAP32[0 >> 2] | 0 | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/reinterpret_scratch.2asm.js.opt b/test/wasm2js/reinterpret_scratch.2asm.js.opt index 03052fa92..2552bbbc8 100644 --- a/test/wasm2js/reinterpret_scratch.2asm.js.opt +++ b/test/wasm2js/reinterpret_scratch.2asm.js.opt @@ -43,7 +43,6 @@ function asmFunc(global, env, buffer) { return HEAP32[0]; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/set_local.2asm.js b/test/wasm2js/set_local.2asm.js index b83b7b9f6..304d2b7a7 100644 --- a/test/wasm2js/set_local.2asm.js +++ b/test/wasm2js/set_local.2asm.js @@ -213,7 +213,6 @@ function asmFunc(global, env, buffer) { return $6_1 | 0; } - var FUNCTION_TABLE = []; return { "type_local_i32": $0, "type_local_i64": $1, diff --git a/test/wasm2js/sign_ext.2asm.js b/test/wasm2js/sign_ext.2asm.js index 02b3c23f9..c1abab59f 100644 --- a/test/wasm2js/sign_ext.2asm.js +++ b/test/wasm2js/sign_ext.2asm.js @@ -30,7 +30,6 @@ function asmFunc(global, env, buffer) { return x << 16 >> 16 | 0; } - var FUNCTION_TABLE = []; return { "test8": $0, "test16": $1 diff --git a/test/wasm2js/sign_ext.2asm.js.opt b/test/wasm2js/sign_ext.2asm.js.opt index d24ab0ca4..9b05256ae 100644 --- a/test/wasm2js/sign_ext.2asm.js.opt +++ b/test/wasm2js/sign_ext.2asm.js.opt @@ -30,7 +30,6 @@ function asmFunc(global, env, buffer) { return $0_1 << 16 >> 16; } - var FUNCTION_TABLE = []; return { "test8": $0, "test16": $1 diff --git a/test/wasm2js/stack-modified.2asm.js b/test/wasm2js/stack-modified.2asm.js index 8070ab4d0..e62f8706f 100644 --- a/test/wasm2js/stack-modified.2asm.js +++ b/test/wasm2js/stack-modified.2asm.js @@ -569,7 +569,6 @@ function asmFunc(global, env, buffer) { return i64toi32_i32$1 | 0; } - var FUNCTION_TABLE = []; return { "fac_expr": legalstub$0, "fac_stack": legalstub$1, diff --git a/test/wasm2js/stack-modified.2asm.js.opt b/test/wasm2js/stack-modified.2asm.js.opt index 2cd863f72..b6c0c61ee 100644 --- a/test/wasm2js/stack-modified.2asm.js.opt +++ b/test/wasm2js/stack-modified.2asm.js.opt @@ -66,7 +66,6 @@ function asmFunc(global, env, buffer) { return $1; } - var FUNCTION_TABLE = []; return { "fac_expr": legalstub$0, "fac_stack": legalstub$0, diff --git a/test/wasm2js/start_func.2asm.js b/test/wasm2js/start_func.2asm.js index 8e9654c86..309bbb814 100644 --- a/test/wasm2js/start_func.2asm.js +++ b/test/wasm2js/start_func.2asm.js @@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) { HEAP32[1 >> 2] = 2; } - var FUNCTION_TABLE = []; foo(); function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; diff --git a/test/wasm2js/start_func.2asm.js.opt b/test/wasm2js/start_func.2asm.js.opt index 97d94a03f..1162e7940 100644 --- a/test/wasm2js/start_func.2asm.js.opt +++ b/test/wasm2js/start_func.2asm.js.opt @@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) { HEAP32[0] = 2; } - var FUNCTION_TABLE = []; foo(); function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; diff --git a/test/wasm2js/switch.2asm.js b/test/wasm2js/switch.2asm.js index 8b6f0223a..91adedb05 100644 --- a/test/wasm2js/switch.2asm.js +++ b/test/wasm2js/switch.2asm.js @@ -182,7 +182,6 @@ function asmFunc(global, env, buffer) { return $2_1 | 0; } - var FUNCTION_TABLE = []; return { "stmt": $0, "expr": legalstub$1, diff --git a/test/wasm2js/tee_local.2asm.js b/test/wasm2js/tee_local.2asm.js index eceeca4d8..c380a863a 100644 --- a/test/wasm2js/tee_local.2asm.js +++ b/test/wasm2js/tee_local.2asm.js @@ -319,7 +319,6 @@ function asmFunc(global, env, buffer) { return +(+$10(i64toi32_i32$0 | i64toi32_i32$3 | 0 | 0, i64toi32_i32$2 | 0, Math_fround($2_1), +$3_1, $4_1 | 0, $5_1 | 0)); } - var FUNCTION_TABLE = []; return { "type_local_i32": $0, "type_local_i64": legalstub$1, diff --git a/test/wasm2js/traps.2asm.js b/test/wasm2js/traps.2asm.js index 4b5dbd084..25acefe76 100644 --- a/test/wasm2js/traps.2asm.js +++ b/test/wasm2js/traps.2asm.js @@ -728,7 +728,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "no_dce_i32_div_s": $0, "no_dce_i32_div_u": $1, @@ -1455,7 +1454,6 @@ function asmFunc(global, env, buffer) { return 32 | 0; } - var FUNCTION_TABLE = []; return { "no_dce_i32_rem_s": $0, "no_dce_i32_rem_u": $1, @@ -1580,7 +1578,6 @@ function asmFunc(global, env, buffer) { ~~i64toi32_i32$0 >>> 0; } - var FUNCTION_TABLE = []; return { "no_dce_i32_trunc_f32_s": $0, "no_dce_i32_trunc_f32_u": $1, @@ -1701,7 +1698,6 @@ function asmFunc(global, env, buffer) { +HEAPF64[i >> 3]; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/unaligned.2asm.js b/test/wasm2js/unaligned.2asm.js index 7bcd22aad..4ea170809 100644 --- a/test/wasm2js/unaligned.2asm.js +++ b/test/wasm2js/unaligned.2asm.js @@ -157,7 +157,6 @@ function asmFunc(global, env, buffer) { return $0_1 | 0; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/unaligned.2asm.js.opt b/test/wasm2js/unaligned.2asm.js.opt index 45627f215..6f2342b71 100644 --- a/test/wasm2js/unaligned.2asm.js.opt +++ b/test/wasm2js/unaligned.2asm.js.opt @@ -110,7 +110,6 @@ function asmFunc(global, env, buffer) { return $0_1; } - var FUNCTION_TABLE = []; function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } diff --git a/test/wasm2js/unary-ops.2asm.js b/test/wasm2js/unary-ops.2asm.js index 9b89164c8..14ce607ba 100644 --- a/test/wasm2js/unary-ops.2asm.js +++ b/test/wasm2js/unary-ops.2asm.js @@ -511,7 +511,6 @@ function asmFunc(global, env, buffer) { return i64toi32_i32$5 | 0; } - var FUNCTION_TABLE = []; return { "i32_popcnt": $1, "check_popcnt_i64": legalstub$2, diff --git a/test/wasm2js/unary-ops.2asm.js.opt b/test/wasm2js/unary-ops.2asm.js.opt index 425e223ff..ef689019b 100644 --- a/test/wasm2js/unary-ops.2asm.js.opt +++ b/test/wasm2js/unary-ops.2asm.js.opt @@ -131,7 +131,6 @@ function asmFunc(global, env, buffer) { return $5; } - var FUNCTION_TABLE = []; return { "i32_popcnt": $1, "check_popcnt_i64": legalstub$2, diff --git a/test/wasm2js/unreachable-get-cycle.2asm.js b/test/wasm2js/unreachable-get-cycle.2asm.js index e31607d1d..c54b71743 100644 --- a/test/wasm2js/unreachable-get-cycle.2asm.js +++ b/test/wasm2js/unreachable-get-cycle.2asm.js @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/unreachable-get-cycle.2asm.js.opt b/test/wasm2js/unreachable-get-cycle.2asm.js.opt index e31607d1d..c54b71743 100644 --- a/test/wasm2js/unreachable-get-cycle.2asm.js.opt +++ b/test/wasm2js/unreachable-get-cycle.2asm.js.opt @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/unreachable-insts.2asm.js b/test/wasm2js/unreachable-insts.2asm.js index e31607d1d..c54b71743 100644 --- a/test/wasm2js/unreachable-insts.2asm.js +++ b/test/wasm2js/unreachable-insts.2asm.js @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/unreachable-insts.2asm.js.opt b/test/wasm2js/unreachable-insts.2asm.js.opt index e31607d1d..c54b71743 100644 --- a/test/wasm2js/unreachable-insts.2asm.js.opt +++ b/test/wasm2js/unreachable-insts.2asm.js.opt @@ -20,7 +20,6 @@ function asmFunc(global, env, buffer) { var abort = env.abort; var nan = global.NaN; var infinity = global.Infinity; - var FUNCTION_TABLE = []; return { }; diff --git a/test/wasm2js/unreachable-later.2asm.js b/test/wasm2js/unreachable-later.2asm.js index f818fb7b1..7fcf87d54 100644 --- a/test/wasm2js/unreachable-later.2asm.js +++ b/test/wasm2js/unreachable-later.2asm.js @@ -66,7 +66,6 @@ function asmFunc(global, env, buffer) { } } - var FUNCTION_TABLE = []; return { "func_50": $0 }; diff --git a/test/wasm2js/unreachable-later.2asm.js.opt b/test/wasm2js/unreachable-later.2asm.js.opt index b0006309f..a7f7e2966 100644 --- a/test/wasm2js/unreachable-later.2asm.js.opt +++ b/test/wasm2js/unreachable-later.2asm.js.opt @@ -39,7 +39,6 @@ function asmFunc(global, env, buffer) { return $0_1 | 0; } - var FUNCTION_TABLE = []; return { "func_50": $0 }; |