1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/jaeger/regalloc-live.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 + 1.5 +// test local/arg liveness analysis in presence of many locals 1.6 + 1.7 +function foo(a, b, c) { 1.8 + var x = 0, y = 0, z = 0; 1.9 + if (a < b) { 1.10 + x = a + 0; 1.11 + y = b + 0; 1.12 + z = c + 0; 1.13 + } else { 1.14 + x = a; 1.15 + y = b; 1.16 + z = c; 1.17 + } 1.18 + return x + y + z; 1.19 +} 1.20 +assertEq(foo(1, 2, 3), 6); 1.21 + 1.22 +// restore liveness correctly before switch statements 1.23 + 1.24 +function foo(a, b, c) { 1.25 + var x = 0, y = 0, z = 0; 1.26 + if (a < b) { 1.27 + x = a + 0; 1.28 + y = b + 0; 1.29 + z = c + 0; 1.30 + } else { 1.31 + switch (c) { 1.32 + case 1: 1.33 + case 2: 1.34 + case 3: 1.35 + case 4: 1.36 + case 5: return 0; 1.37 + } 1.38 + x = 0; 1.39 + y = 0; 1.40 + z = 0; 1.41 + } 1.42 + return x + y + z; 1.43 +} 1.44 +assertEq(foo(1, 2, 3), 6);