void JITCode::setOptimizationThresholdBasedOnCompilationResult( CodeBlock* codeBlock, CompilationResult result) { ASSERT(codeBlock->jitType() == JITCode::DFGJIT); switch (result) { case CompilationSuccessful: optimizeNextInvocation(codeBlock); return; case CompilationFailed: dontOptimizeAnytimeSoon(codeBlock); codeBlock->baselineVersion()->m_didFailFTLCompilation = true; return; case CompilationDeferred: optimizeAfterWarmUp(codeBlock); return; case CompilationInvalidated: // This is weird - it will only happen in cases when the DFG code block (i.e. // the code block that this JITCode belongs to) is also invalidated. So it // doesn't really matter what we do. But, we do the right thing anyway. Note // that us counting the reoptimization actually means that we might count it // twice. But that's generally OK. It's better to overcount reoptimizations // than it is to undercount them. codeBlock->baselineVersion()->countReoptimization(); optimizeAfterWarmUp(codeBlock); return; } RELEASE_ASSERT_NOT_REACHED(); }
JSValue optimizeNextInvocation(ExecState* exec) { if (exec->argumentCount() < 1) return jsUndefined(); return optimizeNextInvocation(exec->uncheckedArgument(0)); }