blob: f0f8804f6ce7cd89d553b96a84f3c44a05287ef1 [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 = [];
for (var i = 0; i < 100; ++i)
array.push(String(i));
for (var i = 0; i < 1e5; ++i)
shouldBe(indexOf(array, "42"), 42);
}());
(function () {
function indexOf(array, value)
{
return array.indexOf(value);
}
noInline(indexOf);
var array = [];
for (var i = 0; i < 100; ++i) {
array.push(String(i + 0.5));
array.push({});
}
for (var i = 0; i < 1e5; ++i)
shouldBe(indexOf(array, "42.5"), 42 * 2);
}());