michael@0: var foo; michael@0: michael@0: function gen() { michael@0: var x = 0; michael@0: foo = function() { return x++; } michael@0: for (var i = 0; i < 10; ++i) michael@0: yield x++; michael@0: } michael@0: michael@0: var j = 0; michael@0: for (i in gen()) michael@0: assertEq(i, j++); michael@0: michael@0: // now mess up the stack michael@0: michael@0: function f1(x) { michael@0: var a, b, c, d, e, f, g; michael@0: return x <= 0 ? 0 : f1(x-1); michael@0: } michael@0: f1(10); michael@0: function f2(x) { michael@0: var a = x, b = x; michael@0: return x <= 0 ? 0 : f2(x-1); michael@0: } michael@0: f2(10); michael@0: michael@0: // now observe gen's call object (which should have been put) michael@0: michael@0: gc(); michael@0: assertEq(foo(), 10); michael@0: gc(); michael@0: assertEq(foo(), 11); michael@0: gc(); michael@0: assertEq(foo(), 12); michael@0: michael@0: reportCompare(true,true);