diff --git a/js/src/jit/BaselineJIT.cpp b/js/src/jit/BaselineJIT.cpp index 42e1bde06c5..f256f6f89a8 100644 --- a/js/src/jit/BaselineJIT.cpp +++ b/js/src/jit/BaselineJIT.cpp @@ -891,6 +891,10 @@ jit::FinishDiscardBaselineScript(FreeOp *fop, JSScript *script) // Reset |active| flag so that we don't need a separate script // iteration to unmark them. script->baselineScript()->resetActive(); + + // The baseline caches have been wiped out, so the script will need to + // warm back up before it can be inlined during Ion compilation. + script->baselineScript()->clearIonCompiledOrInlined(); return; } diff --git a/js/src/jit/BaselineJIT.h b/js/src/jit/BaselineJIT.h index 2eaff1a4a80..357afa148f0 100644 --- a/js/src/jit/BaselineJIT.h +++ b/js/src/jit/BaselineJIT.h @@ -151,7 +151,12 @@ struct BaselineScript // Flag set when compiled for use for debug mode. Handles various // Debugger hooks and compiles toggled calls for traps. - DEBUG_MODE = 1 << 3 + DEBUG_MODE = 1 << 3, + + // Flag set if this script has ever been Ion compiled, either directly + // or inlined into another script. This is cleared when the script's + // type information or caches are cleared. + ION_COMPILED_OR_INLINED = 1 << 4 }; private: @@ -229,6 +234,16 @@ struct BaselineScript return flags_ & DEBUG_MODE; } + void setIonCompiledOrInlined() { + flags_ |= ION_COMPILED_OR_INLINED; + } + void clearIonCompiledOrInlined() { + flags_ &= ~ION_COMPILED_OR_INLINED; + } + bool ionCompiledOrInlined() const { + return flags_ & ION_COMPILED_OR_INLINED; + } + uint32_t prologueOffset() const { return prologueOffset_; } diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index fb89a5a623e..33d0f7dd894 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -148,6 +148,9 @@ IonBuilder::IonBuilder(JSContext *analysisContext, CompileCompartment *comp, JS_ASSERT(script()->hasBaselineScript() == (info->executionMode() != ArgumentsUsageAnalysis)); JS_ASSERT(!!analysisContext == (info->executionMode() == DefinitePropertiesAnalysis)); + + if (!info->executionModeIsAnalysis()) + script()->baselineScript()->setIonCompiledOrInlined(); } void @@ -4202,6 +4205,7 @@ IonBuilder::makeInliningDecision(JSFunction *target, CallInfo &callInfo) // type information, except for definite properties analysis, // as the caller has not run yet. if (targetScript->getUseCount() < optimizationInfo().usesBeforeInlining() && + !targetScript->baselineScript()->ionCompiledOrInlined() && info().executionMode() != DefinitePropertiesAnalysis) { return DontInline(targetScript, "Vetoed: callee is insufficiently hot.");