mirror of
https://github.com/tc39/test262.git
synced 2025-05-08 00:40:28 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
51 lines
1.0 KiB
JavaScript
51 lines
1.0 KiB
JavaScript
function shouldBe(actual, expected)
|
|
{
|
|
if (actual !== expected)
|
|
throw new Error('bad value: ' + actual);
|
|
}
|
|
|
|
(function () {
|
|
function test1(arg1, arg2, arg3)
|
|
{
|
|
return arguments.length;
|
|
}
|
|
|
|
function test()
|
|
{
|
|
shouldBe(test1(), 0);
|
|
shouldBe(test1(0), 1);
|
|
shouldBe(test1(0, 1), 2);
|
|
shouldBe(test1(0, 1, 2), 3);
|
|
shouldBe(test1(0, 1, 2, 3), 4);
|
|
}
|
|
noInline(test);
|
|
|
|
for (var i = 0; i < 1e4; ++i)
|
|
test();
|
|
}());
|
|
|
|
(function () {
|
|
function test1(flag, arg1, arg2, arg3)
|
|
{
|
|
if (flag)
|
|
OSRExit();
|
|
return arguments;
|
|
}
|
|
|
|
function test(flag)
|
|
{
|
|
shouldBe(test1(flag).length, 1);
|
|
shouldBe(test1(flag, 0).length, 2);
|
|
shouldBe(test1(flag, 0, 1).length, 3);
|
|
shouldBe(test1(flag, 0, 1, 2).length, 4);
|
|
shouldBe(test1(flag, 0, 1, 2, 3).length, 5);
|
|
}
|
|
noInline(test);
|
|
for (var i = 0; i < 1e5; ++i)
|
|
test(false);
|
|
|
|
test(true);
|
|
test(true);
|
|
test(true);
|
|
}());
|