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/f32_cmp.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/f32_cmp.2asm.js')
-rw-r--r-- | test/wasm2js/f32_cmp.2asm.js | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/test/wasm2js/f32_cmp.2asm.js b/test/wasm2js/f32_cmp.2asm.js index 2a79cdd07..bd272335c 100644 --- a/test/wasm2js/f32_cmp.2asm.js +++ b/test/wasm2js/f32_cmp.2asm.js @@ -58,39 +58,27 @@ function asmFunc(global, env, buffer) { } function legalstub$0($0_1, $1_1) { - $0_1 = +$0_1; - $1_1 = +$1_1; - return $0(Math_fround(Math_fround($0_1)), Math_fround(Math_fround($1_1))) | 0; + return $0(Math_fround($0_1), Math_fround($1_1)); } function legalstub$1($0_1, $1_1) { - $0_1 = +$0_1; - $1_1 = +$1_1; - return $1(Math_fround(Math_fround($0_1)), Math_fround(Math_fround($1_1))) | 0; + return $1(Math_fround($0_1), Math_fround($1_1)); } function legalstub$2($0_1, $1_1) { - $0_1 = +$0_1; - $1_1 = +$1_1; - return $2(Math_fround(Math_fround($0_1)), Math_fround(Math_fround($1_1))) | 0; + return $2(Math_fround($0_1), Math_fround($1_1)); } function legalstub$3($0_1, $1_1) { - $0_1 = +$0_1; - $1_1 = +$1_1; - return $3(Math_fround(Math_fround($0_1)), Math_fround(Math_fround($1_1))) | 0; + return $3(Math_fround($0_1), Math_fround($1_1)); } function legalstub$4($0_1, $1_1) { - $0_1 = +$0_1; - $1_1 = +$1_1; - return $4(Math_fround(Math_fround($0_1)), Math_fround(Math_fround($1_1))) | 0; + return $4(Math_fround($0_1), Math_fround($1_1)); } function legalstub$5($0_1, $1_1) { - $0_1 = +$0_1; - $1_1 = +$1_1; - return $5(Math_fround(Math_fround($0_1)), Math_fround(Math_fround($1_1))) | 0; + return $5(Math_fround($0_1), Math_fround($1_1)); } var FUNCTION_TABLE = []; |