Bug 972579 -- Add worker id

This commit is contained in:
Nicholas D. Matsakis 2014-02-13 15:36:06 -05:00
parent f1cdaa0e45
commit 5b343adea6
2 changed files with 13 additions and 11 deletions

View File

@ -715,7 +715,7 @@ function ArrayMapPar(func, mode) {
UnsafePutElements(buffer, i, func(self[i], i, self));
return buffer;
function mapThread(warmup) {
function mapThread(_, warmup) {
var sliceId;
while (GET_SLICE(slicesInfo, sliceId)) {
var indexStart = SLICE_START(slicesInfo, sliceId);
@ -770,7 +770,7 @@ function ArrayReducePar(func, mode) {
accumulator = func(accumulator, self[i]);
return accumulator;
function reduceThread(warmup) {
function reduceThread(_, warmup) {
var sliceId;
while (GET_SLICE(slicesInfo, sliceId)) {
var indexStart = SLICE_START(slicesInfo, sliceId);
@ -867,7 +867,7 @@ function ArrayScanPar(func, mode) {
*
* Read on in phase2 to see what we do next!
*/
function phase1(warmup) {
function phase1(_, warmup) {
var sliceId;
while (GET_SLICE(slicesInfo, sliceId)) {
var indexStart = SLICE_START(slicesInfo, sliceId);
@ -919,7 +919,7 @@ function ArrayScanPar(func, mode) {
* result is [(A+B+C)+D, (A+B+C)+(D+E), (A+B+C)+(D+E+F)]. Again I
* am using parentheses to clarify how these results were reduced.
*/
function phase2(warmup) {
function phase2(_, warmup) {
var sliceId;
while (GET_SLICE(slicesInfo, sliceId)) {
var indexPos = SLICE_START(slicesInfo, sliceId);
@ -1087,7 +1087,7 @@ function ArrayFilterPar(func, mode) {
* time. When we finish a chunk, we record our current count and
* the next chunk sliceId, lest we should bail.
*/
function findSurvivorsThread(warmup) {
function findSurvivorsThread(_, warmup) {
var sliceId;
while (GET_SLICE(slicesInfo, sliceId)) {
var count = 0;
@ -1112,7 +1112,7 @@ function ArrayFilterPar(func, mode) {
}
}
function copySurvivorsThread(warmup) {
function copySurvivorsThread(_, warmup) {
var sliceId;
while (GET_SLICE(slicesInfo, sliceId)) {
// Copies the survivors from this slice into the correct position.
@ -1214,7 +1214,7 @@ function ArrayStaticBuildPar(length, func, mode) {
UnsafePutElements(buffer, i, func(i));
return buffer;
function constructThread(warmup) {
function constructThread(_, warmup) {
var sliceId;
while (GET_SLICE(slicesInfo, sliceId)) {
var indexStart = SLICE_START(slicesInfo, sliceId);

View File

@ -173,11 +173,12 @@ ExecuteSequentially(JSContext *cx, HandleValue funVal)
{
FastInvokeGuard fig(cx, funVal);
InvokeArgs &args = fig.args();
if (!args.init(1))
if (!args.init(2))
return false;
args.setCallee(funVal);
args.setThis(UndefinedValue());
args[0].setBoolean(!!cx->runtime()->forkJoinWarmup);
args[0].setInt32(0); // always worker 0 in seq
args[1].setBoolean(!!cx->runtime()->forkJoinWarmup);
return fig.invoke(cx);
}
@ -1520,9 +1521,10 @@ ForkJoinShared::executePortion(PerThreadData *perThread, uint32_t workerId)
cx.bailoutRecord->setCause(ParallelBailoutMainScriptNotPresent);
setAbortFlagAndTriggerOperationCallback(false);
} else {
ParallelIonInvoke<2> fii(cx_->runtime(), fun_, 1);
ParallelIonInvoke<2> fii(cx_->runtime(), fun_, 2);
fii.args[0] = BooleanValue(false);
fii.args[0] = Int32Value(workerId);
fii.args[1] = BooleanValue(false);
bool ok = fii.invoke(perThread);
JS_ASSERT(ok == !cx.bailoutRecord->topScript);