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 RUNTIME_VM_JIT_OPTIMIZER_H_ | 5 #ifndef RUNTIME_VM_JIT_OPTIMIZER_H_ |
6 #define RUNTIME_VM_JIT_OPTIMIZER_H_ | 6 #define RUNTIME_VM_JIT_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 struct CidRangeTarget; |
13 class CSEInstructionMap; | 14 class CSEInstructionMap; |
14 template <typename T> | 15 template <typename T> |
15 class GrowableArray; | 16 class GrowableArray; |
16 class ParsedFunction; | 17 class ParsedFunction; |
17 | 18 |
18 class JitOptimizer : public FlowGraphVisitor { | 19 class JitOptimizer : public FlowGraphVisitor { |
19 public: | 20 public: |
20 explicit JitOptimizer(FlowGraph* flow_graph) | 21 explicit JitOptimizer(FlowGraph* flow_graph) |
21 : FlowGraphVisitor(flow_graph->reverse_postorder()), | 22 : FlowGraphVisitor(flow_graph->reverse_postorder()), |
22 flow_graph_(flow_graph) {} | 23 flow_graph_(flow_graph) {} |
(...skipping 14 matching lines...) Expand all Loading... |
37 virtual void VisitAllocateContext(AllocateContextInstr* instr); | 38 virtual void VisitAllocateContext(AllocateContextInstr* instr); |
38 virtual void VisitLoadCodeUnits(LoadCodeUnitsInstr* instr); | 39 virtual void VisitLoadCodeUnits(LoadCodeUnitsInstr* instr); |
39 | 40 |
40 void InsertBefore(Instruction* next, | 41 void InsertBefore(Instruction* next, |
41 Instruction* instr, | 42 Instruction* instr, |
42 Environment* env, | 43 Environment* env, |
43 FlowGraph::UseKind use_kind) { | 44 FlowGraph::UseKind use_kind) { |
44 flow_graph_->InsertBefore(next, instr, env, use_kind); | 45 flow_graph_->InsertBefore(next, instr, env, use_kind); |
45 } | 46 } |
46 | 47 |
| 48 // Creates the off-heap PolymorphicTargets object that reflects the contents |
| 49 // of the on-VM-heap IC data. Also expands the class-ids to neighbouring |
| 50 // classes that inherit the same method. |
| 51 static PolymorphicTargets* CreatePolymorphicTargets(Zone* zone, |
| 52 const ICData& ic_data); |
| 53 |
47 private: | 54 private: |
48 // Attempt to build ICData for call using propagated class-ids. | 55 // Attempt to build ICData for call using propagated class-ids. |
49 bool TryCreateICData(InstanceCallInstr* call); | 56 bool TryCreateICData(InstanceCallInstr* call); |
50 | 57 |
51 void SpecializePolymorphicInstanceCall(PolymorphicInstanceCallInstr* call); | 58 void SpecializePolymorphicInstanceCall(PolymorphicInstanceCallInstr* call); |
52 | 59 |
53 bool TryReplaceWithIndexedOp(InstanceCallInstr* call); | 60 bool TryReplaceWithIndexedOp(InstanceCallInstr* call); |
54 | 61 |
55 void TryExpandClassesInICData(const ICData& ic_data); | |
56 bool LookupMethodFor(int class_id, | |
57 const ArgumentsDescriptor& args_desc, | |
58 const String& name, | |
59 Function* fn_return); | |
60 | |
61 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind); | 62 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind); |
62 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind); | 63 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind); |
63 | 64 |
64 bool TryReplaceWithEqualityOp(InstanceCallInstr* call, Token::Kind op_kind); | 65 bool TryReplaceWithEqualityOp(InstanceCallInstr* call, Token::Kind op_kind); |
65 bool TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind); | 66 bool TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind); |
66 | 67 |
67 bool TryInlineInstanceGetter(InstanceCallInstr* call); | 68 bool TryInlineInstanceGetter(InstanceCallInstr* call); |
68 bool TryInlineInstanceSetter(InstanceCallInstr* call, | 69 bool TryInlineInstanceSetter(InstanceCallInstr* call, |
69 const ICData& unary_ic_data); | 70 const ICData& unary_ic_data); |
70 | 71 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 131 |
131 FlowGraph* flow_graph_; | 132 FlowGraph* flow_graph_; |
132 | 133 |
133 DISALLOW_COPY_AND_ASSIGN(JitOptimizer); | 134 DISALLOW_COPY_AND_ASSIGN(JitOptimizer); |
134 }; | 135 }; |
135 | 136 |
136 | 137 |
137 } // namespace dart | 138 } // namespace dart |
138 | 139 |
139 #endif // RUNTIME_VM_JIT_OPTIMIZER_H_ | 140 #endif // RUNTIME_VM_JIT_OPTIMIZER_H_ |
OLD | NEW |