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

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

Issue 1732483002: Rename FlowGraphOptimizer -> JitOptimizer, clean up optimizer code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/intermediate_language.cc ('k') | runtime/vm/jit_optimizer.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_OPTIMIZER_H_ 5 #ifndef VM_JIT_OPTIMIZER_H_
6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ 6 #define VM_JIT_OPTIMIZER_H_
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 class CSEInstructionMap; 13 class CSEInstructionMap;
14 template <typename T> class GrowableArray; 14 template <typename T> class GrowableArray;
15 class ParsedFunction; 15 class ParsedFunction;
16 16
17 class FlowGraphOptimizer : public FlowGraphVisitor { 17 class JitOptimizer : public FlowGraphVisitor {
18 public: 18 public:
19 FlowGraphOptimizer( 19 explicit JitOptimizer(FlowGraph* flow_graph)
20 FlowGraph* flow_graph,
21 bool use_speculative_inlining,
22 GrowableArray<intptr_t>* inlining_black_list)
23 : FlowGraphVisitor(flow_graph->reverse_postorder()), 20 : FlowGraphVisitor(flow_graph->reverse_postorder()),
24 flow_graph_(flow_graph), 21 flow_graph_(flow_graph) { }
25 use_speculative_inlining_(use_speculative_inlining), 22
26 inlining_black_list_(inlining_black_list) { 23 virtual ~JitOptimizer() {}
27 ASSERT(!use_speculative_inlining || (inlining_black_list != NULL));
28 }
29 virtual ~FlowGraphOptimizer() {}
30 24
31 FlowGraph* flow_graph() const { return flow_graph_; } 25 FlowGraph* flow_graph() const { return flow_graph_; }
32 26
33 // Use ICData to optimize, replace or eliminate instructions. 27 // Use ICData to optimize, replace or eliminate instructions.
34 void ApplyICData(); 28 void ApplyICData();
35 29
36 // Use propagated class ids to optimize, replace or eliminate instructions. 30 // Use propagated class ids to optimize, replace or eliminate instructions.
37 void ApplyClassIds(); 31 void ApplyClassIds();
38 32
39 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the 33 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the
(...skipping 23 matching lines...) Expand all
63 57
64 bool TryReplaceWithIndexedOp(InstanceCallInstr* call); 58 bool TryReplaceWithIndexedOp(InstanceCallInstr* call);
65 59
66 60
67 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind); 61 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind);
68 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind); 62 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind);
69 63
70 bool TryReplaceWithEqualityOp(InstanceCallInstr* call, Token::Kind op_kind); 64 bool TryReplaceWithEqualityOp(InstanceCallInstr* call, Token::Kind op_kind);
71 bool TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind); 65 bool TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind);
72 66
73 bool TryInlineInstanceGetter(InstanceCallInstr* call, 67 bool TryInlineInstanceGetter(InstanceCallInstr* call);
74 bool allow_check = true);
75 bool TryInlineInstanceSetter(InstanceCallInstr* call, 68 bool TryInlineInstanceSetter(InstanceCallInstr* call,
76 const ICData& unary_ic_data, 69 const ICData& unary_ic_data);
77 bool allow_check = true);
78 70
79 bool TryInlineInstanceMethod(InstanceCallInstr* call); 71 bool TryInlineInstanceMethod(InstanceCallInstr* call);
80 bool TryInlineFloat32x4Constructor(StaticCallInstr* call, 72 bool TryInlineFloat32x4Constructor(StaticCallInstr* call,
81 MethodRecognizer::Kind recognized_kind); 73 MethodRecognizer::Kind recognized_kind);
82 bool TryInlineFloat64x2Constructor(StaticCallInstr* call, 74 bool TryInlineFloat64x2Constructor(StaticCallInstr* call,
83 MethodRecognizer::Kind recognized_kind); 75 MethodRecognizer::Kind recognized_kind);
84 bool TryInlineInt32x4Constructor(StaticCallInstr* call, 76 bool TryInlineInt32x4Constructor(StaticCallInstr* call,
85 MethodRecognizer::Kind recognized_kind); 77 MethodRecognizer::Kind recognized_kind);
86 bool TryInlineFloat32x4Method(InstanceCallInstr* call, 78 bool TryInlineFloat32x4Method(InstanceCallInstr* call,
87 MethodRecognizer::Kind recognized_kind); 79 MethodRecognizer::Kind recognized_kind);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 bool InlineFloat64x2Getter(InstanceCallInstr* call, 123 bool InlineFloat64x2Getter(InstanceCallInstr* call,
132 MethodRecognizer::Kind getter); 124 MethodRecognizer::Kind getter);
133 bool InlineInt32x4Getter(InstanceCallInstr* call, 125 bool InlineInt32x4Getter(InstanceCallInstr* call,
134 MethodRecognizer::Kind getter); 126 MethodRecognizer::Kind getter);
135 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call, 127 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call,
136 Token::Kind op_kind); 128 Token::Kind op_kind);
137 bool InlineInt32x4BinaryOp(InstanceCallInstr* call, 129 bool InlineInt32x4BinaryOp(InstanceCallInstr* call,
138 Token::Kind op_kind); 130 Token::Kind op_kind);
139 bool InlineFloat64x2BinaryOp(InstanceCallInstr* call, 131 bool InlineFloat64x2BinaryOp(InstanceCallInstr* call,
140 Token::Kind op_kind); 132 Token::Kind op_kind);
141 bool InlineImplicitInstanceGetter(InstanceCallInstr* call, bool allow_check); 133 bool InlineImplicitInstanceGetter(InstanceCallInstr* call);
142 134
143 RawBool* InstanceOfAsBool(const ICData& ic_data, 135 RawBool* InstanceOfAsBool(const ICData& ic_data,
144 const AbstractType& type, 136 const AbstractType& type,
145 ZoneGrowableArray<intptr_t>* results) const; 137 ZoneGrowableArray<intptr_t>* results) const;
146 138
147 void ReplaceWithMathCFunction(InstanceCallInstr* call, 139 void ReplaceWithMathCFunction(InstanceCallInstr* call,
148 MethodRecognizer::Kind recognized_kind); 140 MethodRecognizer::Kind recognized_kind);
149 141
150 void OptimizeLeftShiftBitAndSmiOp(Definition* bit_and_instr, 142 void OptimizeLeftShiftBitAndSmiOp(Definition* bit_and_instr,
151 Definition* left_instr, 143 Definition* left_instr,
152 Definition* right_instr); 144 Definition* right_instr);
153 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates); 145 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates);
154 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates); 146 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates);
155 147
156 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix, 148 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix,
157 Representation rep, intptr_t cid); 149 Representation rep, intptr_t cid);
158 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind); 150 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind);
159 151
160 void InstanceCallNoopt(InstanceCallInstr* instr);
161
162 RawField* GetField(intptr_t class_id, const String& field_name); 152 RawField* GetField(intptr_t class_id, const String& field_name);
163 153
164 Thread* thread() const { return flow_graph_->thread(); } 154 Thread* thread() const { return flow_graph_->thread(); }
165 Isolate* isolate() const { return flow_graph_->isolate(); } 155 Isolate* isolate() const { return flow_graph_->isolate(); }
166 Zone* zone() const { return flow_graph_->zone(); } 156 Zone* zone() const { return flow_graph_->zone(); }
167 157
168 const Function& function() const { return flow_graph_->function(); } 158 const Function& function() const { return flow_graph_->function(); }
169 159
170 bool IsBlackListedForInlining(intptr_t deopt_id);
171
172 FlowGraph* flow_graph_; 160 FlowGraph* flow_graph_;
173 161
174 const bool use_speculative_inlining_; 162 DISALLOW_COPY_AND_ASSIGN(JitOptimizer);
175
176 GrowableArray<intptr_t>* inlining_black_list_;
177
178 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer);
179 }; 163 };
180 164
181 165
182 } // namespace dart 166 } // namespace dart
183 167
184 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 168 #endif // VM_JIT_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/jit_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698