From 1cf7a78420adcac0627dd788d1cb44be4002157b Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Thu, 13 Feb 2014 19:14:14 -0800 Subject: [PATCH] Bug 970427 - Push ForkJoinActivation after calling the bounds function. (r=nmatsakis) --- js/src/jit-test/tests/parallel/bug970427.js | 15 +++++++++++++++ js/src/vm/ForkJoin.cpp | 3 +-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 js/src/jit-test/tests/parallel/bug970427.js diff --git a/js/src/jit-test/tests/parallel/bug970427.js b/js/src/jit-test/tests/parallel/bug970427.js new file mode 100644 index 00000000000..ff93fb532ad --- /dev/null +++ b/js/src/jit-test/tests/parallel/bug970427.js @@ -0,0 +1,15 @@ +// XXXshu: I tried wrapping the entire test in an |if (pjs)|, but the timing +// is fragile and it no longer reproduced the bug, thus getting this value at +// the beginning. +var pjs = getBuildConfiguration().parallelJS; +function f(a, b) { + var o = a; + gczeal(2); +} +f(3, 4); +var len = 5000; +var iters = 100; +for (var i = 0; i < iters; i++) { + var par = pjs ? Array.buildPar(len, fill) : true; +} +function fill(i) { return 10/i; } diff --git a/js/src/vm/ForkJoin.cpp b/js/src/vm/ForkJoin.cpp index 79f8000ffb3..5a55c9e8923 100644 --- a/js/src/vm/ForkJoin.cpp +++ b/js/src/vm/ForkJoin.cpp @@ -1175,8 +1175,6 @@ ForkJoinOperation::parallelExecution(ExecutionStatus *status) // functions such as ForkJoin(). JS_ASSERT(ForkJoinContext::current() == nullptr); - ForkJoinActivation activation(cx_); - uint16_t from, to; if (!computeBounds(&from, &to)) { *status = ExecutionFatal; @@ -1189,6 +1187,7 @@ ForkJoinOperation::parallelExecution(ExecutionStatus *status) return RedLight; } + ForkJoinActivation activation(cx_); ThreadPool *threadPool = &cx_->runtime()->threadPool; ForkJoinShared shared(cx_, threadPool, fun_, from, to, &bailoutRecords_[0]); if (!shared.init()) {