blob: 3c35db7d9b9fee0780c3936d1c16b418dc1c92c9 [file] [log] [blame]
function foo(o, value) {
o.f = value;
return o.f;
}
noInline(foo);
var counter = 0;
function test(o, value, expectedCount) {
var result = foo(o, value);
if (result != value)
throw new Error("Bad result: " + result);
if (counter != expectedCount)
throw new Error("Bad counter value: " + counter);
}
for (var i = 0; i < 100000; ++i) {
var o = {};
o.__defineSetter__("f", function(value) {
counter++;
this._f = value;
});
o.__defineGetter__("f", function() { return this._f; });
test(o, i, counter + 1);
test({f: 42}, i, counter);
}