js/src/jit-test/tests/basic/testApplyCall.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 function testApplyCallHelper(f) {
michael@0 2 var r = [];
michael@0 3 for (var i = 0; i < 10; ++i) f.call();
michael@0 4 r.push(x);
michael@0 5 for (var i = 0; i < 10; ++i) f.call(this);
michael@0 6 r.push(x);
michael@0 7 for (var i = 0; i < 10; ++i) f.apply(this);
michael@0 8 r.push(x);
michael@0 9 for (var i = 0; i < 10; ++i) f.call(this,0);
michael@0 10 r.push(x);
michael@0 11 for (var i = 0; i < 10; ++i) f.apply(this,[0]);
michael@0 12 r.push(x);
michael@0 13 for (var i = 0; i < 10; ++i) f.call(this,0,1);
michael@0 14 r.push(x);
michael@0 15 for (var i = 0; i < 10; ++i) f.apply(this,[0,1]);
michael@0 16 r.push(x);
michael@0 17 for (var i = 0; i < 10; ++i) f.call(this,0,1,2);
michael@0 18 r.push(x);
michael@0 19 for (var i = 0; i < 10; ++i) f.apply(this,[0,1,2]);
michael@0 20 r.push(x);
michael@0 21 for (var i = 0; i < 10; ++i) f.call(this,0,1,2,3);
michael@0 22 r.push(x);
michael@0 23 for (var i = 0; i < 10; ++i) f.apply(this,[0,1,2,3]);
michael@0 24 r.push(x);
michael@0 25 for (var i = 0; i < 10; ++i) f.call(this,0,1,2,3,4);
michael@0 26 r.push(x);
michael@0 27 for (var i = 0; i < 10; ++i) f.apply(this,[0,1,2,3,4]);
michael@0 28 r.push(x);
michael@0 29 for (var i = 0; i < 10; ++i) f.call(this,0,1,2,3,4,5);
michael@0 30 r.push(x);
michael@0 31 for (var i = 0; i < 10; ++i) f.apply(this,[0,1,2,3,4,5])
michael@0 32 r.push(x);
michael@0 33 return(r.join(","));
michael@0 34 }
michael@0 35 function testApplyCall() {
michael@0 36 var r = testApplyCallHelper(function (a0,a1,a2,a3,a4,a5,a6,a7) { x = [a0,a1,a2,a3,a4,a5,a6,a7]; });
michael@0 37 r += testApplyCallHelper(function (a0,a1,a2,a3,a4,a5,a6,a7) { x = [a0,a1,a2,a3,a4,a5,a6,a7]; });
michael@0 38 return r;
michael@0 39 }
michael@0 40
michael@0 41 assertEq(testApplyCall(), ",,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,0,,,,,,,,0,1,,,,,,,0,1,,,,,,,0,1,2,,,,,,0,1,2,,,,,,0,1,2,3,,,,,0,1,2,3,,,,,0,1,2,3,4,,,,0,1,2,3,4,,,,0,1,2,3,4,5,,,0,1,2,3,4,5,," +
michael@0 42 ",,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,0,,,,,,,,0,1,,,,,,,0,1,,,,,,,0,1,2,,,,,,0,1,2,,,,,,0,1,2,3,,,,,0,1,2,3,,,,,0,1,2,3,4,,,,0,1,2,3,4,,,,0,1,2,3,4,5,,,0,1,2,3,4,5,,");

mercurial