EnterJitStatus js::jit::MaybeEnterJit(JSContext* cx, RunState& state) { JSScript* script = state.script(); uint8_t* code = script->jitCodeRaw(); do { // Make sure we have a BaselineScript: we don't want to call the // interpreter stub here. Note that Baseline code contains warm-up // checks in the prologue to Ion-compile if needed. if (script->hasBaselineScript()) { break; } // Try to Ion-compile. if (jit::IsIonEnabled(cx)) { jit::MethodStatus status = jit::CanEnterIon(cx, state); if (status == jit::Method_Error) { return EnterJitStatus::Error; } if (status == jit::Method_Compiled) { code = script->jitCodeRaw(); break; } } // Try to Baseline-compile. if (jit::IsBaselineEnabled(cx)) { jit::MethodStatus status = jit::CanEnterBaselineMethod(cx, state); if (status == jit::Method_Error) { return EnterJitStatus::Error; } if (status == jit::Method_Compiled) { code = script->jitCodeRaw(); break; } } return EnterJitStatus::NotEntered; } while (false); return EnterJit(cx, state, code); }