summaryrefslogtreecommitdiff
path: root/test/wasm2js/emscripten-grow-no.2asm.js.opt
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-09-05 18:12:26 -0700
committerGitHub <noreply@github.com>2019-09-05 18:12:26 -0700
commita0c77bf09dc561f9857bd44167fb04d571e3036a (patch)
tree26b5469f15742609b7ad7691c11b93f2f0416a55 /test/wasm2js/emscripten-grow-no.2asm.js.opt
parent3ac5416a6b070096fcd26c94fcdb7c0c144c72b4 (diff)
downloadbinaryen-a0c77bf09dc561f9857bd44167fb04d571e3036a.tar.gz
binaryen-a0c77bf09dc561f9857bd44167fb04d571e3036a.tar.bz2
binaryen-a0c77bf09dc561f9857bd44167fb04d571e3036a.zip
[wasm2js] Fix memory.size (#2330)
We emitted the __wasm_memory_size function only when memory growth was enabled, but it can be used without that too. In theory we could only emit it if either memory growth or memory.size is used, but I think we can expect JS minifiers to do that later. Also fix a test suite bug - the check/auto_update script didn't run all the wasm2js tests when you run it with argument wasm2js (it used that as the list of tests, instead of the list of files, which confused me here for a while...).
Diffstat (limited to 'test/wasm2js/emscripten-grow-no.2asm.js.opt')
-rw-r--r--test/wasm2js/emscripten-grow-no.2asm.js.opt4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/wasm2js/emscripten-grow-no.2asm.js.opt b/test/wasm2js/emscripten-grow-no.2asm.js.opt
index 895a54fc2..92a99dfb7 100644
--- a/test/wasm2js/emscripten-grow-no.2asm.js.opt
+++ b/test/wasm2js/emscripten-grow-no.2asm.js.opt
@@ -25,6 +25,10 @@ function asmFunc(global, env, buffer) {
// EMSCRIPTEN_START_FUNCS;
// EMSCRIPTEN_END_FUNCS;
var FUNCTION_TABLE = [];
+ function __wasm_memory_size() {
+ return buffer.byteLength / 65536 | 0;
+ }
+
return {
"memory": Object.create(Object.prototype, {
"grow": {