1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/ion/getprop-idempotent-cache-2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,21 @@ 1.4 +function f(o) { 1.5 + var res = 0; 1.6 + for (var i=0; i<110; i++) { 1.7 + res += o.x; 1.8 + } 1.9 + return res; 1.10 +} 1.11 + 1.12 +function O(x) { 1.13 + if ([].length == 0) // Thwart definite slot analysis. 1.14 + this.x = 10; 1.15 +} 1.16 + 1.17 +var o = new O(true); 1.18 +f(o); 1.19 + 1.20 +// Add a getter, this should invalidate the script containing the idempotent cache. 1.21 +var res = 0; 1.22 +o.__defineGetter__("x", function() { res++; }); 1.23 +f(o); 1.24 +assertEq(res, 110);