Back out 5ecede5e0ceb (bug 931864) for assertions

This commit is contained in:
Phil Ringnalda 2013-11-23 21:53:45 -08:00
parent 559243f79d
commit b96b144d65
4 changed files with 12 additions and 49 deletions

View File

@ -4503,6 +4503,13 @@ JS::CanCompileOffThread(JSContext *cx, const ReadOnlyCompileOptions &options)
if (!cx->runtime()->useHelperThreadsForParsing())
return false;
// Off thread compilation can't occur during incremental collections on the
// atoms compartment, to avoid triggering barriers. Outside the atoms
// compartment, the compilation will use a new zone which doesn't require
// barriers itself.
if (cx->runtime()->activeGCInAtomsZone())
return false;
return true;
#else
return false;

View File

@ -4113,10 +4113,6 @@ EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, bool lastGC)
FinishMarkingValidation(rt);
rt->gcLastGCTime = PRMJ_Now();
#ifdef JS_WORKER_THREADS
EnqueuePendingParseTasksAfterGC(rt);
#endif
}
namespace {

View File

@ -267,53 +267,23 @@ js::StartOffThreadParseScript(JSContext *cx, const ReadOnlyCompileOptions &optio
ScopedJSDeletePtr<ParseTask> task(
cx->new_<ParseTask>(workercx.get(), cx, chars, length,
scopeChain, callback, callbackData));
if (!task)
if (!task || !task->init(cx, options))
return false;
workercx.forget();
if (!task->init(cx, options))
return false;
WorkerThreadState &state = *cx->runtime()->workerThreadState;
JS_ASSERT(state.numThreads);
// Off thread parsing can't occur during incremental collections on the
// atoms compartment, to avoid triggering barriers. (Outside the atoms
// compartment, the compilation will use a new zone which doesn't require
// barriers itself.) If an atoms-zone GC is in progress, hold off on
// executing the parse task until the atoms-zone GC completes (see
// EnqueuePendingParseTasksAfterGC).
if (cx->runtime()->activeGCInAtomsZone()) {
if (!state.parseWaitingOnGC.append(task.get()))
return false;
} else {
AutoLockWorkerThreadState lock(state);
AutoLockWorkerThreadState lock(state);
if (!state.parseWorklist.append(task.get()))
return false;
state.notifyAll(WorkerThreadState::PRODUCER);
}
if (!state.parseWorklist.append(task.get()))
return false;
task.forget();
return true;
}
void
js::EnqueuePendingParseTasksAfterGC(JSRuntime *rt)
{
if (!rt->workerThreadState || rt->workerThreadState->parseWaitingOnGC.empty())
return;
WorkerThreadState &state = *rt->workerThreadState;
AutoLockWorkerThreadState lock(state);
JS_ASSERT(state.parseWorklist.empty());
state.parseWorklist.swap(state.parseWaitingOnGC);
state.notifyAll(WorkerThreadState::PRODUCER);
return true;
}
void

View File

@ -71,9 +71,6 @@ class WorkerThreadState
/* Shared worklist for parsing/emitting scripts on worker threads. */
Vector<ParseTask*, 0, SystemAllocPolicy> parseWorklist, parseFinishedList;
/* Main-thread-only list of parse tasks waiting for an atoms-zone GC to complete. */
Vector<ParseTask*, 0, SystemAllocPolicy> parseWaitingOnGC;
/* Worklist for source compression worker threads. */
Vector<SourceCompressionTask *, 0, SystemAllocPolicy> compressionWorklist;
@ -245,13 +242,6 @@ StartOffThreadParseScript(JSContext *cx, const ReadOnlyCompileOptions &options,
const jschar *chars, size_t length, HandleObject scopeChain,
JS::OffThreadCompileCallback callback, void *callbackData);
/*
* Called at the end of GC to enqueue any Parse tasks that were waiting on an
* atoms-zone GC to finish.
*/
void
EnqueuePendingParseTasksAfterGC(JSRuntime *rt);
/* Block until in progress and pending off thread parse jobs have finished. */
void
WaitForOffThreadParsingToFinish(JSRuntime *rt);