js/src/jit-test/tests/parallel/alloc-too-many-objs.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/alloc-too-many-objs.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +load(libdir + "parallelarray-helpers.js");
     1.5 +
     1.6 +function testMap() {
     1.7 +
     1.8 +  // Note: This is the same kernel function as `alloc-many-objs`, but
     1.9 +  // with a larger bound.  This often fails par. exec. because it
    1.10 +  // triggers GC at inconvenient times.  But let's just test that it
    1.11 +  // doesn't crash or something!
    1.12 +
    1.13 +  var ints = range(0, 100000);
    1.14 +
    1.15 +  // The disqual occurs because each time we try to run we wind up
    1.16 +  // bailing due to running out of memory or requesting a GC.
    1.17 +  assertParallelExecWillBail(function (m) {
    1.18 +    ints.mapPar(kernel, m);
    1.19 +  });
    1.20 +
    1.21 +  function kernel(v) {
    1.22 +    var x = [];
    1.23 +
    1.24 +    if (inParallelSection()) {
    1.25 +      // don't bother to stress test the non-parallel paths!
    1.26 +      for (var i = 0; i < 50; i++) {
    1.27 +        x[i] = [];
    1.28 +        for (var j = 0; j < 1024; j++) {
    1.29 +          x[i][j] = j;
    1.30 +        }
    1.31 +      }
    1.32 +    }
    1.33 +
    1.34 +    return x;
    1.35 +  }
    1.36 +}
    1.37 +
    1.38 +if (getBuildConfiguration().parallelJS)
    1.39 +  testMap();
    1.40 +

mercurial