OLD | NEW |
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_FLOW_GRAPH_OPTIMIZER_H_ |
6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ | 6 #define VM_FLOW_GRAPH_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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 // Returns true if any instructions were canonicalized away. | 48 // Returns true if any instructions were canonicalized away. |
49 bool Canonicalize(); | 49 bool Canonicalize(); |
50 | 50 |
51 void EliminateDeadPhis(); | 51 void EliminateDeadPhis(); |
52 | 52 |
53 void SelectRepresentations(); | 53 void SelectRepresentations(); |
54 | 54 |
55 void WidenSmiToInt32(); | 55 void WidenSmiToInt32(); |
56 | 56 |
57 void InferIntRanges(); | |
58 | |
59 void SelectIntegerInstructions(); | |
60 | |
61 void AnalyzeTryCatch(); | |
62 | |
63 bool TryInlineRecognizedMethod(intptr_t receiver_cid, | 57 bool TryInlineRecognizedMethod(intptr_t receiver_cid, |
64 const Function& target, | 58 const Function& target, |
65 Instruction* call, | 59 Instruction* call, |
66 Definition* receiver, | 60 Definition* receiver, |
67 TokenPosition token_pos, | 61 TokenPosition token_pos, |
68 const ICData& ic_data, | 62 const ICData& ic_data, |
69 TargetEntryInstr** entry, | 63 TargetEntryInstr** entry, |
70 Definition** last); | 64 Definition** last); |
71 | 65 |
72 // Remove environments from the instructions which do not deoptimize. | 66 // Remove environments from the instructions which do not deoptimize. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 156 |
163 bool InlineDoubleOp(Token::Kind op_kind, | 157 bool InlineDoubleOp(Token::Kind op_kind, |
164 Instruction* call, | 158 Instruction* call, |
165 TargetEntryInstr** entry, | 159 TargetEntryInstr** entry, |
166 Definition** last); | 160 Definition** last); |
167 | 161 |
168 bool InlineByteArrayBaseLoad(Instruction* call, | 162 bool InlineByteArrayBaseLoad(Instruction* call, |
169 Definition* receiver, | 163 Definition* receiver, |
170 intptr_t array_cid, | 164 intptr_t array_cid, |
171 intptr_t view_cid, | 165 intptr_t view_cid, |
172 const ICData& ic_data, | |
173 TargetEntryInstr** entry, | 166 TargetEntryInstr** entry, |
174 Definition** last); | 167 Definition** last); |
175 | 168 |
176 bool InlineByteArrayBaseStore(const Function& target, | 169 bool InlineByteArrayBaseStore(const Function& target, |
177 Instruction* call, | 170 Instruction* call, |
178 Definition* receiver, | 171 Definition* receiver, |
179 intptr_t array_cid, | 172 intptr_t array_cid, |
180 intptr_t view_cid, | 173 intptr_t view_cid, |
181 const ICData& ic_data, | |
182 TargetEntryInstr** entry, | 174 TargetEntryInstr** entry, |
183 Definition** last); | 175 Definition** last); |
184 | 176 |
185 intptr_t PrepareInlineByteArrayBaseOp(Instruction* call, | 177 intptr_t PrepareInlineByteArrayBaseOp(Instruction* call, |
186 intptr_t array_cid, | 178 intptr_t array_cid, |
187 intptr_t view_cid, | 179 intptr_t view_cid, |
188 Definition** array, | 180 Definition** array, |
189 Definition* index, | 181 Definition* index, |
190 Instruction** cursor); | 182 Instruction** cursor); |
191 | 183 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 241 |
250 void ReplaceWithMathCFunction(InstanceCallInstr* call, | 242 void ReplaceWithMathCFunction(InstanceCallInstr* call, |
251 MethodRecognizer::Kind recognized_kind); | 243 MethodRecognizer::Kind recognized_kind); |
252 | 244 |
253 void OptimizeLeftShiftBitAndSmiOp(Definition* bit_and_instr, | 245 void OptimizeLeftShiftBitAndSmiOp(Definition* bit_and_instr, |
254 Definition* left_instr, | 246 Definition* left_instr, |
255 Definition* right_instr); | 247 Definition* right_instr); |
256 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates); | 248 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates); |
257 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates); | 249 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates); |
258 | 250 |
259 void AppendLoadIndexedForMerged(Definition* instr, intptr_t ix, intptr_t cid); | |
260 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix, | 251 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix, |
261 Representation rep, intptr_t cid); | 252 Representation rep, intptr_t cid); |
262 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind); | 253 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind); |
263 | 254 |
264 void InstanceCallNoopt(InstanceCallInstr* instr); | 255 void InstanceCallNoopt(InstanceCallInstr* instr); |
265 | 256 |
266 RawField* GetField(intptr_t class_id, const String& field_name); | 257 RawField* GetField(intptr_t class_id, const String& field_name); |
267 | 258 |
268 Thread* thread() const { return flow_graph_->thread(); } | 259 Thread* thread() const { return flow_graph_->thread(); } |
269 Isolate* isolate() const { return flow_graph_->isolate(); } | 260 Isolate* isolate() const { return flow_graph_->isolate(); } |
270 Zone* zone() const { return flow_graph_->zone(); } | 261 Zone* zone() const { return flow_graph_->zone(); } |
271 | 262 |
272 const Function& function() const { return flow_graph_->function(); } | 263 const Function& function() const { return flow_graph_->function(); } |
273 | 264 |
274 bool IsBlackListedForInlining(intptr_t deopt_id); | 265 bool IsBlackListedForInlining(intptr_t deopt_id); |
275 | 266 |
276 FlowGraph* flow_graph_; | 267 FlowGraph* flow_graph_; |
277 | 268 |
278 const bool use_speculative_inlining_; | 269 const bool use_speculative_inlining_; |
279 | 270 |
280 GrowableArray<intptr_t>* inlining_black_list_; | 271 GrowableArray<intptr_t>* inlining_black_list_; |
281 | 272 |
282 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); | 273 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); |
283 }; | 274 }; |
284 | 275 |
285 | 276 |
286 } // namespace dart | 277 } // namespace dart |
287 | 278 |
288 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 279 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
OLD | NEW |