mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 22: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.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
function foo(a, i) {
|
|
return [a[i + 0], a[i + 1], a[i + 2], a[i + 3], a[i + 4], a[i + 5], a[i + 6], a[i + 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 array = [];
|
|
var offset = i & 3;
|
|
for (var j = 0; j < offset; ++j)
|
|
array.push(42);
|
|
var result = foo(array.concat([1, 2, 3, 4, 5, 6, 7, 8]), offset);
|
|
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], 0);
|
|
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], 0);
|
|
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], 0);
|
|
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], 0);
|
|
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], 0);
|
|
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], 0);
|
|
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], 0);
|
|
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([], 0);
|
|
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;
|