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 | if (!getBuildConfiguration().parallelJS) |
michael@0 | 2 | quit(0); |
michael@0 | 3 | |
michael@0 | 4 | function testReduce() { |
michael@0 | 5 | function sum(a, b) { |
michael@0 | 6 | var r = a + b; |
michael@0 | 7 | } |
michael@0 | 8 | var array = build(8 * 0X0aaec , function() { return 1; }); |
michael@0 | 9 | var parResult = array.reducePar(sum); |
michael@0 | 10 | } |
michael@0 | 11 | for (var ix = 0; ix < 3; ++ix) { |
michael@0 | 12 | testReduce(); |
michael@0 | 13 | } |
michael@0 | 14 | function build(n, f) { |
michael@0 | 15 | var result = []; |
michael@0 | 16 | for (var i = 0; i < n; i++) |
michael@0 | 17 | result.push(f(i)); |
michael@0 | 18 | return result; |
michael@0 | 19 | } |
michael@0 | 20 | function seq_scan(array, f) { |
michael@0 | 21 | for (var i = 1; i < array.length; i++) { |
michael@0 | 22 | } |
michael@0 | 23 | } |
michael@0 | 24 | function assertAlmostEq(v1, v2) { |
michael@0 | 25 | if (e1 instanceof Array && e2 instanceof Array) { |
michael@0 | 26 | for (prop in e1) { |
michael@0 | 27 | if (e1.hasOwnProperty(prop)) { } |
michael@0 | 28 | } |
michael@0 | 29 | } |
michael@0 | 30 | } |
michael@0 | 31 | function assertEqArray(a, b) { |
michael@0 | 32 | for (var i = 0, l = a.length; i < l; i++) { |
michael@0 | 33 | try { } catch (e) { } |
michael@0 | 34 | } |
michael@0 | 35 | } |
michael@0 | 36 | function assertParallelExecWillRecover(opFunction) { |
michael@0 | 37 | assertParallelExecSucceeds( |
michael@0 | 38 | function(m) {}, |
michael@0 | 39 | function(r) {} |
michael@0 | 40 | ); |
michael@0 | 41 | } |