diff options
author | Yury Delendik <ydelendik@mozilla.com> | 2018-09-05 15:38:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-05 15:38:46 -0500 |
commit | 8900ceb7e1adf6b91374c236a30ad7f20b980106 (patch) | |
tree | 68f5e9e33b2184016b7029c9e792ca69e0824c0c /test/wasm2js/nested-selects.2asm.js | |
parent | ff5d6f922555469d59e04268a143a201197cdce7 (diff) | |
download | binaryen-8900ceb7e1adf6b91374c236a30ad7f20b980106.tar.gz binaryen-8900ceb7e1adf6b91374c236a30ad7f20b980106.tar.bz2 binaryen-8900ceb7e1adf6b91374c236a30ad7f20b980106.zip |
[wasm2js] Fix nested selects (#1671)
In wasmjs, the nested selects are trying to use the same temporary locals. The patch reserves temporaries "at right time" to avoid overriding the values.
Diffstat (limited to 'test/wasm2js/nested-selects.2asm.js')
-rw-r--r-- | test/wasm2js/nested-selects.2asm.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/wasm2js/nested-selects.2asm.js b/test/wasm2js/nested-selects.2asm.js new file mode 100644 index 000000000..15e262f9d --- /dev/null +++ b/test/wasm2js/nested-selects.2asm.js @@ -0,0 +1,41 @@ +function asmFunc(global, env, buffer) { + "use asm"; + var HEAP8 = new global.Int8Array(buffer); + var HEAP16 = new global.Int16Array(buffer); + var HEAP32 = new global.Int32Array(buffer); + var HEAPU8 = new global.Uint8Array(buffer); + var HEAPU16 = new global.Uint16Array(buffer); + var HEAPU32 = new global.Uint32Array(buffer); + var HEAPF32 = new global.Float32Array(buffer); + var HEAPF64 = new global.Float64Array(buffer); + var Math_imul = global.Math.imul; + var Math_fround = global.Math.fround; + var Math_abs = global.Math.abs; + var Math_clz32 = global.Math.clz32; + var Math_min = global.Math.min; + var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; + var abort = env.abort; + var nan = global.NaN; + var infinity = global.Infinity; + var i64toi32_i32$HIGH_BITS = 0; + function dummy() { + + } + + function $1($0) { + $0 = $0 | 0; + var wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_i32$2 = 0, wasm2js_i32$3 = 0, wasm2js_i32$4 = 0, wasm2js_i32$5 = 0; + return (wasm2js_i32$0 = 4294967295, wasm2js_i32$1 = (wasm2js_i32$3 = 1, wasm2js_i32$4 = 0, wasm2js_i32$5 = ($0 | 0) > (0 | 0), wasm2js_i32$5 ? wasm2js_i32$3 : wasm2js_i32$4), wasm2js_i32$2 = ($0 | 0) < (0 | 0), wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0; + } + + return { + sign: $1 + }; +} + +const memasmFunc = new ArrayBuffer(65536); +const retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc); +export const sign = retasmFunc.sign; |