mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 14:30:27 +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)
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
function foo(a) {
|
|
return [a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]];
|
|
}
|
|
|
|
noInline(foo);
|
|
|
|
function arraycmp(a, b) {
|
|
if (a.length != b.length)
|
|
return false;
|
|
for (var i = 0; i < a.length; ++i) {
|
|
if (a[i] != b[i])
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
for (var i = 0; i < 100000; ++i) {
|
|
var result = foo([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
if (!arraycmp(result, [1, 2, 3, 4, 5, 6, 7, 8]))
|
|
throw "Error: bad result (1..8): " + result;
|
|
}
|
|
|
|
var result = foo([1, 2, 3, 4, 5, 6, 7]);
|
|
if (!arraycmp(result, [1, 2, 3, 4, 5, 6, 7, void 0]))
|
|
throw "Error: bad result (1..7): " + result;
|
|
var result = foo([1, 2, 3, 4, 5, 6]);
|
|
if (!arraycmp(result, [1, 2, 3, 4, 5, 6, void 0, void 0]))
|
|
throw "Error: bad result (1..6): " + result;
|
|
var result = foo([1, 2, 3, 4, 5]);
|
|
if (!arraycmp(result, [1, 2, 3, 4, 5, void 0, void 0, void 0]))
|
|
throw "Error: bad result (1..5): " + result;
|
|
var result = foo([1, 2, 3, 4]);
|
|
if (!arraycmp(result, [1, 2, 3, 4, void 0, void 0, void 0, void 0]))
|
|
throw "Error: bad result (1..4): " + result;
|
|
var result = foo([1, 2, 3]);
|
|
if (!arraycmp(result, [1, 2, 3, void 0, void 0, void 0, void 0, void 0]))
|
|
throw "Error: bad result (1..3): " + result;
|
|
var result = foo([1, 2]);
|
|
if (!arraycmp(result, [1, 2, void 0, void 0, void 0, void 0, void 0, void 0]))
|
|
throw "Error: bad result (1..2): " + result;
|
|
var result = foo([1]);
|
|
if (!arraycmp(result, [1, void 0, void 0, void 0, void 0, void 0, void 0, void 0]))
|
|
throw "Error: bad result (1..1): " + result;
|
|
var result = foo([]);
|
|
if (!arraycmp(result, [void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0]))
|
|
throw "Error: bad result (1..1): " + result;
|