Bug 996983 - Part 3: Push JitActivations for each PJS thread during ForkJoin. (r=nmatsakis)

This commit is contained in:
Shu-yu Guo 2014-04-30 21:12:17 -07:00
parent 0b8fefa207
commit 763fd5c59f
3 changed files with 22 additions and 7 deletions

View File

@ -1331,10 +1331,11 @@ class ParallelIonInvoke
calleeToken_ = CalleeToToken(callee); calleeToken_ = CalleeToToken(callee);
} }
bool invoke(PerThreadData *perThread) { bool invoke(ForkJoinContext *cx) {
RootedValue result(perThread); JitActivation activation(cx);
Value result;
CALL_GENERATED_CODE(enter_, jitcode_, argc_ + 1, argv_ + 1, nullptr, calleeToken_, CALL_GENERATED_CODE(enter_, jitcode_, argc_ + 1, argv_ + 1, nullptr, calleeToken_,
nullptr, 0, result.address()); nullptr, 0, &result);
return !result.isMagic(); return !result.isMagic();
} }
}; };
@ -1535,13 +1536,13 @@ ForkJoinShared::executePortion(PerThreadData *perThread, ThreadPoolWorker *worke
cx.bailoutRecord->setCause(ParallelBailoutMainScriptNotPresent); cx.bailoutRecord->setCause(ParallelBailoutMainScriptNotPresent);
setAbortFlagAndRequestInterrupt(false); setAbortFlagAndRequestInterrupt(false);
} else { } else {
ParallelIonInvoke<3> fii(cx_->runtime(), fun_, 3); ParallelIonInvoke<3> fii(runtime(), fun_, 3);
fii.args[0] = Int32Value(worker->id()); fii.args[0] = Int32Value(worker->id());
fii.args[1] = Int32Value(sliceStart_); fii.args[1] = Int32Value(sliceStart_);
fii.args[2] = Int32Value(sliceEnd_); fii.args[2] = Int32Value(sliceEnd_);
bool ok = fii.invoke(perThread); bool ok = fii.invoke(&cx);
JS_ASSERT(ok == !cx.bailoutRecord->topScript); JS_ASSERT(ok == !cx.bailoutRecord->topScript);
if (!ok) if (!ok)
setAbortFlagAndRequestInterrupt(false); setAbortFlagAndRequestInterrupt(false);

View File

@ -1538,6 +1538,19 @@ jit::JitActivation::JitActivation(JSContext *cx, bool firstFrameIsConstructing,
} }
} }
jit::JitActivation::JitActivation(ForkJoinContext *cx)
: Activation(cx, Jit),
firstFrameIsConstructing_(false),
active_(true)
#ifdef JS_ION
, rematerializedFrames_(nullptr)
#endif
{
prevIonTop_ = cx->perThreadData->ionTop;
prevJitJSContext_ = cx->perThreadData->jitJSContext;
cx->perThreadData->jitJSContext = nullptr;
}
jit::JitActivation::~JitActivation() jit::JitActivation::~JitActivation()
{ {
if (active_) { if (active_) {
@ -1714,10 +1727,10 @@ AsmJSActivation::~AsmJSActivation()
profiler_->exitNative(); profiler_->exitNative();
JSContext *cx = cx_->asJSContext(); JSContext *cx = cx_->asJSContext();
JS_ASSERT(cx->runtime()->mainThread.asmJSActivationStack_ == this); JS_ASSERT(cx->mainThread().asmJSActivationStack_ == this);
JSRuntime::AutoLockForInterrupt lock(cx->runtime()); JSRuntime::AutoLockForInterrupt lock(cx->runtime());
cx->runtime()->mainThread.asmJSActivationStack_ = prevAsmJS_; cx->mainThread().asmJSActivationStack_ = prevAsmJS_;
} }
InterpreterFrameIterator & InterpreterFrameIterator &

View File

@ -1356,6 +1356,7 @@ class JitActivation : public Activation
public: public:
JitActivation(JSContext *cx, bool firstFrameIsConstructing, bool active = true); JitActivation(JSContext *cx, bool firstFrameIsConstructing, bool active = true);
JitActivation(ForkJoinContext *cx);
~JitActivation(); ~JitActivation();
bool isActive() const { bool isActive() const {