[Turbofan] Don't inline if we never saw a function.
Also prevent division by zero. R=tebbi@chromium.org BUG= Review-Url: https://codereview.chromium.org/2731723002 Cr-Commit-Position: refs/heads/master@{#43590}
This commit is contained in:
parent
5f79c9231a
commit
5f10c6820d
@ -164,6 +164,10 @@ void JSInliningHeuristic::Finalize() {
|
||||
auto i = candidates_.begin();
|
||||
Candidate candidate = *i;
|
||||
candidates_.erase(i);
|
||||
// Only include candidates that we've successfully called before.
|
||||
// The candidate list is sorted, so we can exit at the first occurance of
|
||||
// frequency 0 in the list.
|
||||
if (candidate.frequency <= 0.0) return;
|
||||
// Make sure we don't try to inline dead candidate nodes.
|
||||
if (!candidate.node->IsDead()) {
|
||||
Reduction const reduction = InlineCandidate(candidate);
|
||||
|
@ -591,6 +591,10 @@ int CallICNexus::ExtractCallCount() {
|
||||
float CallICNexus::ComputeCallFrequency() {
|
||||
double const invocation_count = vector()->invocation_count();
|
||||
double const call_count = ExtractCallCount();
|
||||
if (invocation_count == 0) {
|
||||
// Prevent division by 0.
|
||||
return 0.0f;
|
||||
}
|
||||
return static_cast<float>(call_count / invocation_count);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user