js/src/jit-test/tests/parallel/bitops-values.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 load(libdir + "parallelarray-helpers.js");
     3 // The following tests test 2 paths in Ion. The 'ValueToInt32' paths test
     4 // LValueToInt32, and the 'V' paths test the slow value-taking VM functions
     5 // corresponding to the bit ops.
     6 //
     7 // At the time of writing the 'V' paths are triggered when any of the operands
     8 // to the bit ops may be an object, thus the always-false branch which assign
     9 // {} to one of the operands.
    11 var len = minItemsTestingThreshold;
    12 var vals = [true, false, undefined, "1"];
    14 function testBitNotValueToInt32() {
    15   assertArraySeqParResultsEq(range(0, len), "map", function (i) {
    16     return [~vals[0], ~vals[1], ~vals[2], ~vals[3]];
    17   });
    18 }
    20 function testBitNotV() {
    21   assertArraySeqParResultsEq(range(0, len), "map", function (i) {
    22     var a, b, c, d;
    23     if (i < 0) {
    24       a = {};
    25       b = {};
    26       c = {};
    27       d = {};
    28     } else {
    29       a = vals[0];
    30       b = vals[1];
    31       c = vals[2];
    32       d = vals[3];
    33     }
    34     return [~a, ~b, ~c, ~d];
    35   });
    36 }
    38 function testBitBinOpsValueToInt32() {
    39   for (var n = 0; n < vals.length; n++) {
    40     for (var m = n; m < vals.length; m++) {
    41       assertArraySeqParResultsEq(range(0, len), "map", function (i) {
    42         var a = vals[n];
    43         var b = vals[m];
    45         return [a & b,
    46                 a | b,
    47                 a ^ b,
    48                 a << b,
    49                 a >> b];
    50       });
    51     }
    52   }
    53 }
    55 function testBitBinOpsV() {
    56   for (var n = 0; n < vals.length; n++) {
    57     for (var m = n; m < vals.length; m++) {
    58       assertArraySeqParResultsEq(range(0, len), "map", function (i) {
    59         var a, b;
    61         if (i < 0) {
    62           a = {};
    63           b = {};
    64         } else {
    65           a = vals[n];
    66           b = vals[m];
    67         }
    69         return [a & b,
    70                 a | b,
    71                 a ^ b,
    72                 a << b,
    73                 a >> b];
    74       });
    75     }
    76   }
    77 }
    79 if (getBuildConfiguration().parallelJS) {
    80   testBitNotValueToInt32();
    81   testBitNotV();
    82   testBitBinOpsValueToInt32();
    83   testBitBinOpsV();
    84 }

mercurial