From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- js/src/jit-test/tests/ion/bug705351.js | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 js/src/jit-test/tests/ion/bug705351.js (limited to 'js/src/jit-test/tests/ion/bug705351.js') diff --git a/js/src/jit-test/tests/ion/bug705351.js b/js/src/jit-test/tests/ion/bug705351.js new file mode 100644 index 0000000000..10073b8de2 --- /dev/null +++ b/js/src/jit-test/tests/ion/bug705351.js @@ -0,0 +1,38 @@ +var a = 1.1; +function f1() { + return a + 0.2; +} +function test1() { + for (var i=0; i<100; i++) { + assertEq(f1(), 1.3); + } + a = 20; + assertEq(f1(), 20.2); +} +test1(); + +function f2(arr) { + return arr[2] + 0.2; +} +function test2() { + var a = [1.1, 2.2, 3.3, 4.4]; + for (var i=0; i<100; i++) { + assertEq(f2(a), 3.5); + } + a[2] = 123; + assertEq(f2(a), 123.2); +} +test2(); + +function f3(arr, idx) { + return arr[idx] + 0.2; +} +function test3() { + var a = [1.1, 2.2, 3.3, 4.4]; + for (var i=0; i<100; i++) { + assertEq(f3(a, 2), 3.5); + } + a[2] = 123; + assertEq(f3(a, 2), 123.2); +} +test3(); -- cgit v1.2.3