summaryrefslogtreecommitdiff
path: root/test/wasm2js/dynamicLibrary.2asm.js.opt
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm2js/dynamicLibrary.2asm.js.opt')
-rw-r--r--test/wasm2js/dynamicLibrary.2asm.js.opt16
1 files changed, 14 insertions, 2 deletions
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
};
}