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

Side by Side Diff: runtime/vm/flow_graph_inliner.h

Issue 2102663003: Refactor inlining of recognized methods. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fixed missing inlining, more cleanup Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/aot_optimizer.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_FLOW_GRAPH_INLINER_H_ 5 #ifndef VM_FLOW_GRAPH_INLINER_H_
6 #define VM_FLOW_GRAPH_INLINER_H_ 6 #define VM_FLOW_GRAPH_INLINER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 class Definition; 13 class Definition;
14 class Field; 14 class Field;
15 class FlowGraph; 15 class FlowGraph;
16 class ForwardInstructionIterator;
16 class Function; 17 class Function;
18 class InstanceCallInstr;
17 class Instruction; 19 class Instruction;
18 class TargetEntryInstr; 20 class TargetEntryInstr;
19 21
20 class FlowGraphInliner : ValueObject { 22 class FlowGraphInliner : ValueObject {
21 public: 23 public:
22 FlowGraphInliner(FlowGraph* flow_graph, 24 FlowGraphInliner(FlowGraph* flow_graph,
23 GrowableArray<const Function*>* inline_id_to_function, 25 GrowableArray<const Function*>* inline_id_to_function,
24 GrowableArray<TokenPosition>* inline_id_to_token_pos, 26 GrowableArray<TokenPosition>* inline_id_to_token_pos,
25 GrowableArray<intptr_t>* caller_inline_id, 27 GrowableArray<intptr_t>* caller_inline_id,
26 bool use_speculative_inlining, 28 bool use_speculative_inlining,
27 GrowableArray<intptr_t>* inlining_black_list); 29 GrowableArray<intptr_t>* inlining_black_list);
28 30
29 // The flow graph is destructively updated upon inlining. 31 // The flow graph is destructively updated upon inlining.
30 void Inline(); 32 void Inline();
31 33
32 // Compute graph info if it was not already computed or if 'force' is true. 34 // Compute graph info if it was not already computed or if 'force' is true.
33 static void CollectGraphInfo(FlowGraph* flow_graph, bool force = false); 35 static void CollectGraphInfo(FlowGraph* flow_graph, bool force = false);
34 static void SetInliningId(FlowGraph* flow_graph, intptr_t inlining_id); 36 static void SetInliningId(FlowGraph* flow_graph, intptr_t inlining_id);
35 37
36 bool AlwaysInline(const Function& function); 38 bool AlwaysInline(const Function& function);
37 39
38 FlowGraph* flow_graph() const { return flow_graph_; } 40 FlowGraph* flow_graph() const { return flow_graph_; }
39 intptr_t NextInlineId(const Function& function, 41 intptr_t NextInlineId(const Function& function,
40 TokenPosition tp, 42 TokenPosition tp,
41 intptr_t caller_id); 43 intptr_t caller_id);
42 44
43 bool trace_inlining() const { return trace_inlining_; } 45 bool trace_inlining() const { return trace_inlining_; }
44 46
47 static bool TryReplaceInstanceCallWithInline(
48 FlowGraph* flow_graph,
49 ForwardInstructionIterator* iterator,
50 InstanceCallInstr* call);
51
45 static bool TryInlineRecognizedMethod(FlowGraph* flow_graph, 52 static bool TryInlineRecognizedMethod(FlowGraph* flow_graph,
46 intptr_t receiver_cid, 53 intptr_t receiver_cid,
47 const Function& target, 54 const Function& target,
48 Instruction* call, 55 Instruction* call,
49 Definition* receiver, 56 Definition* receiver,
50 TokenPosition token_pos, 57 TokenPosition token_pos,
51 const ICData& ic_data, 58 const ICData& ic_data,
52 TargetEntryInstr** entry, 59 TargetEntryInstr** entry,
53 Definition** last); 60 Definition** last);
54 61
55 bool use_speculative_inlining() const { return use_speculative_inlining_; } 62 bool use_speculative_inlining() const { return use_speculative_inlining_; }
56 63
57 private: 64 private:
58 friend class CallSiteInliner; 65 friend class CallSiteInliner;
59 66
60 FlowGraph* flow_graph_; 67 FlowGraph* flow_graph_;
61 GrowableArray<const Function*>* inline_id_to_function_; 68 GrowableArray<const Function*>* inline_id_to_function_;
62 GrowableArray<TokenPosition>* inline_id_to_token_pos_; 69 GrowableArray<TokenPosition>* inline_id_to_token_pos_;
63 GrowableArray<intptr_t>* caller_inline_id_; 70 GrowableArray<intptr_t>* caller_inline_id_;
64 const bool trace_inlining_; 71 const bool trace_inlining_;
65 const bool use_speculative_inlining_; 72 const bool use_speculative_inlining_;
66 GrowableArray<intptr_t>* inlining_black_list_; 73 GrowableArray<intptr_t>* inlining_black_list_;
67 74
68 DISALLOW_COPY_AND_ASSIGN(FlowGraphInliner); 75 DISALLOW_COPY_AND_ASSIGN(FlowGraphInliner);
69 }; 76 };
70 77
71 } // namespace dart 78 } // namespace dart
72 79
73 #endif // VM_FLOW_GRAPH_INLINER_H_ 80 #endif // VM_FLOW_GRAPH_INLINER_H_
OLDNEW
« no previous file with comments | « runtime/vm/aot_optimizer.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698