void WorkerThread::handleIonWorkload(WorkerThreadState &state) { JS_ASSERT(state.isLocked()); JS_ASSERT(state.canStartIonCompile()); JS_ASSERT(idle()); ionBuilder = state.ionWorklist.popCopy(); DebugOnly<jit::ExecutionMode> executionMode = ionBuilder->info().executionMode(); JS_ASSERT(GetIonScript(ionBuilder->script(), executionMode) == ION_COMPILING_SCRIPT); state.unlock(); { jit::IonContext ictx(runtime, ionBuilder->script()->compartment(), &ionBuilder->temp()); ionBuilder->setBackgroundCodegen(jit::CompileBackEnd(ionBuilder)); } state.lock(); FinishOffThreadIonCompile(ionBuilder); ionBuilder = NULL; // Notify the main thread in case it is waiting for the compilation to finish. state.notify(WorkerThreadState::MAIN); // Ping the main thread so that the compiled code can be incorporated // at the next operation callback. Don't interrupt Ion code for this, as // this incorporation can be delayed indefinitely without affecting // performance as long as the main thread is actually executing Ion code. runtime->triggerOperationCallback(JSRuntime::TriggerCallbackAnyThreadDontStopIon); }
void WorkerThread::handleIonWorkload(WorkerThreadState &state) { JS_ASSERT(state.isLocked()); JS_ASSERT(state.canStartIonCompile()); JS_ASSERT(idle()); ionBuilder = state.ionWorklist.popCopy(); DebugOnly<ion::ExecutionMode> executionMode = ionBuilder->info().executionMode(); JS_ASSERT(GetIonScript(ionBuilder->script(), executionMode) == ION_COMPILING_SCRIPT); state.unlock(); { ion::IonContext ictx(runtime, ionBuilder->script()->compartment(), &ionBuilder->temp()); ionBuilder->setBackgroundCodegen(ion::CompileBackEnd(ionBuilder)); } state.lock(); FinishOffThreadIonCompile(ionBuilder); ionBuilder = NULL; // Notify the main thread in case it is waiting for the compilation to finish. state.notify(WorkerThreadState::MAIN); // Ping the main thread so that the compiled code can be incorporated // at the next operation callback. runtime->triggerOperationCallback(); }