js/src/jit-test/tests/parallel/gc-timeout.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/gc-timeout.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +// |jit-test| exitstatus: 6;
     1.5 +
     1.6 +// One sneaky way to run GC during a parallel section is to invoke the
     1.7 +// gc() function during the parallel timeout!
     1.8 +
     1.9 +load(libdir + "parallelarray-helpers.js");
    1.10 +
    1.11 +function iterate(x) {
    1.12 +  while (x == 2046) {
    1.13 +    // for exactly one index, this infinitely loops!
    1.14 +    // this ensures that the warmup doesn't loop.
    1.15 +  }
    1.16 +  return 22;
    1.17 +}
    1.18 +
    1.19 +function timeoutfunc() {
    1.20 +  print("Timed out, invoking the GC");
    1.21 +  gc();
    1.22 +  return false;
    1.23 +}
    1.24 +
    1.25 +timeout(1, timeoutfunc);
    1.26 +
    1.27 +if (getBuildConfiguration().parallelJS)
    1.28 +  Array.buildPar(2048, iterate);
    1.29 +else
    1.30 +  while(true);

mercurial