Chromium Code Reviews| Index: src/compiler/js-inlining-heuristic.cc |
| diff --git a/src/compiler/js-inlining-heuristic.cc b/src/compiler/js-inlining-heuristic.cc |
| index 26c9b1d33ef082ad947f95bb8cb25679d17bbf9f..a526cf5f9c2c3b6d5617a422cc9e40aade58a261 100644 |
| --- a/src/compiler/js-inlining-heuristic.cc |
| +++ b/src/compiler/js-inlining-heuristic.cc |
| @@ -123,22 +123,12 @@ Reduction JSInliningHeuristic::Reduce(Node* node) { |
| // Gather feedback on how often this call site has been hit before. |
| if (node->opcode() == IrOpcode::kJSCallFunction) { |
| - CallFunctionParameters p = CallFunctionParametersOf(node->op()); |
| - if (p.feedback().IsValid()) { |
| - CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
| - candidate.calls = nexus.ExtractCallCount(); |
| - } |
| + CallFunctionParameters const p = CallFunctionParametersOf(node->op()); |
| + candidate.frequency = p.frequency(); |
| } else { |
| DCHECK_EQ(IrOpcode::kJSCallConstruct, node->opcode()); |
| - CallConstructParameters p = CallConstructParametersOf(node->op()); |
| - if (p.feedback().IsValid()) { |
| - int const extra_index = |
| - p.feedback().vector()->GetIndex(p.feedback().slot()) + 1; |
| - Object* feedback_extra = p.feedback().vector()->get(extra_index); |
| - if (feedback_extra->IsSmi()) { |
| - candidate.calls = Smi::cast(feedback_extra)->value(); |
| - } |
| - } |
| + CallConstructParameters const p = CallConstructParametersOf(node->op()); |
| + candidate.frequency = p.frequency(); |
| } |
| // Handling of special inlining modes right away: |
| @@ -280,17 +270,20 @@ Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate) { |
| bool JSInliningHeuristic::CandidateCompare::operator()( |
| const Candidate& left, const Candidate& right) const { |
| - if (left.calls != right.calls) { |
| - return left.calls > right.calls; |
| + if (left.frequency > right.frequency) { |
| + return true; |
| + } else if (left.frequency < right.frequency) { |
| + return false; |
| + } else { |
| + return left.node < right.node; |
|
Jarin
2016/09/12 13:10:01
Could we compare on node->id(), so that we do not
Benedikt Meurer
2016/09/13 17:45:07
Done.
|
| } |
| - return left.node < right.node; |
| } |
| void JSInliningHeuristic::PrintCandidates() { |
| PrintF("Candidates for inlining (size=%zu):\n", candidates_.size()); |
| for (const Candidate& candidate : candidates_) { |
| - PrintF(" #%d:%s, calls:%d\n", candidate.node->id(), |
| - candidate.node->op()->mnemonic(), candidate.calls); |
| + PrintF(" #%d:%s, frequency:%g\n", candidate.node->id(), |
| + candidate.node->op()->mnemonic(), candidate.frequency); |
| for (int i = 0; i < candidate.num_functions; ++i) { |
| Handle<JSFunction> function = candidate.functions[i]; |
| PrintF(" - size[source]:%d, size[ast]:%d, name: %s\n", |