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

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

Issue 2325943002: [turbofan] Initial support for polymorphic inlining. (Closed)
Patch Set: Addressed feedback. 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
Index: src/compiler/js-inlining-heuristic.h
diff --git a/src/compiler/js-inlining-heuristic.h b/src/compiler/js-inlining-heuristic.h
index 7f577475bf46f02d218a91a0ff7a48c6c861b5b2..87b3c864e02838313bfeb7cc1652b479af43ebbe 100644
--- a/src/compiler/js-inlining-heuristic.h
+++ b/src/compiler/js-inlining-heuristic.h
@@ -21,7 +21,7 @@ class JSInliningHeuristic final : public AdvancedReducer {
inliner_(editor, local_zone, info, jsgraph),
candidates_(local_zone),
seen_(local_zone),
- info_(info) {}
+ jsgraph_(jsgraph) {}
Reduction Reduce(Node* node) final;
@@ -30,10 +30,15 @@ class JSInliningHeuristic final : public AdvancedReducer {
void Finalize() final;
private:
+ // This limit currently matches what Crankshaft does. We may want to
+ // re-evaluate and come up with a proper limit for TurboFan.
+ static const int kMaxCallPolymorphism = 4;
+
struct Candidate {
- Handle<JSFunction> function; // The call target being inlined.
- Node* node; // The call site at which to inline.
- int calls; // Number of times the call site was hit.
+ Handle<JSFunction> functions[kMaxCallPolymorphism];
+ int num_functions;
+ Node* node = nullptr; // The call site at which to inline.
+ int calls = -1; // Number of times the call site was hit.
};
// Comparator for candidates.
@@ -46,12 +51,18 @@ class JSInliningHeuristic final : public AdvancedReducer {
// Dumps candidates to console.
void PrintCandidates();
+ Reduction InlineCandidate(Candidate const& candidate);
+
+ CommonOperatorBuilder* common() const;
+ Graph* graph() const;
+ JSGraph* jsgraph() const { return jsgraph_; }
+ SimplifiedOperatorBuilder* simplified() const;
Mode const mode_;
JSInliner inliner_;
Candidates candidates_;
ZoneSet<NodeId> seen_;
- CompilationInfo* info_;
+ JSGraph* const jsgraph_;
int cumulative_count_ = 0;
};

Powered by Google App Engine
This is Rietveld 408576698