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

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

Issue 2883853002: [turbofan] Always inline small functions directly. (Closed)
Patch Set: Check frequency Created 3 years, 7 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 | « no previous file | src/flag-definitions.h » ('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 7442860a7e6aac289ee312ecb3fd7b091616afda..942968aaa5c0fc2929f26eb9365684066a4fb808 100644
--- a/src/compiler/js-inlining-heuristic.cc
+++ b/src/compiler/js-inlining-heuristic.cc
@@ -65,6 +65,15 @@ bool CanInlineFunction(Handle<SharedFunctionInfo> shared) {
return true;
}
+bool IsSmallInlineFunction(Handle<SharedFunctionInfo> shared) {
+ // Don't forcibly inline functions that weren't compiled yet.
+ if (shared->ast_node_count() == 0) return false;
+
+ // Forcibly inline small functions.
+ if (shared->ast_node_count() <= FLAG_max_inlined_nodes_small) return true;
+ return false;
+}
+
} // namespace
Reduction JSInliningHeuristic::Reduce(Node* node) {
@@ -91,7 +100,7 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
}
// Functions marked with %SetForceInlineFlag are immediately inlined.
- bool can_inline = false, force_inline = true;
+ bool can_inline = false, force_inline = true, small_inline = true;
for (int i = 0; i < candidate.num_functions; ++i) {
Handle<SharedFunctionInfo> shared =
candidate.functions[i].is_null()
@@ -103,6 +112,9 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
if (CanInlineFunction(shared)) {
can_inline = true;
}
+ if (!IsSmallInlineFunction(shared)) {
+ small_inline = false;
+ }
}
if (force_inline) return InlineCandidate(candidate);
if (!can_inline) return NoChange();
@@ -154,6 +166,13 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
return NoChange();
}
+ // Forcibly inline small functions here.
+ if (small_inline) {
+ TRACE("Inlining small function(s) at call site #%d:%s\n", node->id(),
+ node->op()->mnemonic());
+ return InlineCandidate(candidate);
+ }
+
// In the general case we remember the candidate for later.
candidates_.insert(candidate);
return NoChange();
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698