Wed, 31 Dec 2014 06:09:35 +0100
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 | function testMap() { |
michael@0 | 4 | |
michael@0 | 5 | // Note: This is the same kernel function as `alloc-many-objs`, but |
michael@0 | 6 | // with a larger bound. This often fails par. exec. because it |
michael@0 | 7 | // triggers GC at inconvenient times. But let's just test that it |
michael@0 | 8 | // doesn't crash or something! |
michael@0 | 9 | |
michael@0 | 10 | var ints = range(0, 100000); |
michael@0 | 11 | |
michael@0 | 12 | // The disqual occurs because each time we try to run we wind up |
michael@0 | 13 | // bailing due to running out of memory or requesting a GC. |
michael@0 | 14 | assertParallelExecWillBail(function (m) { |
michael@0 | 15 | ints.mapPar(kernel, m); |
michael@0 | 16 | }); |
michael@0 | 17 | |
michael@0 | 18 | function kernel(v) { |
michael@0 | 19 | var x = []; |
michael@0 | 20 | |
michael@0 | 21 | if (inParallelSection()) { |
michael@0 | 22 | // don't bother to stress test the non-parallel paths! |
michael@0 | 23 | for (var i = 0; i < 50; i++) { |
michael@0 | 24 | x[i] = []; |
michael@0 | 25 | for (var j = 0; j < 1024; j++) { |
michael@0 | 26 | x[i][j] = j; |
michael@0 | 27 | } |
michael@0 | 28 | } |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | return x; |
michael@0 | 32 | } |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | if (getBuildConfiguration().parallelJS) |
michael@0 | 36 | testMap(); |
michael@0 | 37 |