Bug 860239 - Make Ion OSR a bit more robust against scripts with multiple loops. r=bhackett

This commit is contained in:
Jan de Mooij 2013-04-13 15:04:22 +02:00
parent e796baee59
commit 430d9134e2
3 changed files with 30 additions and 1 deletions

View File

@ -562,6 +562,7 @@ IonScript::IonScript()
callTargetEntries_(0),
refcount_(0),
recompileInfo_(),
osrPcMismatchCounter_(0),
slowCallCount(0)
{
}
@ -1623,8 +1624,19 @@ ion::CanEnterAtBranch(JSContext *cx, JSScript *script, AbstractFramePtr fp,
return status;
}
if (script->hasIonScript() && script->ionScript()->osrPc() != pc)
if (script->ionScript()->osrPc() != pc) {
// If we keep failing to enter the script due to an OSR pc mismatch,
// invalidate the script to force a recompile.
uint32_t count = script->ionScript()->incrOsrPcMismatchCounter();
if (count > js_IonOptions.osrPcMismatchesBeforeRecompile) {
if (!Invalidate(cx, script, SequentialExecution, true))
return Method_Error;
}
return Method_Skipped;
}
script->ionScript()->resetOsrPcMismatchCounter();
return Method_Compiled;
}

View File

@ -115,6 +115,12 @@ struct IonOptions
// Default: .125
double usesBeforeInliningFactor;
// How many times we will try to enter a script via OSR before
// invalidating the script.
//
// Default: 6,000
uint32_t osrPcMismatchesBeforeRecompile;
// How many actual arguments are accepted on the C stack.
//
// Default: 4,096
@ -207,6 +213,7 @@ struct IonOptions
usesBeforeCompile(1000),
usesBeforeCompileNoJaeger(40),
usesBeforeInliningFactor(.125),
osrPcMismatchesBeforeRecompile(6000),
maxStackArgs(4096),
maxInlineDepth(3),
smallFunctionMaxInlineDepth(10),

View File

@ -237,6 +237,10 @@ struct IonScript
// Identifier of the compilation which produced this code.
types::RecompileInfo recompileInfo_;
// Number of times we tried to enter this script via OSR but failed due to
// a LOOPENTRY pc other than osrPc_.
uint32_t osrPcMismatchCounter_;
private:
inline uint8_t *bottomBuffer() {
return reinterpret_cast<uint8_t *>(this);
@ -462,6 +466,12 @@ struct IonScript
const types::RecompileInfo& recompileInfo() const {
return recompileInfo_;
}
uint32_t incrOsrPcMismatchCounter() {
return ++osrPcMismatchCounter_;
}
void resetOsrPcMismatchCounter() {
osrPcMismatchCounter_ = 0;
}
};
// Execution information for a basic block which may persist after the