blob: 9d13803078b2c2fd2eff1f881a1a19347080edc9 [file] [log] [blame]
fpizlo@apple.comd5547492012-06-07 00:23:36 +00001description(
2"Tests accessing arguments with an out-of-bounds index when the arguments have not been created but might be."
3);
4
5var p = false;
6
7function foo() {
8 function bar() { }
9 if (p)
10 return arguments;
11 return arguments[0];
12}
13
oliver@apple.com382f5622013-07-25 04:01:50 +000014silentTestPass = true;
15noInline(foo);
16
fpizlo@apple.comd5547492012-06-07 00:23:36 +000017var args = [42];
18var expected = "\"42\"";
oliver@apple.com382f5622013-07-25 04:01:50 +000019for (var i = 0; i < 3000; i = dfgIncrement({f:foo, i:i + 1, n:1500})) {
fpizlo@apple.comd5547492012-06-07 00:23:36 +000020 if (i == 1000) {
21 p = true;
22 expected = "\"[object Arguments]\"";
23 }
24 if (i == 2000) {
25 args = [];
26 p = false;
27 expected = "\"undefined\"";
28 }
29 result = "" +foo.apply(void 0, args);
30 shouldBe("result", expected);
31}
32