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/dynamicLibrary.2asm.js.opt | |
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/dynamicLibrary.2asm.js.opt')
-rw-r--r-- | test/wasm2js/dynamicLibrary.2asm.js.opt | 16 |
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 }; } |