diff --git a/js/src/ion/BaselineJIT.cpp b/js/src/ion/BaselineJIT.cpp index cd8dbe13a821..a3f20b27e810 100644 --- a/js/src/ion/BaselineJIT.cpp +++ b/js/src/ion/BaselineJIT.cpp @@ -195,7 +195,7 @@ ion::EnterBaselineAtBranch(JSContext *cx, StackFrame *fp, jsbytecode *pc) } static MethodStatus -BaselineCompile(JSContext *cx, HandleScript script, StackFrame *fp) +BaselineCompile(JSContext *cx, HandleScript script) { JS_ASSERT(!script->baseline); @@ -261,7 +261,23 @@ ion::CanEnterBaselineJIT(JSContext *cx, JSScript *scriptArg, StackFrame *fp, boo if (scriptArg->incUseCount() <= js_IonOptions.baselineUsesBeforeCompile && !IsJSDEnabled(cx)) return Method_Skipped; - return BaselineCompile(cx, script, fp); + if (script->isCallsiteClone) { + // Ensure the original function is compiled too, so that bailouts from + // Ion code have a BaselineScript to resume into. + RootedScript original(cx, script->originalFunction()->nonLazyScript()); + JS_ASSERT(original != script); + + if (original->baseline == BASELINE_DISABLED_SCRIPT) + return Method_CantCompile; + + if (!original->hasBaselineScript()) { + MethodStatus status = BaselineCompile(cx, original); + if (status != Method_Compiled) + return status; + } + } + + return BaselineCompile(cx, script); } // Be safe, align IC entry list to 8 in all cases. diff --git a/js/src/ion/IonBuilder.cpp b/js/src/ion/IonBuilder.cpp index 3736897677a8..4f8513d8bc20 100644 --- a/js/src/ion/IonBuilder.cpp +++ b/js/src/ion/IonBuilder.cpp @@ -208,7 +208,10 @@ IonBuilder::canInlineTarget(JSFunction *target) } // Don't inline functions which don't have baseline scripts compiled for them. - if (executionMode == SequentialExecution && !inlineScript->hasBaselineScript()) { + if (executionMode == SequentialExecution && + ion::IsBaselineEnabled(cx) && + !inlineScript->hasBaselineScript()) + { IonSpew(IonSpew_Inlining, "Cannot inline target with no baseline jitcode"); return false; }