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/unreachable.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/unreachable.2asm.js')
-rw-r--r-- | test/wasm2js/unreachable.2asm.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/wasm2js/unreachable.2asm.js b/test/wasm2js/unreachable.2asm.js index 83882f6c1..bf8193884 100644 --- a/test/wasm2js/unreachable.2asm.js +++ b/test/wasm2js/unreachable.2asm.js @@ -302,7 +302,7 @@ function asmFunc(global, env, buffer) { function legalstub$26() { var i64toi32_i32$0 = 0, i64toi32_i32$4 = 0, i64toi32_i32$1 = 0, i64toi32_i32$3 = 0, $7_1 = 0, $0 = 0, $0$hi = 0, i64toi32_i32$2 = 0; - i64toi32_i32$0 = $26() | 0; + i64toi32_i32$0 = $26(); i64toi32_i32$1 = i64toi32_i32$HIGH_BITS; $0 = i64toi32_i32$0; $0$hi = i64toi32_i32$1; @@ -323,16 +323,16 @@ function asmFunc(global, env, buffer) { } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; - return $0 | 0; + return $0; } function legalstub$41() { - return +(+Math_fround($41())); + return +$41(); } function legalstub$42() { var i64toi32_i32$0 = 0, i64toi32_i32$4 = 0, i64toi32_i32$1 = 0, i64toi32_i32$3 = 0, $7_1 = 0, $0 = 0, $0$hi = 0, i64toi32_i32$2 = 0; - i64toi32_i32$0 = $42() | 0; + i64toi32_i32$0 = $42(); i64toi32_i32$1 = i64toi32_i32$HIGH_BITS; $0 = i64toi32_i32$0; $0$hi = i64toi32_i32$1; @@ -353,16 +353,16 @@ function asmFunc(global, env, buffer) { } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; - return $0 | 0; + return $0; } function legalstub$47() { - return +(+Math_fround($47())); + return +$47(); } function legalstub$49() { var i64toi32_i32$0 = 0, i64toi32_i32$4 = 0, i64toi32_i32$1 = 0, i64toi32_i32$3 = 0, $7_1 = 0, $0 = 0, $0$hi = 0, i64toi32_i32$2 = 0; - i64toi32_i32$0 = $49() | 0; + i64toi32_i32$0 = $49(); i64toi32_i32$1 = i64toi32_i32$HIGH_BITS; $0 = i64toi32_i32$0; $0$hi = i64toi32_i32$1; @@ -383,7 +383,7 @@ function asmFunc(global, env, buffer) { } setTempRet0($7_1 | 0); i64toi32_i32$0 = $0$hi; - return $0 | 0; + return $0; } var FUNCTION_TABLE = []; |