summaryrefslogtreecommitdiff
path: root/test/wasm2js
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm2js')
-rw-r--r--test/wasm2js/br_table_to_loop.2asm.js.opt4
-rw-r--r--test/wasm2js/br_table_to_loop.wast3
2 files changed, 6 insertions, 1 deletions
diff --git a/test/wasm2js/br_table_to_loop.2asm.js.opt b/test/wasm2js/br_table_to_loop.2asm.js.opt
index fb8e7f956..cac6dc28c 100644
--- a/test/wasm2js/br_table_to_loop.2asm.js.opt
+++ b/test/wasm2js/br_table_to_loop.2asm.js.opt
@@ -1,4 +1,6 @@
+function wasm2js_trap() { throw new Error('abort'); }
+
function asmFunc(importObject) {
var env = importObject.env || importObject;
var Math_imul = Math.imul;
@@ -14,7 +16,7 @@ function asmFunc(importObject) {
var nan = NaN;
var infinity = Infinity;
function $0() {
- while (1) continue;
+ wasm2js_trap();
}
function $1() {
diff --git a/test/wasm2js/br_table_to_loop.wast b/test/wasm2js/br_table_to_loop.wast
index 83d3702c2..a74d5ffe0 100644
--- a/test/wasm2js/br_table_to_loop.wast
+++ b/test/wasm2js/br_table_to_loop.wast
@@ -1,6 +1,8 @@
(module
(func "exp1"
(block $block
+ ;; An infinite loop. When optimizing, wasm2js enables ignore-implicit-traps
+ ;; and so it can simplify this.
(loop $loop
(br_table $block $loop $block (i32.const 1))
)
@@ -8,6 +10,7 @@
)
(func "exp2"
(block $block
+ ;; A loop that never executes. This can be optimized into a nop.
(loop $loop
(br_table $loop $block $loop (i32.const 1))
)