michael@0: michael@0: // test local/arg liveness analysis in presence of many locals michael@0: michael@0: function foo(a, b, c) { michael@0: var x = 0, y = 0, z = 0; michael@0: if (a < b) { michael@0: x = a + 0; michael@0: y = b + 0; michael@0: z = c + 0; michael@0: } else { michael@0: x = a; michael@0: y = b; michael@0: z = c; michael@0: } michael@0: return x + y + z; michael@0: } michael@0: assertEq(foo(1, 2, 3), 6); michael@0: michael@0: // restore liveness correctly before switch statements michael@0: michael@0: function foo(a, b, c) { michael@0: var x = 0, y = 0, z = 0; michael@0: if (a < b) { michael@0: x = a + 0; michael@0: y = b + 0; michael@0: z = c + 0; michael@0: } else { michael@0: switch (c) { michael@0: case 1: michael@0: case 2: michael@0: case 3: michael@0: case 4: michael@0: case 5: return 0; michael@0: } michael@0: x = 0; michael@0: y = 0; michael@0: z = 0; michael@0: } michael@0: return x + y + z; michael@0: } michael@0: assertEq(foo(1, 2, 3), 6);