diff options
author | Alon Zakai <azakai@google.com> | 2019-05-03 13:47:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-03 13:47:49 -0700 |
commit | 415e8b37c2e570117b17394d4910ca57fa2d11d8 (patch) | |
tree | ce7ad2486facf0c2ae29e48075e7e77b3cf1821c /test/wasm2js/emscripten.2asm.js.opt | |
parent | 909ac3410093c0b35b3181abcd44b9fb9ceb4781 (diff) | |
download | binaryen-415e8b37c2e570117b17394d4910ca57fa2d11d8.tar.gz binaryen-415e8b37c2e570117b17394d4910ca57fa2d11d8.tar.bz2 binaryen-415e8b37c2e570117b17394d4910ca57fa2d11d8.zip |
wasm2js: optimize loads (#2085)
When loading a boolean, prefer the signed heap (which is more commonly used, and may be faster).
We never use HEAPU32 (HEAP32 is always enough), just remove it.
Diffstat (limited to 'test/wasm2js/emscripten.2asm.js.opt')
-rw-r--r-- | test/wasm2js/emscripten.2asm.js.opt | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/wasm2js/emscripten.2asm.js.opt b/test/wasm2js/emscripten.2asm.js.opt index 4426d7400..315279a56 100644 --- a/test/wasm2js/emscripten.2asm.js.opt +++ b/test/wasm2js/emscripten.2asm.js.opt @@ -8,7 +8,6 @@ function asmFunc(global, env, buffer) { var HEAP32 = new global.Int32Array(buffer); var HEAPU8 = new global.Uint8Array(buffer); var HEAPU16 = new global.Uint16Array(buffer); - var HEAPU32 = new global.Uint32Array(buffer); var HEAPF32 = new global.Float32Array(buffer); var HEAPF64 = new global.Float64Array(buffer); var Math_imul = global.Math.imul; @@ -67,6 +66,17 @@ function asmFunc(global, env, buffer) { return ($0 ? $0 : HEAP32[16 >> 2]) | 0; } + function bools($0) { + $0 = $0 | 0; + bools(HEAP8[0 | 0] & 1); + bools(HEAP8[0 | 0] & 1); + bools(HEAP16[0 >> 1] & 1); + bools(HEAP16[0 >> 1] & 1); + bools(HEAP32[0 >> 2] & 1); + bools(HEAPU8[0 | 0] & 2); + abort(); + } + // EMSCRIPTEN_END_FUNCS; FUNCTION_TABLE[1] = foo; FUNCTION_TABLE[2] = bar; @@ -77,7 +87,8 @@ function asmFunc(global, env, buffer) { "__growWasmMemory": __growWasmMemory, "exported": internal, "sub_zero": sub_zero, - "select": select + "select": select, + "bools": bools }; } |