summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/exceptions/ion-loop-phi.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/jit-test/tests/wasm/exceptions/ion-loop-phi.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/wasm/exceptions/ion-loop-phi.js')
-rw-r--r--js/src/jit-test/tests/wasm/exceptions/ion-loop-phi.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/exceptions/ion-loop-phi.js b/js/src/jit-test/tests/wasm/exceptions/ion-loop-phi.js
new file mode 100644
index 0000000000..bdf49ca97b
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/exceptions/ion-loop-phi.js
@@ -0,0 +1,59 @@
+// Finishing a loop will try to minimize phi nodes. We must properly replace
+// phi nodes that escape a loop via catch block control flow patches.
+wasmEvalText(`(module
+ (func)
+ (func (local i32)
+ try
+ loop
+ call 0
+ i32.const 0
+ br_if 0
+ end
+ catch_all
+ end
+ )
+)`);
+
+// Same as above, but ensure that we check every enclosing try block for
+// control flow patches, as delegate can tunnel outwards.
+wasmEvalText(`(module
+ (func)
+ (func (local i32)
+ try
+ try
+ loop
+ call 0
+ i32.const 0
+ br_if 0
+ end
+ delegate 0
+ catch_all
+ end
+ )
+)`);
+
+// Ensure that we check the body block as delegate can target that.
+wasmEvalText(`(module
+ (func)
+ (func (local i32)
+ loop
+ try
+ (; catch patch to try block is added ;)
+ call 0
+ (; br_if ensures we will need a backedge ;)
+ i32.const 0
+ br_if 1
+ (; catch patches are relocated to body ;)
+ delegate 1
+ (; finishing loop backedge must fixup patches stored in body ;)
+ end
+
+ (; add another catch patch to body so that the landing pad will be a
+ join point between two edges, forcing a use of the dangling phi,
+ hitting the debug assertion
+ ;)
+ try
+ call 0
+ delegate 0
+ )
+)`);