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)
36 lines
890 B
JavaScript
36 lines
890 B
JavaScript
function shouldBe(actual, expected)
|
|
{
|
|
if (actual !== expected)
|
|
throw new Error('bad value: ' + actual);
|
|
}
|
|
|
|
(function () {
|
|
function indexOfInt32(array, value)
|
|
{
|
|
return array.indexOf(value);
|
|
}
|
|
noInline(indexOfInt32);
|
|
var int32Array = [0, 1, 2, 3, 4, , 6, 7, 8, 9, 10, 11, 12];
|
|
|
|
var value = -1;
|
|
for (var i = 0; i < 1e5; ++i) {
|
|
shouldBe(indexOfInt32(int32Array, 5), value);
|
|
shouldBe(indexOfInt32(int32Array, 6), 6);
|
|
if (i === 1e4) {
|
|
Object.defineProperty(Map.prototype, 5, {
|
|
get: function () {
|
|
return 42;
|
|
}
|
|
});
|
|
}
|
|
if (i === 3e4) {
|
|
value = 5;
|
|
Object.defineProperty(Array.prototype, 5, {
|
|
get: function () {
|
|
return 5;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}());
|