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_AOT_OPTIMIZER_H_ | 5 #ifndef VM_AOT_OPTIMIZER_H_ |
6 #define VM_AOT_OPTIMIZER_H_ | 6 #define VM_AOT_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 class RawBool; | 16 class RawBool; |
17 | 17 |
18 class AotOptimizer : public FlowGraphVisitor { | 18 class AotOptimizer : public FlowGraphVisitor { |
19 public: | 19 public: |
20 AotOptimizer( | 20 AotOptimizer(FlowGraph* flow_graph, |
21 FlowGraph* flow_graph, | 21 bool use_speculative_inlining, |
22 bool use_speculative_inlining, | 22 GrowableArray<intptr_t>* inlining_black_list); |
23 GrowableArray<intptr_t>* inlining_black_list) | |
24 : FlowGraphVisitor(flow_graph->reverse_postorder()), | |
25 flow_graph_(flow_graph), | |
26 use_speculative_inlining_(use_speculative_inlining), | |
27 inlining_black_list_(inlining_black_list) { | |
28 ASSERT(!use_speculative_inlining || (inlining_black_list != NULL)); | |
29 } | |
30 virtual ~AotOptimizer() {} | 23 virtual ~AotOptimizer() {} |
31 | 24 |
32 FlowGraph* flow_graph() const { return flow_graph_; } | 25 FlowGraph* flow_graph() const { return flow_graph_; } |
33 | 26 |
34 // Add ICData to InstanceCalls, so that optimizations can be run on them. | 27 // Add ICData to InstanceCalls, so that optimizations can be run on them. |
35 // TODO(srdjan): StaticCals as well? | 28 // TODO(srdjan): StaticCals as well? |
36 void PopulateWithICData(); | 29 void PopulateWithICData(); |
37 | 30 |
38 // Use ICData to optimize, replace or eliminate instructions. | 31 // Use ICData to optimize, replace or eliminate instructions. |
39 void ApplyICData(); | 32 void ApplyICData(); |
40 | 33 |
41 // Use propagated class ids to optimize, replace or eliminate instructions. | 34 // Use propagated class ids to optimize, replace or eliminate instructions. |
42 void ApplyClassIds(); | 35 void ApplyClassIds(); |
43 | 36 |
44 void ReplaceArrayBoundChecks(); | 37 void ReplaceArrayBoundChecks(); |
45 | 38 |
46 virtual void VisitStaticCall(StaticCallInstr* instr); | 39 virtual void VisitStaticCall(StaticCallInstr* instr); |
47 virtual void VisitInstanceCall(InstanceCallInstr* instr); | 40 virtual void VisitInstanceCall(InstanceCallInstr* instr); |
| 41 virtual void VisitPolymorphicInstanceCall( |
| 42 PolymorphicInstanceCallInstr* instr); |
48 virtual void VisitLoadCodeUnits(LoadCodeUnitsInstr* instr); | 43 virtual void VisitLoadCodeUnits(LoadCodeUnitsInstr* instr); |
49 | 44 |
50 void InsertBefore(Instruction* next, | 45 void InsertBefore(Instruction* next, |
51 Instruction* instr, | 46 Instruction* instr, |
52 Environment* env, | 47 Environment* env, |
53 FlowGraph::UseKind use_kind) { | 48 FlowGraph::UseKind use_kind) { |
54 flow_graph_->InsertBefore(next, instr, env, use_kind); | 49 flow_graph_->InsertBefore(next, instr, env, use_kind); |
55 } | 50 } |
56 | 51 |
57 private: | 52 private: |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 const Function& function() const { return flow_graph_->function(); } | 130 const Function& function() const { return flow_graph_->function(); } |
136 | 131 |
137 bool IsAllowedForInlining(intptr_t deopt_id); | 132 bool IsAllowedForInlining(intptr_t deopt_id); |
138 | 133 |
139 FlowGraph* flow_graph_; | 134 FlowGraph* flow_graph_; |
140 | 135 |
141 const bool use_speculative_inlining_; | 136 const bool use_speculative_inlining_; |
142 | 137 |
143 GrowableArray<intptr_t>* inlining_black_list_; | 138 GrowableArray<intptr_t>* inlining_black_list_; |
144 | 139 |
| 140 bool has_unique_no_such_method_; |
| 141 |
145 DISALLOW_COPY_AND_ASSIGN(AotOptimizer); | 142 DISALLOW_COPY_AND_ASSIGN(AotOptimizer); |
146 }; | 143 }; |
147 | 144 |
148 | 145 |
149 } // namespace dart | 146 } // namespace dart |
150 | 147 |
151 #endif // VM_AOT_OPTIMIZER_H_ | 148 #endif // VM_AOT_OPTIMIZER_H_ |
OLD | NEW |