blob: f3d4173a67fd6886eee4c3b1206d4b532a05107a [file] [edit]
function Cons1() {
}
Cons1.prototype.f = 42;
function Cons2() {
}
Cons2.prototype.__defineGetter__("f", function() {
counter++;
return 84;
});
function foo(o) {
return o.f;
}
noInline(foo);
var counter = 0;
function test(o, expected, expectedCount) {
var result = foo(o);
if (result != expected)
throw new Error("Bad result: " + result);
if (counter != expectedCount)
throw new Error("Bad counter value: " + counter);
}
for (var i = 0; i < testLoopCount; ++i) {
test(new Cons2(), 84, counter + 1);
test(new Cons1(), 42, counter);
}