blob: cb87f12f4fe7b6956c9c94407b1e5076f2f64e5a [file] [log] [blame]
function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
(function () {
function indexOf(array, value)
{
return array.indexOf(value);
}
noInline(indexOf);
var array = new Array(100);
for (var i = 0; i < 1e4; ++i) {
shouldBe(indexOf(array, undefined), -1);
shouldBe(indexOf(array, null), -1);
}
}());
(function () {
function indexOf(array, value)
{
return array.indexOf(value);
}
noInline(indexOf);
var array = new Array(100);
array.push({});
for (var i = 0; i < 1e4; ++i) {
shouldBe(indexOf(array, undefined), -1);
shouldBe(indexOf(array, null), -1);
}
}());