js/src/jit-test/tests/ion/bug809021.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // nactuals > nformals
michael@0 2 function testOverflow() {
michael@0 3 var called = false;
michael@0 4 function f(a) {
michael@0 5 assertEq(a, 173);
michael@0 6 assertEq(arguments.length, 2);
michael@0 7 assertEq(arguments[0], a);
michael@0 8 assertEq(arguments[1], a);
michael@0 9 called = true;
michael@0 10 }
michael@0 11
michael@0 12 for (var i=0; i<10; i++)
michael@0 13 [173, 173, 173].sort(f);
michael@0 14 assertEq(called, true);
michael@0 15 }
michael@0 16 testOverflow();
michael@0 17
michael@0 18 // nactuals == nformals
michael@0 19 function testEqual() {
michael@0 20 var called = false;
michael@0 21 function f(a, b) {
michael@0 22 assertEq(a, 173);
michael@0 23 assertEq(arguments.length, 2);
michael@0 24 assertEq(arguments[0], a);
michael@0 25 assertEq(arguments[1], b);
michael@0 26 called = true;
michael@0 27 }
michael@0 28
michael@0 29 for (var i=0; i<10; i++)
michael@0 30 [173, 173, 173].sort(f);
michael@0 31 assertEq(called, true);
michael@0 32 }
michael@0 33 testEqual();
michael@0 34
michael@0 35 // nactuals < nformals
michael@0 36 function testUnderflow() {
michael@0 37 var called = false;
michael@0 38 function f(a, b, c) {
michael@0 39 assertEq(a, 173);
michael@0 40 assertEq(c, undefined);
michael@0 41 assertEq(arguments.length, 2);
michael@0 42 assertEq(arguments[0], a);
michael@0 43 assertEq(arguments[1], b);
michael@0 44 called = true;
michael@0 45 }
michael@0 46
michael@0 47 for (var i=0; i<10; i++)
michael@0 48 [173, 173, 173].sort(f);
michael@0 49 assertEq(called, true);
michael@0 50 }
michael@0 51 testUnderflow();
michael@0 52
michael@0 53 function testUnderflowMany() {
michael@0 54 var called = 0;
michael@0 55 function f(a, b, c, d, e, f, g, h) {
michael@0 56 assertEq(a, 173);
michael@0 57 assertEq(arguments.length, 3);
michael@0 58 assertEq(arguments[0], a);
michael@0 59 assertEq(arguments[1] < 3, true);
michael@0 60 assertEq(c.length, 3);
michael@0 61 assertEq(d, undefined);
michael@0 62 assertEq(e, undefined);
michael@0 63 assertEq(f, undefined);
michael@0 64 assertEq(g, undefined);
michael@0 65 assertEq(h, undefined);
michael@0 66 called += 1;
michael@0 67 }
michael@0 68
michael@0 69 for (var i=0; i<10; i++)
michael@0 70 [173, 173, 173].map(f);
michael@0 71 assertEq(called, 30);
michael@0 72 }
michael@0 73 testUnderflowMany();

mercurial