summaryrefslogtreecommitdiff
path: root/test/wasm2js/emscripten.2asm.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-05-03 13:47:49 -0700
committerGitHub <noreply@github.com>2019-05-03 13:47:49 -0700
commit415e8b37c2e570117b17394d4910ca57fa2d11d8 (patch)
treece7ad2486facf0c2ae29e48075e7e77b3cf1821c /test/wasm2js/emscripten.2asm.js
parent909ac3410093c0b35b3181abcd44b9fb9ceb4781 (diff)
downloadbinaryen-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')
-rw-r--r--test/wasm2js/emscripten.2asm.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/wasm2js/emscripten.2asm.js b/test/wasm2js/emscripten.2asm.js
index 664eb654a..339429be0 100644
--- a/test/wasm2js/emscripten.2asm.js
+++ b/test/wasm2js/emscripten.2asm.js
@@ -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;
@@ -86,6 +85,17 @@ function asmFunc(global, env, buffer) {
return (wasm2js_i32$0 = x, wasm2js_i32$1 = HEAP32[16 >> 2] | 0, wasm2js_i32$2 = x, wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0;
}
+ function bools(x) {
+ x = x | 0;
+ bools((HEAPU8[0 >> 0] | 0) & 1 | 0 | 0) | 0;
+ bools((HEAP8[0 >> 0] | 0) & 1 | 0 | 0) | 0;
+ bools((HEAPU16[0 >> 1] | 0) & 1 | 0 | 0) | 0;
+ bools((HEAP16[0 >> 1] | 0) & 1 | 0 | 0) | 0;
+ bools((HEAP32[0 >> 2] | 0) & 1 | 0 | 0) | 0;
+ bools((HEAPU8[0 >> 0] | 0) & 2 | 0 | 0) | 0;
+ abort();
+ }
+
// EMSCRIPTEN_END_FUNCS;
FUNCTION_TABLE[1] = foo;
FUNCTION_TABLE[2] = bar;
@@ -96,7 +106,8 @@ function asmFunc(global, env, buffer) {
"__growWasmMemory": __growWasmMemory,
"exported": exported,
"sub_zero": sub_zero,
- "select": select
+ "select": select,
+ "bools": bools
};
}