diff options
author | Alon Zakai <azakai@google.com> | 2021-02-04 21:09:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-04 13:09:24 -0800 |
commit | 9868c3636bf1309c23213dc8ef6de4c036d6c40b (patch) | |
tree | bac00cf95f741ec5bfd52fb625184fbaf3bdfba1 /test/wasm2js | |
parent | 56acee228d93d8ca36e40e4eb659e91d4a058f6f (diff) | |
download | binaryen-9868c3636bf1309c23213dc8ef6de4c036d6c40b.tar.gz binaryen-9868c3636bf1309c23213dc8ef6de4c036d6c40b.tar.bz2 binaryen-9868c3636bf1309c23213dc8ef6de4c036d6c40b.zip |
Add a test for memory.size in wasm2js (#3547)
Support has been there all along, but we didn't have a reference test of it.
Diffstat (limited to 'test/wasm2js')
-rw-r--r-- | test/wasm2js/emscripten-grow-yes.2asm.js | 7 | ||||
-rw-r--r-- | test/wasm2js/emscripten-grow-yes.2asm.js.opt | 7 | ||||
-rw-r--r-- | test/wasm2js/emscripten-grow-yes.wast | 1 |
3 files changed, 13 insertions, 2 deletions
diff --git a/test/wasm2js/emscripten-grow-yes.2asm.js b/test/wasm2js/emscripten-grow-yes.2asm.js index fb0ca4d8e..6f02ce3cc 100644 --- a/test/wasm2js/emscripten-grow-yes.2asm.js +++ b/test/wasm2js/emscripten-grow-yes.2asm.js @@ -50,6 +50,10 @@ function asmFunc(env) { var infinity = Infinity; // EMSCRIPTEN_START_FUNCS ; + function $0() { + return __wasm_memory_size() | 0; + } + // EMSCRIPTEN_END_FUNCS ; bufferView = HEAPU8; @@ -92,7 +96,8 @@ function asmFunc(env) { } } - }) + }), + "get_size": $0 }; } diff --git a/test/wasm2js/emscripten-grow-yes.2asm.js.opt b/test/wasm2js/emscripten-grow-yes.2asm.js.opt index fb0ca4d8e..6f02ce3cc 100644 --- a/test/wasm2js/emscripten-grow-yes.2asm.js.opt +++ b/test/wasm2js/emscripten-grow-yes.2asm.js.opt @@ -50,6 +50,10 @@ function asmFunc(env) { var infinity = Infinity; // EMSCRIPTEN_START_FUNCS ; + function $0() { + return __wasm_memory_size() | 0; + } + // EMSCRIPTEN_END_FUNCS ; bufferView = HEAPU8; @@ -92,7 +96,8 @@ function asmFunc(env) { } } - }) + }), + "get_size": $0 }; } diff --git a/test/wasm2js/emscripten-grow-yes.wast b/test/wasm2js/emscripten-grow-yes.wast index 7323e8efd..905cf694c 100644 --- a/test/wasm2js/emscripten-grow-yes.wast +++ b/test/wasm2js/emscripten-grow-yes.wast @@ -3,5 +3,6 @@ (import "env" "memory" (memory $0 256 1024)) (data (i32.const 1600) "abc") (export "memory" (memory $0)) + (func (export "get_size") (result i32) (memory.size)) ) |