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.

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

mercurial