diff options
Diffstat (limited to 'js/src/jit-test/tests/ion/bug809021.js')
-rw-r--r-- | js/src/jit-test/tests/ion/bug809021.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/bug809021.js b/js/src/jit-test/tests/ion/bug809021.js new file mode 100644 index 000000000..c4c3d436b --- /dev/null +++ b/js/src/jit-test/tests/ion/bug809021.js @@ -0,0 +1,73 @@ +// nactuals > nformals +function testOverflow() { + var called = false; + function f(a) { + assertEq(a, 173); + assertEq(arguments.length, 2); + assertEq(arguments[0], a); + assertEq(arguments[1], a); + called = true; + } + + for (var i=0; i<10; i++) + [173, 173, 173].sort(f); + assertEq(called, true); +} +testOverflow(); + +// nactuals == nformals +function testEqual() { + var called = false; + function f(a, b) { + assertEq(a, 173); + assertEq(arguments.length, 2); + assertEq(arguments[0], a); + assertEq(arguments[1], b); + called = true; + } + + for (var i=0; i<10; i++) + [173, 173, 173].sort(f); + assertEq(called, true); +} +testEqual(); + +// nactuals < nformals +function testUnderflow() { + var called = false; + function f(a, b, c) { + assertEq(a, 173); + assertEq(c, undefined); + assertEq(arguments.length, 2); + assertEq(arguments[0], a); + assertEq(arguments[1], b); + called = true; + } + + for (var i=0; i<10; i++) + [173, 173, 173].sort(f); + assertEq(called, true); +} +testUnderflow(); + +function testUnderflowMany() { + var called = 0; + function f(a, b, c, d, e, f, g, h) { + assertEq(a, 173); + assertEq(arguments.length, 3); + assertEq(arguments[0], a); + assertEq(arguments[1] < 3, true); + assertEq(c.length, 3); + assertEq(d, undefined); + assertEq(e, undefined); + assertEq(f, undefined); + assertEq(g, undefined); + assertEq(h, undefined); + called += 1; + } + + for (var i=0; i<10; i++) + [173, 173, 173].map(f); + assertEq(called, 30); +} +testUnderflowMany(); |