diff options
Diffstat (limited to 'test/wasm2js')
-rw-r--r-- | test/wasm2js/br.2asm.js | 18 | ||||
-rw-r--r-- | test/wasm2js/br_table.2asm.js | 24 | ||||
-rw-r--r-- | test/wasm2js/br_table_temp.wast | 24 | ||||
-rw-r--r-- | test/wasm2js/deterministic.wast | 4 | ||||
-rw-r--r-- | test/wasm2js/emscripten.wast | 96 | ||||
-rw-r--r-- | test/wasm2js/fac.2asm.js | 54 | ||||
-rw-r--r-- | test/wasm2js/forward.2asm.js | 16 | ||||
-rw-r--r-- | test/wasm2js/if_unreachable.wast | 12 | ||||
-rw-r--r-- | test/wasm2js/stack-modified.wast | 130 | ||||
-rw-r--r-- | test/wasm2js/unreachable-get-cycle.wast | 36 | ||||
-rw-r--r-- | test/wasm2js/unreachable-later.wast | 76 |
11 files changed, 303 insertions, 187 deletions
diff --git a/test/wasm2js/br.2asm.js b/test/wasm2js/br.2asm.js index d9648261b..eb6dedfff 100644 --- a/test/wasm2js/br.2asm.js +++ b/test/wasm2js/br.2asm.js @@ -204,7 +204,7 @@ function asmFunc(imports) { } function $24() { - var $0 = 0, $5_1 = 0; + var $0 = 0, $1_1 = 0; if_ : { $0 = 2; break if_; @@ -215,15 +215,15 @@ function asmFunc(imports) { function $25($0, $1_1) { $0 = $0 | 0; $1_1 = $1_1 | 0; - var $3_1 = 0, $7_1 = 0; + var $3_1 = 0, $5_1 = 0; block : { if ($0) { $3_1 = 3; break block; } else { - $7_1 = $1_1 + $5_1 = $1_1 } - $3_1 = $7_1; + $3_1 = $5_1; } return $3_1 | 0; } @@ -231,17 +231,17 @@ function asmFunc(imports) { function $26($0, $1_1) { $0 = $0 | 0; $1_1 = $1_1 | 0; - var $6_1 = 0, $7_1 = 0; + var $4_1 = 0, $5_1 = 0; block : { if ($0) { - $7_1 = $1_1 + $5_1 = $1_1 } else { - $6_1 = 4; + $4_1 = 4; break block; } - $6_1 = $7_1; + $4_1 = $5_1; } - return $6_1 | 0; + return $4_1 | 0; } function $27($0, $1_1) { diff --git a/test/wasm2js/br_table.2asm.js b/test/wasm2js/br_table.2asm.js index 668391c02..c3fa8e31d 100644 --- a/test/wasm2js/br_table.2asm.js +++ b/test/wasm2js/br_table.2asm.js @@ -12685,7 +12685,7 @@ function asmFunc(imports) { } function $31() { - var $1_1 = 0, $6_1 = 0; + var $1_1 = 0, $2_1 = 0; if_ : { $1_1 = 2; switch (0 | 0) { @@ -12699,7 +12699,7 @@ function asmFunc(imports) { function $32($0, $1_1) { $0 = $0 | 0; $1_1 = $1_1 | 0; - var $4_1 = 0, $8_1 = 0; + var $4_1 = 0, $6_1 = 0; block : { if ($0) { $4_1 = 3; @@ -12708,9 +12708,9 @@ function asmFunc(imports) { break block; }; } else { - $8_1 = $1_1 + $6_1 = $1_1 } - $4_1 = $8_1; + $4_1 = $6_1; } return $4_1 | 0; } @@ -12718,15 +12718,15 @@ function asmFunc(imports) { function $33($0, $1_1) { $0 = $0 | 0; $1_1 = $1_1 | 0; - var $6_1 = 0, $7_1 = 0, $8_1 = 0, $9_1 = 0; + var $4_1 = 0, $5_1 = 0, $6_1 = 0, $7_1 = 0; block : { if_ : { if ($0) { - $9_1 = $1_1 + $7_1 = $1_1 } else { - $6_1 = 4; - $7_1 = $6_1; - $8_1 = $6_1; + $4_1 = 4; + $5_1 = $4_1; + $6_1 = $4_1; switch (0 | 0) { case 0: break block; @@ -12734,11 +12734,11 @@ function asmFunc(imports) { break if_; }; } - $8_1 = $9_1; + $6_1 = $7_1; } - $7_1 = $8_1; + $5_1 = $6_1; } - return $7_1 | 0; + return $5_1 | 0; } function $34($0, $1_1) { diff --git a/test/wasm2js/br_table_temp.wast b/test/wasm2js/br_table_temp.wast index 1ddff07ca..2c49ca9be 100644 --- a/test/wasm2js/br_table_temp.wast +++ b/test/wasm2js/br_table_temp.wast @@ -910,8 +910,12 @@ (block i32 (if i32 (br_table 0 (i32.const 2) (i32.const 0)) - (i32.const 0) - (i32.const 1) + (then + (i32.const 0) + ) + (else + (i32.const 1) + ) ) ) ) @@ -919,8 +923,12 @@ (block i32 (if i32 (local.get 0) - (br_table 1 (i32.const 3) (i32.const 0)) - (local.get 1) + (then + (br_table 1 (i32.const 3) (i32.const 0)) + ) + (else + (local.get 1) + ) ) ) ) @@ -928,8 +936,12 @@ (block i32 (if i32 (local.get 0) - (local.get 1) - (br_table 1 0 (i32.const 4) (i32.const 0)) + (then + (local.get 1) + ) + (else + (br_table 1 0 (i32.const 4) (i32.const 0)) + ) ) ) ) diff --git a/test/wasm2js/deterministic.wast b/test/wasm2js/deterministic.wast index 67caefbad..6e2322201 100644 --- a/test/wasm2js/deterministic.wast +++ b/test/wasm2js/deterministic.wast @@ -7,7 +7,9 @@ (global.get $global$0) (i32.load (i32.const 0)) ) - (unreachable) + (then + (unreachable) + ) ) (i32.const 1) ) diff --git a/test/wasm2js/emscripten.wast b/test/wasm2js/emscripten.wast index 823297476..453c9d312 100644 --- a/test/wasm2js/emscripten.wast +++ b/test/wasm2js/emscripten.wast @@ -75,58 +75,94 @@ (i32.add (i32.const 9) (i32.const 10)) ) (if (i32.eq (i32.load (i32.const 100)) (i32.const 1)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_s (i32.load (i32.const 104)) (i32.const 2)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_u (i32.load (i32.const 108)) (i32.const 3)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.eq (i32.load16_s (i32.const 112)) (i32.const 1)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_s (i32.load16_s (i32.const 116)) (i32.const 2)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_s (i32.load16_u (i32.const 120)) (i32.const 2)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_u (i32.load16_s (i32.const 124)) (i32.const 3)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_u (i32.load16_u (i32.const 128)) (i32.const 3)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_s (i32.load8_s (i32.const 132)) (i32.const 2)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_s (i32.load8_u (i32.const 136)) (i32.const 2)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_u (i32.load8_s (i32.const 140)) (i32.const 3)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.lt_u (i32.load8_u (i32.const 144)) (i32.const 3)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.shr_u (call $bools (i32.const 314159)) (i32.const 7)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.shr_s (call $bools (i32.const 314159)) (i32.const 8)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.trunc_f32_u (call $getf32)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.trunc_f32_s (call $getf32)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.trunc_f64_u (call $getf64)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.trunc_f64_s (call $getf64)) - (call $bar) + (then + (call $bar) + ) ) (if (i32.add @@ -136,7 +172,9 @@ ) (call $geti32) ) - (call $bar) + (then + (call $bar) + ) ) (if (i32.add @@ -146,7 +184,9 @@ (call $geti32) ) ) - (call $bar) + (then + (call $bar) + ) ) (if (i32.add @@ -159,7 +199,9 @@ (call $geti32) ) ) - (call $bar) + (then + (call $bar) + ) ) (if (i32.add @@ -184,7 +226,9 @@ ) ) ) - (call $bar) + (then + (call $bar) + ) ) ) (func $geti32 (result i32) @@ -230,11 +274,15 @@ (drop (call $bools (i32.xor (local.get $x) (i32.const 1)))) (if (i32.xor (local.get $x) (i32.const 1)) - (drop (call $bools (i32.const 2))) + (then + (drop (call $bools (i32.const 2))) + ) ) (if (i32.xor (local.get $x) (i32.const 2)) - (drop (call $bools (i32.const 2))) + (then + (drop (call $bools (i32.const 2))) + ) ) (drop (call $bools (i32.eqz (i32.xor (local.get $x) (i32.const 1))))) (unreachable) diff --git a/test/wasm2js/fac.2asm.js b/test/wasm2js/fac.2asm.js index b1765575f..f87d217ba 100644 --- a/test/wasm2js/fac.2asm.js +++ b/test/wasm2js/fac.2asm.js @@ -17,33 +17,30 @@ function asmFunc(imports) { function $0($0_1, $0$hi) { $0_1 = $0_1 | 0; $0$hi = $0$hi | 0; - var i64toi32_i32$3 = 0, i64toi32_i32$5 = 0, i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, $12 = 0, $12$hi = 0, $8 = 0, $8$hi = 0; - i64toi32_i32$2 = $0_1; + var i64toi32_i32$3 = 0, i64toi32_i32$5 = 0, i64toi32_i32$1 = 0, $8 = 0, $8$hi = 0, $6 = 0, $6$hi = 0; i64toi32_i32$1 = 0; i64toi32_i32$3 = 0; - if ((i64toi32_i32$2 | 0) == (i64toi32_i32$3 | 0) & ($0$hi | 0) == (i64toi32_i32$1 | 0) | 0) { - i64toi32_i32$2 = 0; - $12 = 1; - $12$hi = i64toi32_i32$2; + if (($0_1 | 0) == (i64toi32_i32$3 | 0) & ($0$hi | 0) == (i64toi32_i32$1 | 0) | 0) { + $8 = 1; + $8$hi = 0; } else { - i64toi32_i32$2 = $0$hi; i64toi32_i32$3 = $0_1; i64toi32_i32$1 = 1; i64toi32_i32$5 = (i64toi32_i32$3 >>> 0 < i64toi32_i32$1 >>> 0) + 0 | 0; i64toi32_i32$5 = $0$hi - i64toi32_i32$5 | 0; i64toi32_i32$5 = $0(i64toi32_i32$3 - i64toi32_i32$1 | 0 | 0, i64toi32_i32$5 | 0) | 0; i64toi32_i32$3 = i64toi32_i32$HIGH_BITS; - $8 = i64toi32_i32$5; - $8$hi = i64toi32_i32$3; + $6 = i64toi32_i32$5; + $6$hi = i64toi32_i32$3; i64toi32_i32$3 = $0$hi; - i64toi32_i32$5 = $8$hi; - i64toi32_i32$5 = __wasm_i64_mul($0_1 | 0, i64toi32_i32$3 | 0, $8 | 0, i64toi32_i32$5 | 0) | 0; + i64toi32_i32$5 = $6$hi; + i64toi32_i32$5 = __wasm_i64_mul($0_1 | 0, $0$hi | 0, $6 | 0, i64toi32_i32$5 | 0) | 0; i64toi32_i32$3 = i64toi32_i32$HIGH_BITS; - $12 = i64toi32_i32$5; - $12$hi = i64toi32_i32$3; + $8 = i64toi32_i32$5; + $8$hi = i64toi32_i32$3; } - i64toi32_i32$3 = $12$hi; - i64toi32_i32$5 = $12; + i64toi32_i32$3 = $8$hi; + i64toi32_i32$5 = $8; i64toi32_i32$HIGH_BITS = i64toi32_i32$3; return i64toi32_i32$5 | 0; } @@ -51,33 +48,30 @@ function asmFunc(imports) { function fac_rec_named(n, n$hi) { n = n | 0; n$hi = n$hi | 0; - var i64toi32_i32$3 = 0, i64toi32_i32$5 = 0, i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, $12 = 0, $12$hi = 0, $8 = 0, $8$hi = 0; - i64toi32_i32$2 = n; + var i64toi32_i32$3 = 0, i64toi32_i32$5 = 0, i64toi32_i32$1 = 0, $8 = 0, $8$hi = 0, $6 = 0, $6$hi = 0; i64toi32_i32$1 = 0; i64toi32_i32$3 = 0; - if ((i64toi32_i32$2 | 0) == (i64toi32_i32$3 | 0) & (n$hi | 0) == (i64toi32_i32$1 | 0) | 0) { - i64toi32_i32$2 = 0; - $12 = 1; - $12$hi = i64toi32_i32$2; + if ((n | 0) == (i64toi32_i32$3 | 0) & (n$hi | 0) == (i64toi32_i32$1 | 0) | 0) { + $8 = 1; + $8$hi = 0; } else { - i64toi32_i32$2 = n$hi; i64toi32_i32$3 = n; i64toi32_i32$1 = 1; i64toi32_i32$5 = (i64toi32_i32$3 >>> 0 < i64toi32_i32$1 >>> 0) + 0 | 0; i64toi32_i32$5 = n$hi - i64toi32_i32$5 | 0; i64toi32_i32$5 = fac_rec_named(i64toi32_i32$3 - i64toi32_i32$1 | 0 | 0, i64toi32_i32$5 | 0) | 0; i64toi32_i32$3 = i64toi32_i32$HIGH_BITS; - $8 = i64toi32_i32$5; - $8$hi = i64toi32_i32$3; + $6 = i64toi32_i32$5; + $6$hi = i64toi32_i32$3; i64toi32_i32$3 = n$hi; - i64toi32_i32$5 = $8$hi; - i64toi32_i32$5 = __wasm_i64_mul(n | 0, i64toi32_i32$3 | 0, $8 | 0, i64toi32_i32$5 | 0) | 0; + i64toi32_i32$5 = $6$hi; + i64toi32_i32$5 = __wasm_i64_mul(n | 0, n$hi | 0, $6 | 0, i64toi32_i32$5 | 0) | 0; i64toi32_i32$3 = i64toi32_i32$HIGH_BITS; - $12 = i64toi32_i32$5; - $12$hi = i64toi32_i32$3; + $8 = i64toi32_i32$5; + $8$hi = i64toi32_i32$3; } - i64toi32_i32$3 = $12$hi; - i64toi32_i32$5 = $12; + i64toi32_i32$3 = $8$hi; + i64toi32_i32$5 = $8; i64toi32_i32$HIGH_BITS = i64toi32_i32$3; return i64toi32_i32$5 | 0; } diff --git a/test/wasm2js/forward.2asm.js b/test/wasm2js/forward.2asm.js index dab073477..053f0f993 100644 --- a/test/wasm2js/forward.2asm.js +++ b/test/wasm2js/forward.2asm.js @@ -12,24 +12,24 @@ function asmFunc(imports) { var Math_sqrt = Math.sqrt; function even(n) { n = n | 0; - var $10 = 0; + var $6 = 0; if ((n | 0) == (0 | 0)) { - $10 = 1 + $6 = 1 } else { - $10 = odd(n - 1 | 0 | 0) | 0 + $6 = odd(n - 1 | 0 | 0) | 0 } - return $10 | 0; + return $6 | 0; } function odd(n) { n = n | 0; - var $10 = 0; + var $6 = 0; if ((n | 0) == (0 | 0)) { - $10 = 0 + $6 = 0 } else { - $10 = even(n - 1 | 0 | 0) | 0 + $6 = even(n - 1 | 0 | 0) | 0 } - return $10 | 0; + return $6 | 0; } return { diff --git a/test/wasm2js/if_unreachable.wast b/test/wasm2js/if_unreachable.wast index 11b41d16e..65cd4e119 100644 --- a/test/wasm2js/if_unreachable.wast +++ b/test/wasm2js/if_unreachable.wast @@ -7,13 +7,17 @@ (i32.const 0) (i32.const 48) ) - (block $label$2 - (br_if $label$2 - (i32.const 0) + (then + (block $label$2 + (br_if $label$2 + (i32.const 0) + ) + (unreachable) ) + ) + (else (unreachable) ) - (unreachable) ) (unreachable) ) diff --git a/test/wasm2js/stack-modified.wast b/test/wasm2js/stack-modified.wast index b3ede2380..1ba9f30a8 100644 --- a/test/wasm2js/stack-modified.wast +++ b/test/wasm2js/stack-modified.wast @@ -21,18 +21,22 @@ (local.get $var$1) (i64.const 0) ) - (br $label$1) - (block $label$5 - (local.set $var$2 - (i64.mul - (local.get $var$1) - (local.get $var$2) + (then + (br $label$1) + ) + (else + (block $label$5 + (local.set $var$2 + (i64.mul + (local.get $var$1) + (local.get $var$2) + ) ) - ) - (local.set $var$1 - (i64.sub - (local.get $var$1) - (i64.const 1) + (local.set $var$1 + (i64.sub + (local.get $var$1) + (i64.const 1) + ) ) ) ) @@ -58,18 +62,22 @@ (local.get $var$1) (i64.const 0) ) - (br $label$1) - (block - (local.set $var$2 - (i64.mul - (local.get $var$1) - (local.get $var$2) + (then + (br $label$1) + ) + (else + (block + (local.set $var$2 + (i64.mul + (local.get $var$1) + (local.get $var$2) + ) ) - ) - (local.set $var$1 - (i64.sub - (local.get $var$1) - (i64.const 1) + (local.set $var$1 + (i64.sub + (local.get $var$1) + (i64.const 1) + ) ) ) ) @@ -95,18 +103,22 @@ (local.get $var$1) (i64.const 0) ) - (br $label$1) - (block - (local.set $var$2 - (i64.mul - (local.get $var$1) - (local.get $var$2) + (then + (br $label$1) + ) + (else + (block + (local.set $var$2 + (i64.mul + (local.get $var$1) + (local.get $var$2) + ) ) - ) - (local.set $var$1 - (i64.sub - (local.get $var$1) - (i64.const 1) + (local.set $var$1 + (i64.sub + (local.get $var$1) + (i64.const 1) + ) ) ) ) @@ -132,18 +144,22 @@ (local.get $var$1) (i64.const 0) ) - (br $label$1) - (block - (local.set $var$2 - (i64.mul - (local.get $var$1) - (local.get $var$2) + (then + (br $label$1) + ) + (else + (block + (local.set $var$2 + (i64.mul + (local.get $var$1) + (local.get $var$2) + ) ) - ) - (local.set $var$1 - (i64.sub - (local.get $var$1) - (i64.const 1) + (local.set $var$1 + (i64.sub + (local.get $var$1) + (i64.const 1) + ) ) ) ) @@ -169,18 +185,22 @@ (local.get $var$1) (i64.const 0) ) - (br $label$1) - (block - (local.set $var$2 - (i64.mul - (local.get $var$1) - (local.get $var$2) + (then + (br $label$1) + ) + (else + (block + (local.set $var$2 + (i64.mul + (local.get $var$1) + (local.get $var$2) + ) ) - ) - (local.set $var$1 - (i64.sub - (local.get $var$1) - (i64.const 1) + (local.set $var$1 + (i64.sub + (local.get $var$1) + (i64.const 1) + ) ) ) ) diff --git a/test/wasm2js/unreachable-get-cycle.wast b/test/wasm2js/unreachable-get-cycle.wast index 6fc714a39..3a25fea72 100644 --- a/test/wasm2js/unreachable-get-cycle.wast +++ b/test/wasm2js/unreachable-get-cycle.wast @@ -10,25 +10,33 @@ ) (i32.const 0) ) - (loop $label$3 - (block $label$4 - (f32.store offset=22 align=2 - (i32.const 0) - (local.get $2) - ) - (drop - (local.tee $2 - (if (result f32) - (i32.const -19666) - (local.get $2) - (unreachable) + (then + (loop $label$3 + (block $label$4 + (f32.store offset=22 align=2 + (i32.const 0) + (local.get $2) + ) + (drop + (local.tee $2 + (if (result f32) + (i32.const -19666) + (then + (local.get $2) + ) + (else + (unreachable) + ) + ) ) ) ) + (br $label$3) ) - (br $label$3) ) - (i64.const 1) + (else + (i64.const 1) + ) ) ) ) diff --git a/test/wasm2js/unreachable-later.wast b/test/wasm2js/unreachable-later.wast index 0af552212..49a7cdb85 100644 --- a/test/wasm2js/unreachable-later.wast +++ b/test/wasm2js/unreachable-later.wast @@ -5,14 +5,18 @@ (func $0 (; 0 ;) (type $0) (param $0 i32) (result i32) (if (global.get $global$0) - (return - (local.get $0) + (then + (return + (local.get $0) + ) ) ) (if (global.get $global$0) - (return - (local.get $0) + (then + (return + (local.get $0) + ) ) ) (global.set $global$0 @@ -29,8 +33,10 @@ (block $label$4 (result i32) (if (global.get $global$0) - (return - (local.get $0) + (then + (return + (local.get $0) + ) ) ) (drop @@ -38,48 +44,70 @@ (block $label$6 (result i32) (if (global.get $global$0) - (return - (local.get $0) + (then + (return + (local.get $0) + ) ) ) (i32.const 65445) ) - (block (result f32) - (if - (global.get $global$0) - (return - (local.get $0) + (then + (block (result f32) + (if + (global.get $global$0) + (then + (return + (local.get $0) + ) + ) ) + (f32.const 0) ) - (f32.const 0) ) - (f32.const 1) + (else + (f32.const 1) + ) ) ) (if (global.get $global$0) - (return - (local.get $0) + (then + (return + (local.get $0) + ) ) ) (i32.const 1) ) - (i32.const 32) - (i32.const 0) + (then + (i32.const 32) + ) + (else + (i32.const 0) + ) ) ) ) (i32.const 1) ) ) - (i32.const 0) - (i32.const 1) + (then + (i32.const 0) + ) + (else + (i32.const 1) + ) + ) + ) + (then + (return + (i32.const -255) ) ) - (return - (i32.const -255) + (else + (unreachable) ) - (unreachable) ) ) ) |