js/src/jit-test/tests/ion/eliminate-unreachable-1.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/ion/eliminate-unreachable-1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +// Test for one annoying case of the EliminateUnreachableCode
     1.5 +// optimization.  Here the dominators change and also phis are
     1.6 +// eliminated.
     1.7 +
     1.8 +function test1(v) {
     1.9 +  var i = 0;
    1.10 +  if (v) {
    1.11 +    if (v) {
    1.12 +      i += 1;
    1.13 +    } else {
    1.14 +      i += 10;
    1.15 +    }
    1.16 +    i += 100;
    1.17 +  } else {
    1.18 +    if (v) {
    1.19 +      i += 1000;
    1.20 +    } else {
    1.21 +      i += 10000;
    1.22 +    }
    1.23 +    i += 100000;
    1.24 +  }
    1.25 +  i += 1000000;
    1.26 +  return i;
    1.27 +}
    1.28 +
    1.29 +function test() {
    1.30 +  assertEq(test1(true), 1000101);
    1.31 +  assertEq(test1(false), 1110000);
    1.32 +}
    1.33 +
    1.34 +for (var i = 0; i < 100; i++)
    1.35 +  test();

mercurial