From 80b509cfb8fa35d229643f35e423e6d049ab8849 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 2 May 2019 16:40:20 -0700 Subject: wasm2js: don't emit obviously unnecessary parens (#2080) A minifier would probably remove them later anyhow, but they make reading the code annoying and hard. --- test/wasm2js/int_literals.2asm.js | 132 +++++++++++++------------------------- 1 file changed, 44 insertions(+), 88 deletions(-) (limited to 'test/wasm2js/int_literals.2asm.js') diff --git a/test/wasm2js/int_literals.2asm.js b/test/wasm2js/int_literals.2asm.js index 16fe25b0b..40b79181c 100644 --- a/test/wasm2js/int_literals.2asm.js +++ b/test/wasm2js/int_literals.2asm.js @@ -141,15 +141,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -167,15 +163,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -193,15 +185,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -219,15 +207,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -245,15 +229,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -271,15 +251,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -297,15 +273,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -323,15 +295,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -349,15 +317,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -375,15 +339,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; @@ -401,15 +361,11 @@ function asmFunc(global, env, buffer) { i64toi32_i32$3 = 32; i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0; if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) { - { - i64toi32_i32$0 = 0; - $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - } + i64toi32_i32$0 = 0; + $7_1 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; } else { - { - i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; - $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; - } + i64toi32_i32$0 = i64toi32_i32$1 >>> i64toi32_i32$4 | 0; + $7_1 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$1 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0; } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; -- cgit v1.2.3