diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-04-18 13:06:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-18 13:06:23 -0700 |
commit | a9808ac6982e88262fc652d0634bf17119e1ee5f (patch) | |
tree | d37487959c6a407f92bbb112a0cea79b1eb2633e /test/wasm2js/br_table.2asm.js | |
parent | 8dc68bc96db046127d648644daa89f524a668863 (diff) | |
download | binaryen-a9808ac6982e88262fc652d0634bf17119e1ee5f.tar.gz binaryen-a9808ac6982e88262fc652d0634bf17119e1ee5f.tar.bz2 binaryen-a9808ac6982e88262fc652d0634bf17119e1ee5f.zip |
wasm2js: do not try to be smart with not emitting if braces, the corner cases are tricky (#2026)
leave them for later optimizers/minifiers
Diffstat (limited to 'test/wasm2js/br_table.2asm.js')
-rw-r--r-- | test/wasm2js/br_table.2asm.js | 136 |
1 files changed, 78 insertions, 58 deletions
diff --git a/test/wasm2js/br_table.2asm.js b/test/wasm2js/br_table.2asm.js index 6d80b976f..2a33ce688 100644 --- a/test/wasm2js/br_table.2asm.js +++ b/test/wasm2js/br_table.2asm.js @@ -49681,12 +49681,16 @@ function asmFunc(global, env, buffer) { var $4_1 = 0, $6_1 = 0; block : { if ($0) { - $4_1 = 3; - switch (0 | 0) { - default: - break block; - }; - } else $6_1 = $1_1; + { + $4_1 = 3; + switch (0 | 0) { + default: + break block; + }; + } + } else { + $6_1 = $1_1 + } $4_1 = $6_1; } return $4_1 | 0; @@ -49698,16 +49702,20 @@ function asmFunc(global, env, buffer) { var $4_1 = 0, $5_1 = 0, $6_1 = 0, $7_1 = 0; block : { if_ : { - if ($0) $7_1 = $1_1; else { - $4_1 = 4; - $5_1 = $4_1; - $6_1 = $4_1; - switch (0 | 0) { - case 0: - break block; - default: - break if_; - }; + if ($0) { + $7_1 = $1_1 + } else { + { + $4_1 = 4; + $5_1 = $4_1; + $6_1 = $4_1; + switch (0 | 0) { + case 0: + break block; + default: + break if_; + }; + } } $6_1 = $7_1; } @@ -50190,7 +50198,9 @@ function asmFunc(global, env, buffer) { function __wasm_ctz_i32(var$0) { var$0 = var$0 | 0; - if (var$0) return 31 - Math_clz32((var$0 + 4294967295 | 0) ^ var$0 | 0) | 0 | 0; + if (var$0) { + return 31 - Math_clz32((var$0 + 4294967295 | 0) ^ var$0 | 0) | 0 | 0 + } return 32 | 0; } @@ -50200,35 +50210,43 @@ function asmFunc(global, env, buffer) { var i64toi32_i32$0 = 0, i64toi32_i32$3 = 0, i64toi32_i32$5 = 0, i64toi32_i32$4 = 0, i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, $10_1 = 0, $5$hi = 0, $8$hi = 0; i64toi32_i32$0 = var$0$hi; if (((var$0 | i64toi32_i32$0 | 0 | 0) == (0 | 0) | 0) == (0 | 0)) { - i64toi32_i32$0 = var$0$hi; - i64toi32_i32$2 = var$0; - i64toi32_i32$1 = 4294967295; - i64toi32_i32$3 = 4294967295; - i64toi32_i32$4 = i64toi32_i32$2 + i64toi32_i32$3 | 0; - i64toi32_i32$5 = i64toi32_i32$0 + i64toi32_i32$1 | 0; - if (i64toi32_i32$4 >>> 0 < i64toi32_i32$3 >>> 0) i64toi32_i32$5 = i64toi32_i32$5 + 1 | 0; - $5$hi = i64toi32_i32$5; - i64toi32_i32$5 = var$0$hi; - i64toi32_i32$5 = $5$hi; - i64toi32_i32$0 = i64toi32_i32$4; - i64toi32_i32$2 = var$0$hi; - i64toi32_i32$3 = var$0; - i64toi32_i32$2 = i64toi32_i32$5 ^ i64toi32_i32$2 | 0; - i64toi32_i32$0 = i64toi32_i32$0 ^ i64toi32_i32$3 | 0; - i64toi32_i32$3 = Math_clz32(i64toi32_i32$2); - i64toi32_i32$5 = 0; - if ((i64toi32_i32$3 | 0) == (32 | 0)) $10_1 = Math_clz32(i64toi32_i32$0) + 32 | 0; else $10_1 = i64toi32_i32$3; - $8$hi = i64toi32_i32$5; - i64toi32_i32$5 = 0; - i64toi32_i32$0 = 63; - i64toi32_i32$2 = $8$hi; - i64toi32_i32$3 = $10_1; - i64toi32_i32$1 = i64toi32_i32$0 - i64toi32_i32$3 | 0; - i64toi32_i32$4 = (i64toi32_i32$0 >>> 0 < i64toi32_i32$3 >>> 0) + i64toi32_i32$2 | 0; - i64toi32_i32$4 = i64toi32_i32$5 - i64toi32_i32$4 | 0; - i64toi32_i32$0 = i64toi32_i32$1; - i64toi32_i32$HIGH_BITS = i64toi32_i32$4; - return i64toi32_i32$0 | 0; + { + i64toi32_i32$0 = var$0$hi; + i64toi32_i32$2 = var$0; + i64toi32_i32$1 = 4294967295; + i64toi32_i32$3 = 4294967295; + i64toi32_i32$4 = i64toi32_i32$2 + i64toi32_i32$3 | 0; + i64toi32_i32$5 = i64toi32_i32$0 + i64toi32_i32$1 | 0; + if (i64toi32_i32$4 >>> 0 < i64toi32_i32$3 >>> 0) { + i64toi32_i32$5 = i64toi32_i32$5 + 1 | 0 + } + $5$hi = i64toi32_i32$5; + i64toi32_i32$5 = var$0$hi; + i64toi32_i32$5 = $5$hi; + i64toi32_i32$0 = i64toi32_i32$4; + i64toi32_i32$2 = var$0$hi; + i64toi32_i32$3 = var$0; + i64toi32_i32$2 = i64toi32_i32$5 ^ i64toi32_i32$2 | 0; + i64toi32_i32$0 = i64toi32_i32$0 ^ i64toi32_i32$3 | 0; + i64toi32_i32$3 = Math_clz32(i64toi32_i32$2); + i64toi32_i32$5 = 0; + if ((i64toi32_i32$3 | 0) == (32 | 0)) { + $10_1 = Math_clz32(i64toi32_i32$0) + 32 | 0 + } else { + $10_1 = i64toi32_i32$3 + } + $8$hi = i64toi32_i32$5; + i64toi32_i32$5 = 0; + i64toi32_i32$0 = 63; + i64toi32_i32$2 = $8$hi; + i64toi32_i32$3 = $10_1; + i64toi32_i32$1 = i64toi32_i32$0 - i64toi32_i32$3 | 0; + i64toi32_i32$4 = (i64toi32_i32$0 >>> 0 < i64toi32_i32$3 >>> 0) + i64toi32_i32$2 | 0; + i64toi32_i32$4 = i64toi32_i32$5 - i64toi32_i32$4 | 0; + i64toi32_i32$0 = i64toi32_i32$1; + i64toi32_i32$HIGH_BITS = i64toi32_i32$4; + return i64toi32_i32$0 | 0; + } } i64toi32_i32$0 = 0; i64toi32_i32$4 = 64; @@ -50242,18 +50260,20 @@ function asmFunc(global, env, buffer) { var oldPages = __wasm_current_memory() | 0; var newPages = oldPages + pagesToAdd | 0; if ((oldPages < newPages) && (newPages < 65536)) { - var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536)); - var newHEAP8 = new global.Int8Array(newBuffer); - newHEAP8.set(HEAP8); - HEAP8 = newHEAP8; - HEAP16 = new global.Int16Array(newBuffer); - HEAP32 = new global.Int32Array(newBuffer); - HEAPU8 = new global.Uint8Array(newBuffer); - HEAPU16 = new global.Uint16Array(newBuffer); - HEAPU32 = new global.Uint32Array(newBuffer); - HEAPF32 = new global.Float32Array(newBuffer); - HEAPF64 = new global.Float64Array(newBuffer); - buffer = newBuffer; + { + var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536)); + var newHEAP8 = new global.Int8Array(newBuffer); + newHEAP8.set(HEAP8); + HEAP8 = newHEAP8; + HEAP16 = new global.Int16Array(newBuffer); + HEAP32 = new global.Int32Array(newBuffer); + HEAPU8 = new global.Uint8Array(newBuffer); + HEAPU16 = new global.Uint16Array(newBuffer); + HEAPU32 = new global.Uint32Array(newBuffer); + HEAPF32 = new global.Float32Array(newBuffer); + HEAPF64 = new global.Float64Array(newBuffer); + buffer = newBuffer; + } } return oldPages; } |