michael@0: michael@0: /* Test pop/shift compiler paths. */ michael@0: michael@0: function a() { michael@0: var x = []; michael@0: for (var i = 0; i < 50; i++) michael@0: x.push(i); michael@0: for (var j = 0; j < 100; j++) { michael@0: var z = x.shift(); michael@0: if (j < 50) michael@0: assertEq(z, j); michael@0: else michael@0: assertEq(z, undefined); michael@0: } michael@0: } michael@0: a(); michael@0: michael@0: function b() { michael@0: var x = []; michael@0: for (var i = 0; i < 50; i++) michael@0: x.push(i); michael@0: for (var j = 0; j < 100; j++) { michael@0: var z = x.pop(); michael@0: if (j < 50) michael@0: assertEq(z, 49 - j); michael@0: else michael@0: assertEq(z, undefined); michael@0: } michael@0: } michael@0: b();