js/src/jit-test/tests/parallel/Array-reducePar-bail.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial