blob: e813a7e140d386653fbc354c50ead58e1219d3a4 [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function getByVal(object, name)
{
return object[name];
}
noInline(getByVal);
var value = 'lo';
function getStr1()
{
return "hel" + value;
}
noInline(getStr1);
function getStr2()
{
return "hello";
}
noInline(getStr2);
var object = {
hello: 42,
world: 50
};
for (var i = 0; i < 10000; ++i)
shouldBe(getByVal(object, i % 2 === 0 ? getStr1() : getStr2()), 42);
shouldBe(getByVal(object, 'world'), 50);