bool profileFunc(const Func* func) { if (!shouldPGOFunc(func)) return false; // If retranslateAll is enabled and we already passed the point that it should // be scheduled to execute (via the treadmill), then we can't emit more // Profile translations. This is to ensure that, when retranslateAll() runs, // no more Profile translations are being added to ProfData. if (RuntimeOption::EvalJitRetranslateAllRequest != 0 && hasEnoughProfDataToRetranslateAll()) { return false; } if (profData()->optimized(func->getFuncId())) return false; // If we already started profiling `func', then we return true and skip the // other checks below. if (profData()->profiling(func->getFuncId())) return true; // Don't start profiling new functions if the size of either main or // prof is already above Eval.JitAMaxUsage and we already filled hot. auto tcUsage = std::max(code().main().used(), code().prof().used()); if (tcUsage >= CodeCache::AMaxUsage && !code().hotEnabled()) { return false; } // We have two knobs to control the number of functions we're allowed to // profile: Eval.JitProfileRequests and Eval.JitProfileBCSize. We profile new // functions until either of these limits is exceeded. In practice, we expect // to hit the bytecode size limit first, but we keep the request limit around // as a safety net. if (RuntimeOption::EvalJitProfileBCSize > 0 && profData()->profilingBCSize() >= RuntimeOption::EvalJitProfileBCSize) { return false; } return requestCount() <= RuntimeOption::EvalJitProfileRequests; }
bool profileSrcKey(SrcKey sk) { if (!shouldPGOFunc(*sk.func())) return false; if (profData()->optimized(sk.funcID())) return false; if (profData()->profiling(sk.funcID())) return true; // Don't start profiling new functions if the size of either main or // prof is already above Eval.JitAMaxUsage and we already filled hot. auto tcUsage = std::max(code().main().used(), code().prof().used()); if (tcUsage >= CodeCache::AMaxUsage && !code().hotEnabled()) { return false; } // We have two knobs to control the number of functions we're allowed to // profile: Eval.JitProfileRequests and Eval.JitProfileBCSize. We profile new // functions until either of these limits is exceeded. In practice we expect // to hit the bytecode size limit first but we keep the request limit around // as a safety net. if (RuntimeOption::EvalJitProfileBCSize > 0 && profData()->profilingBCSize() >= RuntimeOption::EvalJitProfileBCSize) { return false; } return requestCount() <= RuntimeOption::EvalJitProfileRequests; }