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 16 matching lines...) Expand all Loading... |
27 void ApplyICData(); | 27 void ApplyICData(); |
28 | 28 |
29 // Use propagated class ids to optimize, replace or eliminate instructions. | 29 // Use propagated class ids to optimize, replace or eliminate instructions. |
30 void ApplyClassIds(); | 30 void ApplyClassIds(); |
31 | 31 |
32 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the | 32 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the |
33 // shift can be a truncating Smi shift-left and result is always Smi. | 33 // shift can be a truncating Smi shift-left and result is always Smi. |
34 // Merge instructions (only per basic-block). | 34 // Merge instructions (only per basic-block). |
35 void TryOptimizePatterns(); | 35 void TryOptimizePatterns(); |
36 | 36 |
| 37 |
37 // Returns true if any instructions were canonicalized away. | 38 // Returns true if any instructions were canonicalized away. |
38 bool Canonicalize(); | 39 bool Canonicalize(); |
39 | 40 |
40 void EliminateDeadPhis(); | 41 void EliminateDeadPhis(); |
41 | 42 |
42 void SelectRepresentations(); | 43 void SelectRepresentations(); |
43 | 44 |
44 void InferIntRanges(); | 45 void InferIntRanges(); |
45 | 46 |
| 47 // Optimize mint operations using range analysis output. |
| 48 void TryRangeDerivedOptimizations(); |
| 49 |
46 void AnalyzeTryCatch(); | 50 void AnalyzeTryCatch(); |
47 | 51 |
48 bool TryInlineRecognizedMethod(intptr_t receiver_cid, | 52 bool TryInlineRecognizedMethod(intptr_t receiver_cid, |
49 const Function& target, | 53 const Function& target, |
50 Instruction* call, | 54 Instruction* call, |
51 Definition* receiver, | 55 Definition* receiver, |
52 intptr_t token_pos, | 56 intptr_t token_pos, |
53 const ICData& ic_data, | 57 const ICData& ic_data, |
54 TargetEntryInstr** entry, | 58 TargetEntryInstr** entry, |
55 Definition** last); | 59 Definition** last); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 RawBool* InstanceOfAsBool(const ICData& ic_data, | 235 RawBool* InstanceOfAsBool(const ICData& ic_data, |
232 const AbstractType& type, | 236 const AbstractType& type, |
233 ZoneGrowableArray<intptr_t>* results) const; | 237 ZoneGrowableArray<intptr_t>* results) const; |
234 | 238 |
235 void ReplaceWithMathCFunction(InstanceCallInstr* call, | 239 void ReplaceWithMathCFunction(InstanceCallInstr* call, |
236 MethodRecognizer::Kind recognized_kind); | 240 MethodRecognizer::Kind recognized_kind); |
237 | 241 |
238 void OptimizeLeftShiftBitAndSmiOp(Definition* bit_and_instr, | 242 void OptimizeLeftShiftBitAndSmiOp(Definition* bit_and_instr, |
239 Definition* left_instr, | 243 Definition* left_instr, |
240 Definition* right_instr); | 244 Definition* right_instr); |
| 245 Definition* OptimizeMint32BitMasks(BinaryMintOpInstr* mask); |
| 246 bool TryMarkMint32Bit(Definition* mintop); |
241 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates); | 247 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates); |
242 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates); | 248 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates); |
243 | 249 |
244 void AppendLoadIndexedForMerged(Definition* instr, intptr_t ix, intptr_t cid); | 250 void AppendLoadIndexedForMerged(Definition* instr, intptr_t ix, intptr_t cid); |
245 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix, | 251 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix, |
246 Representation rep, intptr_t cid); | 252 Representation rep, intptr_t cid); |
247 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind); | 253 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind); |
248 | 254 |
249 Isolate* isolate() const { return flow_graph_->isolate(); } | 255 Isolate* isolate() const { return flow_graph_->isolate(); } |
250 | 256 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // Optimize spill stores inside try-blocks by identifying values that always | 458 // Optimize spill stores inside try-blocks by identifying values that always |
453 // contain a single known constant at catch block entry. | 459 // contain a single known constant at catch block entry. |
454 class TryCatchAnalyzer : public AllStatic { | 460 class TryCatchAnalyzer : public AllStatic { |
455 public: | 461 public: |
456 static void Optimize(FlowGraph* flow_graph); | 462 static void Optimize(FlowGraph* flow_graph); |
457 }; | 463 }; |
458 | 464 |
459 } // namespace dart | 465 } // namespace dart |
460 | 466 |
461 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 467 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
OLD | NEW |