Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: runtime/vm/flow_graph_optimizer.h

Issue 10908091: Remove classes Computation and BindInstr. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10 matching lines...) Expand all
21 virtual ~FlowGraphOptimizer() {} 21 virtual ~FlowGraphOptimizer() {}
22 22
23 void ApplyICData(); 23 void ApplyICData();
24 24
25 void OptimizeComputations(); 25 void OptimizeComputations();
26 26
27 void EliminateDeadPhis(); 27 void EliminateDeadPhis();
28 28
29 void SelectRepresentations(); 29 void SelectRepresentations();
30 30
31 virtual void VisitStaticCall(StaticCallComp* comp, BindInstr* instr); 31 virtual void VisitStaticCall(StaticCallInstr* instr);
32 virtual void VisitInstanceCall(InstanceCallComp* comp, BindInstr* instr); 32 virtual void VisitInstanceCall(InstanceCallInstr* instr);
33 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr); 33 virtual void VisitRelationalOp(RelationalOpInstr* instr);
34 virtual void VisitEqualityCompare(EqualityCompareComp* comp, 34 virtual void VisitEqualityCompare(EqualityCompareInstr* instr);
35 BindInstr* instr);
36 virtual void VisitBind(BindInstr* instr);
37 virtual void VisitBranch(BranchInstr* instr); 35 virtual void VisitBranch(BranchInstr* instr);
38 36
39 // TODO(fschneider): Once we get rid of the distinction between Instruction 37 // TODO(fschneider): Once we get rid of the distinction between Instruction
40 // and computation, this can be made private again. 38 // and computation, this can be made private again.
41 BindInstr* InsertBefore(Instruction* instr, 39 void InsertBefore(Instruction* instr,
42 Computation* comp, 40 Definition* defn,
43 Environment* env, 41 Environment* env,
44 BindInstr::UseKind use_kind); 42 Definition::UseKind use_kind);
45 43
46 private: 44 private:
47 bool TryReplaceWithArrayOp(BindInstr* instr, 45 bool TryReplaceWithArrayOp(InstanceCallInstr* call, Token::Kind op_kind);
48 InstanceCallComp* comp, 46 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind);
49 Token::Kind op_kind); 47 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind);
50 bool TryReplaceWithBinaryOp(BindInstr* instr,
51 InstanceCallComp* comp,
52 Token::Kind op_kind);
53 bool TryReplaceWithUnaryOp(BindInstr* instr,
54 InstanceCallComp* comp,
55 Token::Kind op_kind);
56 48
57 bool TryInlineInstanceGetter(BindInstr* instr, 49 bool TryInlineInstanceGetter(InstanceCallInstr* call);
58 InstanceCallComp* comp); 50 bool TryInlineInstanceSetter(InstanceCallInstr* call);
59 bool TryInlineInstanceSetter(BindInstr* instr, InstanceCallComp* comp);
60 51
61 bool TryInlineInstanceMethod(BindInstr* instr, InstanceCallComp* comp); 52 bool TryInlineInstanceMethod(InstanceCallInstr* call);
62 53
63 void AddCheckClass(BindInstr* instr, InstanceCallComp* comp, Value* value); 54 void AddCheckClass(InstanceCallInstr* call, Value* value);
64 55
65 BindInstr* InsertAfter(Instruction* instr, 56 void InsertAfter(Instruction* instr,
66 Computation* comp, 57 Definition* defn,
67 Environment* env, 58 Environment* env,
68 BindInstr::UseKind use_kind); 59 Definition::UseKind use_kind);
69 60
70 void InsertConversionsFor(Definition* def); 61 void InsertConversionsFor(Definition* def);
71 62
72 FlowGraph* flow_graph_; 63 FlowGraph* flow_graph_;
73 64
74 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); 65 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer);
75 }; 66 };
76 67
77 68
78 // Analyze the generated flow graph. Currently only if it is a leaf 69 // Analyze the generated flow graph. Currently only if it is a leaf
(...skipping 24 matching lines...) Expand all
103 explicit FlowGraphTypePropagator(const FlowGraph& flow_graph) 94 explicit FlowGraphTypePropagator(const FlowGraph& flow_graph)
104 : FlowGraphVisitor(flow_graph.reverse_postorder()), 95 : FlowGraphVisitor(flow_graph.reverse_postorder()),
105 parsed_function_(flow_graph.parsed_function()), 96 parsed_function_(flow_graph.parsed_function()),
106 still_changing_(false) { } 97 still_changing_(false) { }
107 virtual ~FlowGraphTypePropagator() { } 98 virtual ~FlowGraphTypePropagator() { }
108 99
109 const ParsedFunction& parsed_function() const { return parsed_function_; } 100 const ParsedFunction& parsed_function() const { return parsed_function_; }
110 101
111 void PropagateTypes(); 102 void PropagateTypes();
112 103
113 virtual void VisitAssertAssignable(AssertAssignableComp* comp, 104 private:
114 BindInstr* instr); 105 virtual void VisitBlocks();
115 virtual void VisitAssertBoolean(AssertBooleanComp* comp, BindInstr* instr); 106
116 virtual void VisitInstanceOf(InstanceOfComp* comp, BindInstr* instr); 107 virtual void VisitAssertAssignable(AssertAssignableInstr* instr);
108 virtual void VisitAssertBoolean(AssertBooleanInstr* instr);
109 virtual void VisitInstanceOf(InstanceOfInstr* instr);
117 110
118 virtual void VisitGraphEntry(GraphEntryInstr* graph_entry); 111 virtual void VisitGraphEntry(GraphEntryInstr* graph_entry);
119 virtual void VisitJoinEntry(JoinEntryInstr* join_entry); 112 virtual void VisitJoinEntry(JoinEntryInstr* join_entry);
120 virtual void VisitBind(BindInstr* bind);
121 virtual void VisitPhi(PhiInstr* phi); 113 virtual void VisitPhi(PhiInstr* phi);
122 virtual void VisitParameter(ParameterInstr* param); 114 virtual void VisitParameter(ParameterInstr* param);
123 virtual void VisitPushArgument(PushArgumentInstr* bind); 115 virtual void VisitPushArgument(PushArgumentInstr* bind);
124 116
125 private:
126 const ParsedFunction& parsed_function_; 117 const ParsedFunction& parsed_function_;
127 bool still_changing_; 118 bool still_changing_;
128 DISALLOW_COPY_AND_ASSIGN(FlowGraphTypePropagator); 119 DISALLOW_COPY_AND_ASSIGN(FlowGraphTypePropagator);
129 }; 120 };
130 121
131 122
132 // A simple common subexpression elimination based 123 // A simple common subexpression elimination based
133 // on the dominator tree. 124 // on the dominator tree.
134 class DominatorBasedCSE : public AllStatic { 125 class DominatorBasedCSE : public AllStatic {
135 public: 126 public:
136 static void Optimize(BlockEntryInstr* graph_entry); 127 static void Optimize(BlockEntryInstr* graph_entry);
137 128
138 private: 129 private:
139 static void OptimizeRecursive( 130 static void OptimizeRecursive(
140 BlockEntryInstr* entry, 131 BlockEntryInstr* entry,
141 DirectChainedHashMap<BindInstr*>* map); 132 DirectChainedHashMap<Definition*>* map);
142 }; 133 };
143 134
144 135
145 } // namespace dart 136 } // namespace dart
146 137
147 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 138 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698