michael@0: function f(o) { michael@0: var res = 0; michael@0: for (var i=0; i<110; i++) { michael@0: res += o.x; michael@0: } michael@0: return res; michael@0: } michael@0: michael@0: function O(x) { michael@0: if ([].length == 0) // Thwart definite slot analysis. michael@0: this.x = 10; michael@0: } michael@0: michael@0: var o = new O(true); michael@0: f(o); michael@0: michael@0: // Add a getter, this should invalidate the script containing the idempotent cache. michael@0: var res = 0; michael@0: o.__defineGetter__("x", function() { res++; }); michael@0: f(o); michael@0: assertEq(res, 110);