Skip to content

Commit 81011f8

Browse files
committed
[1.8>master] [MERGE #4388 @MikeHolman] Stop trying to JIT if OOP JIT disconnected
Merge pull request #4388 from MikeHolman:nojitondc Continuing to attempt to JIT makes the interpreter much slower than it would otherwise be, because you end up creating a work item every call/every loop top
2 parents 24638a1 + 52d0b6a commit 81011f8

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

lib/Backend/NativeCodeGenerator.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,9 +1870,19 @@ NativeCodeGenerator::Prioritize(JsUtil::Job *const job, const bool forceAddJobTo
18701870
}
18711871
else
18721872
{
1873-
if(!forceAddJobToProcessor && !functionBody->TryTransitionToJitExecutionMode())
1873+
if (!forceAddJobToProcessor)
18741874
{
1875-
return;
1875+
if (!functionBody->TryTransitionToJitExecutionMode())
1876+
{
1877+
return;
1878+
}
1879+
#if ENABLE_OOP_NATIVE_CODEGEN
1880+
// If for some reason OOP JIT isn't connected (e.g. it crashed), don't attempt to JIT
1881+
if (JITManager::GetJITManager()->IsOOPJITEnabled() && !JITManager::GetJITManager()->IsConnected())
1882+
{
1883+
return;
1884+
}
1885+
#endif
18761886
}
18771887

18781888
jitMode = functionBody->GetExecutionMode();

lib/Runtime/Language/InterpreterStackFrame.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6084,6 +6084,13 @@ const byte * InterpreterStackFrame::OP_ProfiledLoopBodyStart(uint loopId)
60846084
}
60856085

60866086
#if ENABLE_NATIVE_CODEGEN
6087+
#if ENABLE_OOP_NATIVE_CODEGEN
6088+
// If for some reason OOP JIT isn't connected (e.g. it crashed), don't attempt to JIT a loop body
6089+
if (JITManager::GetJITManager()->IsOOPJITEnabled() && !JITManager::GetJITManager()->IsConnected())
6090+
{
6091+
return nullptr;
6092+
}
6093+
#endif
60876094
// If the job is not scheduled then we need to schedule it now.
60886095
// It is possible a job was scheduled earlier and we find ourselves looking at the same entry point
60896096
// again. For example, if the function with the loop was JITed and bailed out then as we finish

lib/Runtime/Language/WAsmjsUtils.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,23 @@ template<> Types RegisterSpace::GetRegisterSpaceType<AsmJsSIMDValue>(){return WA
9696
bool ShouldJitFunction(Js::FunctionBody* body, uint interpretedCount)
9797
{
9898
#if ENABLE_NATIVE_CODEGEN
99-
const bool noJit = PHASE_OFF(Js::BackEndPhase, body) ||
99+
if (PHASE_OFF(Js::BackEndPhase, body) ||
100100
PHASE_OFF(Js::FullJitPhase, body) ||
101101
body->GetScriptContext()->GetConfig()->IsNoNative() ||
102-
body->GetIsAsmJsFullJitScheduled();
102+
body->GetIsAsmJsFullJitScheduled())
103+
{
104+
return false;
105+
}
106+
#if ENABLE_OOP_NATIVE_CODEGEN
107+
if (JITManager::GetJITManager()->IsOOPJITEnabled() && !JITManager::GetJITManager()->IsConnected())
108+
{
109+
return false;
110+
}
111+
#endif
103112
const bool forceNative = CONFIG_ISENABLED(Js::ForceNativeFlag);
104113
const uint minAsmJsInterpretRunCount = (uint)CONFIG_FLAG(MinAsmJsInterpreterRunCount);
105114
const uint maxAsmJsInterpretRunCount = (uint)CONFIG_FLAG(MaxAsmJsInterpreterRunCount);
106-
return !noJit && (forceNative || interpretedCount >= minAsmJsInterpretRunCount || interpretedCount >= maxAsmJsInterpretRunCount);
115+
return forceNative || interpretedCount >= minAsmJsInterpretRunCount || interpretedCount >= maxAsmJsInterpretRunCount;
107116
#else
108117
return false;
109118
#endif

0 commit comments

Comments
 (0)