| 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 void OptimizeComputations(); | 22 void OptimizeComputations(); |
| 23 | 23 |
| 24 virtual void VisitStaticCall(StaticCallComp* comp, BindInstr* instr); | 24 virtual void VisitStaticCall(StaticCallComp* comp, BindInstr* instr); |
| 25 virtual void VisitInstanceCall(InstanceCallComp* comp, BindInstr* instr); | 25 virtual void VisitInstanceCall(InstanceCallComp* comp, BindInstr* instr); |
| 26 virtual void VisitLoadIndexed(LoadIndexedComp* comp, BindInstr* instr); | |
| 27 virtual void VisitStoreIndexed(StoreIndexedComp* comp, BindInstr* instr); | |
| 28 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr); | 26 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr); |
| 29 virtual void VisitEqualityCompare(EqualityCompareComp* comp, | 27 virtual void VisitEqualityCompare(EqualityCompareComp* comp, |
| 30 BindInstr* instr); | 28 BindInstr* instr); |
| 31 virtual void VisitBind(BindInstr* instr); | 29 virtual void VisitBind(BindInstr* instr); |
| 32 | 30 |
| 33 private: | 31 private: |
| 32 bool TryReplaceWithArrayOp(BindInstr* instr, |
| 33 InstanceCallComp* comp, |
| 34 Token::Kind op_kind); |
| 34 bool TryReplaceWithBinaryOp(BindInstr* instr, | 35 bool TryReplaceWithBinaryOp(BindInstr* instr, |
| 35 InstanceCallComp* comp, | 36 InstanceCallComp* comp, |
| 36 Token::Kind op_kind); | 37 Token::Kind op_kind); |
| 37 bool TryReplaceWithUnaryOp(BindInstr* instr, | 38 bool TryReplaceWithUnaryOp(BindInstr* instr, |
| 38 InstanceCallComp* comp, | 39 InstanceCallComp* comp, |
| 39 Token::Kind op_kind); | 40 Token::Kind op_kind); |
| 40 | 41 |
| 41 bool TryInlineInstanceGetter(BindInstr* instr, | 42 bool TryInlineInstanceGetter(BindInstr* instr, |
| 42 InstanceCallComp* comp); | 43 InstanceCallComp* comp); |
| 43 bool TryInlineInstanceSetter(BindInstr* instr, InstanceCallComp* comp); | 44 bool TryInlineInstanceSetter(BindInstr* instr, InstanceCallComp* comp); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 98 |
| 98 private: | 99 private: |
| 99 const ParsedFunction& parsed_function_; | 100 const ParsedFunction& parsed_function_; |
| 100 bool still_changing_; | 101 bool still_changing_; |
| 101 DISALLOW_COPY_AND_ASSIGN(FlowGraphTypePropagator); | 102 DISALLOW_COPY_AND_ASSIGN(FlowGraphTypePropagator); |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 } // namespace dart | 105 } // namespace dart |
| 105 | 106 |
| 106 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 107 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |