michael@0: function build_getter(i) { michael@0: var x = [i]; michael@0: return function f() { return x; } michael@0: } michael@0: michael@0: function test() michael@0: { michael@0: var N = internalConst("INCREMENTAL_MARK_STACK_BASE_CAPACITY") + 2; michael@0: var o = {}; michael@0: var descriptor = { enumerable: true}; michael@0: for (var i = 0; i != N; ++i) { michael@0: descriptor.get = build_getter(i); michael@0: Object.defineProperty(o, i, descriptor); michael@0: } michael@0: michael@0: // At this point we have an object o with N getters. Each getter in turn michael@0: // is a closure storing an array. During the GC we push to the object michael@0: // marking stack all the getters found in an object after we mark it. As N michael@0: // exceeds the size of the object marking stack, this requires to run the michael@0: // dealyed scanning for some closures to mark the array objects stored in michael@0: // them. michael@0: // michael@0: // We run the GC twice to make sure that the background finalization michael@0: // finishes before we access the objects. michael@0: gc(); michael@0: gc(); michael@0: for (var i = 0; i != N; ++i) michael@0: assertEq(o[i][0], i); michael@0: } michael@0: michael@0: test();