| 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 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 template <typename T> class GrowableArray; | 12 template <typename T> class GrowableArray; |
| 13 | 13 |
| 14 class FlowGraphOptimizer : public FlowGraphVisitor { | 14 class FlowGraphOptimizer : public FlowGraphVisitor { |
| 15 public: | 15 public: |
| 16 explicit FlowGraphOptimizer(const GrowableArray<BlockEntryInstr*>& blocks) | 16 explicit FlowGraphOptimizer(const GrowableArray<BlockEntryInstr*>& blocks) |
| 17 : FlowGraphVisitor(blocks) {} | 17 : FlowGraphVisitor(blocks) {} |
| 18 virtual ~FlowGraphOptimizer() {} | 18 virtual ~FlowGraphOptimizer() {} |
| 19 | 19 |
| 20 void ApplyICData(); | 20 void ApplyICData(); |
| 21 | 21 |
| 22 virtual void VisitStaticCall(StaticCallComp* comp, BindInstr* instr); | 22 virtual void VisitStaticCall(StaticCallComp* comp, BindInstr* instr); |
| 23 virtual void VisitInstanceCall(InstanceCallComp* comp, BindInstr* instr); | 23 virtual void VisitInstanceCall(InstanceCallComp* comp, BindInstr* instr); |
| 24 virtual void VisitInstanceSetter(InstanceSetterComp* comp, BindInstr* instr); | 24 virtual void VisitInstanceSetter(InstanceSetterComp* comp, BindInstr* instr); |
| 25 virtual void VisitLoadIndexed(LoadIndexedComp* comp, BindInstr* instr); | 25 virtual void VisitLoadIndexed(LoadIndexedComp* comp, BindInstr* instr); |
| 26 virtual void VisitStoreIndexed(StoreIndexedComp* comp, BindInstr* instr); | 26 virtual void VisitStoreIndexed(StoreIndexedComp* comp, BindInstr* instr); |
| 27 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr); | 27 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr); |
| 28 | 28 |
| 29 virtual void VisitStrictCompare(StrictCompareComp* comp, BindInstr* instr); | |
| 30 virtual void VisitEqualityCompare(EqualityCompareComp* comp, | 29 virtual void VisitEqualityCompare(EqualityCompareComp* comp, |
| 31 BindInstr* instr); | 30 BindInstr* instr); |
| 32 | 31 |
| 33 virtual void VisitBind(BindInstr* instr); | 32 virtual void VisitBind(BindInstr* instr); |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 bool TryReplaceWithBinaryOp(BindInstr* instr, | 35 bool TryReplaceWithBinaryOp(BindInstr* instr, |
| 37 InstanceCallComp* comp, | 36 InstanceCallComp* comp, |
| 38 Token::Kind op_kind); | 37 Token::Kind op_kind); |
| 39 bool TryReplaceWithUnaryOp(BindInstr* instr, | 38 bool TryReplaceWithUnaryOp(BindInstr* instr, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 65 private: | 64 private: |
| 66 const GrowableArray<BlockEntryInstr*>& blocks_; | 65 const GrowableArray<BlockEntryInstr*>& blocks_; |
| 67 bool is_leaf_; | 66 bool is_leaf_; |
| 68 | 67 |
| 69 DISALLOW_COPY_AND_ASSIGN(FlowGraphAnalyzer); | 68 DISALLOW_COPY_AND_ASSIGN(FlowGraphAnalyzer); |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 } // namespace dart | 71 } // namespace dart |
| 73 | 72 |
| 74 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 73 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |