summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/jaeger/recompile/incdec.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/jit-test/tests/jaeger/recompile/incdec.js
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/jaeger/recompile/incdec.js')
-rw-r--r--js/src/jit-test/tests/jaeger/recompile/incdec.js92
1 files changed, 92 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/jaeger/recompile/incdec.js b/js/src/jit-test/tests/jaeger/recompile/incdec.js
new file mode 100644
index 0000000000..93786ba349
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/recompile/incdec.js
@@ -0,0 +1,92 @@
+
+/* Handle recompilation on overflow of inc/dec operations. */
+
+function local()
+{
+ var j = 0x7ffffff0;
+ for (var i = 0; i < 100; i++)
+ j++;
+ assertEq(j, 2147483732);
+}
+local();
+
+function olocal()
+{
+ var j = 0x7ffffff0;
+ for (var i = 0; i < 100; i++) {
+ if (j++ == 5000)
+ break;
+ }
+ assertEq(j, 2147483732);
+}
+olocal();
+
+function arg(j)
+{
+ for (var i = 0; i < 100; i++)
+ j++;
+ assertEq(j, 2147483732);
+}
+arg(0x7ffffff0);
+
+function oarg(j)
+{
+ for (var i = 0; i < 100; i++) {
+ if (j++ == 5000)
+ break;
+ }
+ assertEq(j, 2147483732);
+}
+oarg(0x7ffffff0);
+
+// basic global inc/dec correctness
+var x = 1.23;
+x = x--;
+x = x++;
+x = ++x;
+x = --x;
+assertEq(x, 1.23);
+
+var g = 0x7ffffff0;
+function glob()
+{
+ for (var i = 0; i < 100; i++)
+ g++;
+ assertEq(g, 2147483732);
+}
+glob();
+
+function gname()
+{
+ n = 0x7ffffff0;
+ for (var i = 0; i < 100; i++)
+ n++;
+ assertEq(n, 2147483732);
+}
+gname();
+
+function prop()
+{
+ var v = {f: 0x7ffffff0};
+ for (var i = 0; i < 100; i++)
+ v.f++;
+ assertEq(v.f, 2147483732);
+}
+prop();
+
+function elem(v, f)
+{
+ for (var i = 0; i < 100; i++)
+ v[f]++;
+ assertEq(v.f, 2147483732);
+}
+elem({f: 0x7ffffff0}, "f");
+
+function name()
+{
+ var v = 0x7ffffff0;
+ var i;
+ eval("for (i = 0; i < 100; i++) v++");
+ assertEq(v + 10, 2147483742);
+}
+name();