michael@0: function testChangingObjectWithLength() michael@0: { michael@0: var obj = { length: 10 }; michael@0: var dense = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; michael@0: var slow = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; slow.slow = 5; michael@0: michael@0: /* michael@0: * The elements of objs constitute a De Bruijn sequence repeated 4x to trace michael@0: * and run native code for every object and transition. michael@0: */ michael@0: var objs = [obj, obj, obj, obj, michael@0: obj, obj, obj, obj, michael@0: dense, dense, dense, dense, michael@0: obj, obj, obj, obj, michael@0: slow, slow, slow, slow, michael@0: dense, dense, dense, dense, michael@0: dense, dense, dense, dense, michael@0: slow, slow, slow, slow, michael@0: slow, slow, slow, slow, michael@0: obj, obj, obj, obj]; michael@0: michael@0: var counter = 0; michael@0: michael@0: for (var i = 0, sz = objs.length; i < sz; i++) michael@0: { michael@0: var o = objs[i]; michael@0: for (var j = 0; j < o.length; j++) michael@0: counter++; michael@0: } michael@0: michael@0: return counter; michael@0: } michael@0: assertEq(testChangingObjectWithLength(), 400);