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

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

Issue 13469013: Use range analysis to improve constant propagation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 // Sparse conditional constant propagation and unreachable code elimination. 208 // Sparse conditional constant propagation and unreachable code elimination.
209 // Assumes that use lists are computed and preserves them. 209 // Assumes that use lists are computed and preserves them.
210 class ConstantPropagator : public FlowGraphVisitor { 210 class ConstantPropagator : public FlowGraphVisitor {
211 public: 211 public:
212 ConstantPropagator(FlowGraph* graph, 212 ConstantPropagator(FlowGraph* graph,
213 const GrowableArray<BlockEntryInstr*>& ignored); 213 const GrowableArray<BlockEntryInstr*>& ignored);
214 214
215 static void Optimize(FlowGraph* graph); 215 static void Optimize(FlowGraph* graph);
216 216
217 // Only visit branches to optimize away unreachable blocks discovered
218 // by range analysis.
219 static void OptimizeBranches(FlowGraph* graph);
220
217 // Used to initialize the abstract value of definitions. 221 // Used to initialize the abstract value of definitions.
218 static RawObject* Unknown() { return Object::transition_sentinel().raw(); } 222 static RawObject* Unknown() { return Object::transition_sentinel().raw(); }
219 223
220 private: 224 private:
221 void Analyze(); 225 void Analyze();
226 void VisitBranches();
222 void Transform(); 227 void Transform();
223 228
224 void SetReachable(BlockEntryInstr* block); 229 void SetReachable(BlockEntryInstr* block);
225 void SetValue(Definition* definition, const Object& value); 230 void SetValue(Definition* definition, const Object& value);
226 231
227 // Assign the join (least upper bound) of a pair of abstract values to the 232 // Assign the join (least upper bound) of a pair of abstract values to the
228 // first one. 233 // first one.
229 void Join(Object* left, const Object& right); 234 void Join(Object* left, const Object& right);
230 235
231 bool IsUnknown(const Object& value) { 236 bool IsUnknown(const Object& value) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // inputs. 295 // inputs.
291 static BranchInstr* CloneBranch(BranchInstr* branch, 296 static BranchInstr* CloneBranch(BranchInstr* branch,
292 Value* left, 297 Value* left,
293 Value* right); 298 Value* right);
294 }; 299 };
295 300
296 301
297 } // namespace dart 302 } // namespace dart
298 303
299 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 304 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698