js/src/jit-test/tests/jaeger/regalloc-live.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     2 // test local/arg liveness analysis in presence of many locals
     4 function foo(a, b, c) {
     5   var x = 0, y = 0, z = 0;
     6   if (a < b) {
     7     x = a + 0;
     8     y = b + 0;
     9     z = c + 0;
    10   } else {
    11     x = a;
    12     y = b;
    13     z = c;
    14   }
    15   return x + y + z;
    16 }
    17 assertEq(foo(1, 2, 3), 6);
    19 // restore liveness correctly before switch statements
    21 function foo(a, b, c) {
    22   var x = 0, y = 0, z = 0;
    23   if (a < b) {
    24     x = a + 0;
    25     y = b + 0;
    26     z = c + 0;
    27   } else {
    28     switch (c) {
    29     case 1:
    30     case 2:
    31     case 3:
    32     case 4:
    33     case 5: return 0;
    34     }
    35     x = 0;
    36     y = 0;
    37     z = 0;
    38   }
    39   return x + y + z;
    40 }
    41 assertEq(foo(1, 2, 3), 6);

mercurial