diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/ion/bug861165.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/ion/bug861165.js')
-rw-r--r-- | js/src/jit-test/tests/ion/bug861165.js | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/bug861165.js b/js/src/jit-test/tests/ion/bug861165.js new file mode 100644 index 0000000000..f6b469715b --- /dev/null +++ b/js/src/jit-test/tests/ion/bug861165.js @@ -0,0 +1,83 @@ +// IM has the following fastpaths: +// - constant index (constant) +// - need negative int check (neg) +// - needs hole check (hole) +// So to test everything we have to do: +// constant | neg | hole +// test 1: 0 0 0 +// test 2: 1 0 0 +// test 3: 0 1 0 +// test 4: 1 1 0 +// test 5: 0 0 1 +// test 6: 1 0 1 +// test 7: 0 1 1 +// test 8: 1 1 1 + +function test1(index, a) { + if (index < 0) + index = -index + return index in a; +} +assertEq(test1(1, [1,2]), true); + +function test2(a) { + return 0 in a; +} +assertEq(test2([1,2]), true); + +function test3(index, a) { + return index in a; +} + +var arr3 = []; +arr3["-1073741828"] = 17; +assertEq(test3(-1073741828, arr3), true); + +function test4(a) { + return -1073741828 in a; +} +assertEq(test4(arr3), true); + + +function test5(index, a) { + if (index < 0) + index = -index + return index in a; +} +var arr5 = []; +arr5[0] = 1 +arr5[1] = 1 +arr5[2] = 1 +arr5[4] = 1 +assertEq(test5(1, arr5), true); +assertEq(test5(3, arr5), false); + +function test7a(a) { + return 3 in a; +} +function test7b(a) { + return 4 in a; +} +assertEq(test7a(arr5), false); +assertEq(test7b(arr5), true); + +function test8(index, a) { + return index in a; +} +arr5["-1073741828"] = 17; +assertEq(test8(-1073741828, arr5), true); +assertEq(test8(3, arr5), false); +assertEq(test8(0, arr5), true); + +function test9a(a) { + return 0 in a; +} +function test9b(a) { + return 3 in a; +} +function test9c(a) { + return -1073741828 in a; +} +assertEq(test9a(arr5), true); +assertEq(test9b(arr5), false); +assertEq(test9c(arr5), true); |