js/src/jit-test/tests/parallel/binary-arith-numbers.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/parallel/binary-arith-numbers.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +load(libdir + "parallelarray-helpers.js");
     1.5 +
     1.6 +// Test that we are able to add numbers even if the typesets are not
     1.7 +// "clean" because we have previously added strings and numbers.  This
     1.8 +// should cause fallible unboxing to occur.
     1.9 +
    1.10 +function theTest() {
    1.11 +  var mixedArray = [1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.1,
    1.12 +                    "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
    1.13 +
    1.14 +  function op(e, i) {
    1.15 +    return mixedArray[e % mixedArray.length] + i;
    1.16 +  }
    1.17 +
    1.18 +  // run op once where it has to add doubles and strings,
    1.19 +  // just to pullute the typesets:
    1.20 +  var jsarray0 = range(0, 1024);
    1.21 +  jsarray0.map(op);
    1.22 +
    1.23 +  // this version will never actually touch the strings:
    1.24 +  assertArraySeqParResultsEq(range(0, 1024), "map", function (i) { return i % 10; });
    1.25 +
    1.26 +  // but if we try against the original we get bailouts:
    1.27 +  assertParallelExecWillBail(function (mode) {
    1.28 +    jsarray0.mapPar(op, mode);
    1.29 +  });
    1.30 +}
    1.31 +
    1.32 +if (getBuildConfiguration().parallelJS)
    1.33 +  theTest();

mercurial