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

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

Issue 10949019: Turn definitions that do not produce results (e.g. Checks) into instructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Florian's comments 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
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 void SelectRepresentations(); 29 void SelectRepresentations();
30 30
31 void PropagateSminess(); 31 void PropagateSminess();
32 32
33 virtual void VisitStaticCall(StaticCallInstr* instr); 33 virtual void VisitStaticCall(StaticCallInstr* instr);
34 virtual void VisitInstanceCall(InstanceCallInstr* instr); 34 virtual void VisitInstanceCall(InstanceCallInstr* instr);
35 virtual void VisitRelationalOp(RelationalOpInstr* instr); 35 virtual void VisitRelationalOp(RelationalOpInstr* instr);
36 virtual void VisitEqualityCompare(EqualityCompareInstr* instr); 36 virtual void VisitEqualityCompare(EqualityCompareInstr* instr);
37 virtual void VisitBranch(BranchInstr* instr); 37 virtual void VisitBranch(BranchInstr* instr);
38 38
39 // TODO(fschneider): Once we get rid of the distinction between Instruction 39 void InsertBefore(Instruction* next,
40 // and computation, this can be made private again. 40 Instruction* instr,
41 void InsertBefore(Instruction* instr,
42 Definition* defn,
43 Environment* env, 41 Environment* env,
44 Definition::UseKind use_kind); 42 Definition::UseKind use_kind);
45 43
46 private: 44 private:
47 bool TryReplaceWithArrayOp(InstanceCallInstr* call, Token::Kind op_kind); 45 bool TryReplaceWithArrayOp(InstanceCallInstr* call, Token::Kind op_kind);
48 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind); 46 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind);
49 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind); 47 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind);
50 48
51 bool TryInlineInstanceGetter(InstanceCallInstr* call); 49 bool TryInlineInstanceGetter(InstanceCallInstr* call);
52 bool TryInlineInstanceSetter(InstanceCallInstr* call); 50 bool TryInlineInstanceSetter(InstanceCallInstr* call);
53 51
54 bool TryInlineInstanceMethod(InstanceCallInstr* call); 52 bool TryInlineInstanceMethod(InstanceCallInstr* call);
55 53
56 void AddCheckClass(InstanceCallInstr* call, Value* value); 54 void AddCheckClass(InstanceCallInstr* call, Value* value);
57 55
58 void InsertAfter(Instruction* instr, 56 void InsertAfter(Instruction* prev,
59 Definition* defn, 57 Instruction* instr,
60 Environment* env, 58 Environment* env,
61 Definition::UseKind use_kind); 59 Definition::UseKind use_kind);
62 60
63 void InsertConversionsFor(Definition* def); 61 void InsertConversionsFor(Definition* def);
64 62
65 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call) const; 63 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call) const;
66 64
67 FlowGraph* flow_graph_; 65 FlowGraph* flow_graph_;
68 66
69 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); 67 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 125
128 126
129 // Loop invariant code motion. 127 // Loop invariant code motion.
130 class LICM : public AllStatic { 128 class LICM : public AllStatic {
131 public: 129 public:
132 static void Optimize(FlowGraph* flow_graph); 130 static void Optimize(FlowGraph* flow_graph);
133 131
134 private: 132 private:
135 static void Hoist(ForwardInstructionIterator* it, 133 static void Hoist(ForwardInstructionIterator* it,
136 BlockEntryInstr* pre_header, 134 BlockEntryInstr* pre_header,
137 Definition* current); 135 Instruction* current);
138 136
139 static void TryHoistCheckSmiThroughPhi(ForwardInstructionIterator* it, 137 static void TryHoistCheckSmiThroughPhi(ForwardInstructionIterator* it,
140 BlockEntryInstr* header, 138 BlockEntryInstr* header,
141 BlockEntryInstr* pre_header, 139 BlockEntryInstr* pre_header,
142 Definition* current); 140 Instruction* current);
143 }; 141 };
144 142
145 143
146 // A simple common subexpression elimination based 144 // A simple common subexpression elimination based
147 // on the dominator tree. 145 // on the dominator tree.
148 class DominatorBasedCSE : public AllStatic { 146 class DominatorBasedCSE : public AllStatic {
149 public: 147 public:
150 static void Optimize(FlowGraph* graph); 148 static void Optimize(FlowGraph* graph);
151 149
152 private: 150 private:
153 static void OptimizeRecursive( 151 static void OptimizeRecursive(
154 BlockEntryInstr* entry, 152 BlockEntryInstr* entry,
155 DirectChainedHashMap<Definition*>* map); 153 DirectChainedHashMap<Instruction*>* map);
156 }; 154 };
157 155
158 156
159 } // namespace dart 157 } // namespace dart
160 158
161 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 159 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698