js/src/jit-test/tests/ion/bug825599.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 var typedSwitch0 = function (a) {
     2     switch (a) {
     3         case null:
     4         return 0;
     5         case 1.1:
     6         return 1;
     7         case "2":
     8         return 2;
     9         case 3:
    10         return 3;
    11     }
    12     return 4;
    13 };
    15 // reuse the same function for testing with different inputs & type.
    16 var typedSwitch1 = eval(typedSwitch0.toSource());
    17 var typedSwitch2 = eval(typedSwitch0.toSource());
    18 var typedSwitch3 = eval(typedSwitch0.toSource());
    19 var typedSwitch4 = eval(typedSwitch0.toSource());
    21 for (var i = 0; i < 100; i++) {
    22     assertEq(typedSwitch0(null), 0);
    23     assertEq(typedSwitch1(1.1), 1);
    24     assertEq(typedSwitch2("2"), 2);
    25     assertEq(typedSwitch3(3), 3);
    26     assertEq(typedSwitch4(undefined), 4);
    27 }

mercurial