summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/bigint/bigint-div-bailout.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/bigint/bigint-div-bailout.js')
-rw-r--r--js/src/jit-test/tests/bigint/bigint-div-bailout.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/bigint/bigint-div-bailout.js b/js/src/jit-test/tests/bigint/bigint-div-bailout.js
new file mode 100644
index 0000000000..4e9bf7ff38
--- /dev/null
+++ b/js/src/jit-test/tests/bigint/bigint-div-bailout.js
@@ -0,0 +1,31 @@
+setJitCompilerOption("ion.warmup.trigger", 20);
+
+function testBailout() {
+ function f(v, r) {
+ for (var i = 0; i < 50; ++i) {
+ // Ensure DCE and LICM don't eliminate divisions when the divisor is zero.
+ if (i === 0) {
+ r();
+ }
+ 1n / v;
+ 1n / v;
+ 1n / v;
+ }
+ }
+
+ var result = [];
+ function r() {
+ result.push("ok");
+ }
+
+ do {
+ result.length = 0;
+ try {
+ f(1n, r);
+ f(1n, r);
+ f(0n, r);
+ } catch (e) {}
+ assertEq(result.length, 3);
+ } while (!inIon());
+}
+testBailout();