michael@0: // Test stack reconstruction after a nested exit michael@0: function testNestedExitStackInner(j, counter) { michael@0: ++counter; michael@0: var b = 0; michael@0: for (var i = 1; i <= 9; i++) { michael@0: ++b; michael@0: var a; michael@0: // Make sure that once everything has been traced we suddenly switch to michael@0: // a different control flow the first time we run the outermost tree, michael@0: // triggering a side exit. michael@0: if (j < 9) michael@0: a = 1; michael@0: else michael@0: a = 0; michael@0: ++b; michael@0: b += a; michael@0: } michael@0: return counter + b; michael@0: } michael@0: function testNestedExitStackOuter() { michael@0: var counter = 0; michael@0: for (var j = 1; j <= 9; ++j) { michael@0: for (var k = 1; k <= 9; ++k) { michael@0: counter = testNestedExitStackInner(j, counter); michael@0: } michael@0: } michael@0: return counter; michael@0: } michael@0: //assertEq(testNestedExitStackOuter(), 81);