js/src/jit-test/tests/parallel/Array-reducePar-bail.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 // Tests that reduce saves its intermediate state correctly by
     4 // inducing a bailout in the middle of the reduction.  This test may
     5 // fail to test what it is intended to test if the wrong number of
     6 // worker threads etc are present.  It reproduced an existing bug when
     7 // used with 8 worker threads.
     9 function testReduce() {
    10   var aCounter = 0;
    11   function sum(a, b) {
    12     var r = a + b;
    13     if (r == 234) // occurs once per slice
    14       aCounter++;
    15     return r;
    16   }
    18   // We use a big array, to make sure that the test runs with 64 slices.
    19   var array = build(8 * 4096, function() { return 1; });
    20   var seqResult = array.reduce(sum);
    21   var seqCounter = aCounter;
    23   aCounter = 0;
    24   var parResult = array.reducePar(sum);
    25   var parCounter = aCounter;
    27   assertEq(true, parCounter >= seqCounter);
    28   assertStructuralEq(parResult, seqResult);
    29 }
    31 if (getBuildConfiguration().parallelJS)
    32   testReduce();

mercurial