diff options
author | Alon Zakai <azakai@google.com> | 2019-04-24 15:27:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-24 15:27:05 -0700 |
commit | c3ed0f176b36a502ef2e1fd915550a808b8d8f0b (patch) | |
tree | 6abff96331025a74e18cfa4f173a997d3c800559 /test/wasm2js/select.2asm.js | |
parent | bc0a605e8864324d40aafbd00e8de0e50240ce26 (diff) | |
download | binaryen-c3ed0f176b36a502ef2e1fd915550a808b8d8f0b.tar.gz binaryen-c3ed0f176b36a502ef2e1fd915550a808b8d8f0b.tar.bz2 binaryen-c3ed0f176b36a502ef2e1fd915550a808b8d8f0b.zip |
wasm2js: more js optimization (#2050)
* Emit ints as signed, so -1 isn't a big unsigned number.
* x - -c (where c is a constant) is larger than x + c in js (but not wasm)
* +(+x) => +x
* Avoid unnecessary coercions on calls, return, load, etc. - we just need coercions when entering or exiting "wasm" (not internally), and on actual operations that need them.
Diffstat (limited to 'test/wasm2js/select.2asm.js')
-rw-r--r-- | test/wasm2js/select.2asm.js | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/test/wasm2js/select.2asm.js b/test/wasm2js/select.2asm.js index 09fab1117..c50a01a47 100644 --- a/test/wasm2js/select.2asm.js +++ b/test/wasm2js/select.2asm.js @@ -78,11 +78,6 @@ function asmFunc(global, env, buffer) { } function legalstub$1($0_1, $1_1, $2_1, $3_1, $4_1) { - $0_1 = $0_1 | 0; - $1_1 = $1_1 | 0; - $2_1 = $2_1 | 0; - $3_1 = $3_1 | 0; - $4_1 = $4_1 | 0; var i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, i64toi32_i32$4 = 0, i64toi32_i32$0 = 0, i64toi32_i32$3 = 0, $22 = 0, $23 = 0, $24 = 0, $7 = 0, $7$hi = 0, $10$hi = 0, $11 = 0, $11$hi = 0, $13 = 0, $13$hi = 0, $16$hi = 0, $17 = 0, $17$hi = 0, $5_1 = 0, $5$hi = 0; i64toi32_i32$0 = 0; $7 = $0_1; @@ -140,7 +135,7 @@ function asmFunc(global, env, buffer) { $17$hi = i64toi32_i32$1; i64toi32_i32$1 = $11$hi; i64toi32_i32$2 = $17$hi; - i64toi32_i32$2 = $1($11 | 0, i64toi32_i32$1 | 0, $17 | 0, i64toi32_i32$2 | 0, $4_1 | 0) | 0; + i64toi32_i32$2 = $1($11, i64toi32_i32$1, $17, i64toi32_i32$2, $4_1); i64toi32_i32$1 = i64toi32_i32$HIGH_BITS; $5_1 = i64toi32_i32$2; $5$hi = i64toi32_i32$1; @@ -161,14 +156,11 @@ function asmFunc(global, env, buffer) { } setTempRet0($24 | 0); i64toi32_i32$2 = $5$hi; - return $5_1 | 0; + return $5_1; } function legalstub$2($0_1, $1_1, $2_1) { - $0_1 = +$0_1; - $1_1 = +$1_1; - $2_1 = $2_1 | 0; - return +(+Math_fround($2(Math_fround(Math_fround($0_1)), Math_fround(Math_fround($1_1)), $2_1 | 0))); + return +$2(Math_fround($0_1), Math_fround($1_1), $2_1); } var FUNCTION_TABLE = []; |