Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: src/compiler/js-inlining-heuristic.cc

Issue 2330883002: [turbofan] Call frequencies for JSCallFunction and JSCallConstruct. (Closed)
Patch Set: Rebase onto the correct CL. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-inlining-heuristic.h ('k') | src/compiler/js-intrinsic-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-inlining-heuristic.cc
diff --git a/src/compiler/js-inlining-heuristic.cc b/src/compiler/js-inlining-heuristic.cc
index c5ede0a35f73dad33a28a5dfffb2e94fdd340861..e237af3e9f0db1c8f6f2bd95ee4878e3baae5f23 100644
--- a/src/compiler/js-inlining-heuristic.cc
+++ b/src/compiler/js-inlining-heuristic.cc
@@ -123,18 +123,11 @@ 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()) {
- CallICNexus nexus(p.feedback().vector(), p.feedback().slot());
- candidate.calls = nexus.ExtractCallCount();
- }
+ CallConstructParameters const p = CallConstructParametersOf(node->op());
+ candidate.frequency = p.frequency();
}
// Handling of special inlining modes right away:
@@ -278,17 +271,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->id() > right.node->id();
}
- return left.node->id() > right.node->id();
}
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",
« no previous file with comments | « src/compiler/js-inlining-heuristic.h ('k') | src/compiler/js-intrinsic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698