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

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

Issue 25277002: Revert r28050 due to crashes with --optimization-counter-threshold=5. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 // Sparse conditional constant propagation and unreachable code elimination. 242 // Sparse conditional constant propagation and unreachable code elimination.
243 // Assumes that use lists are computed and preserves them. 243 // Assumes that use lists are computed and preserves them.
244 class ConstantPropagator : public FlowGraphVisitor { 244 class ConstantPropagator : public FlowGraphVisitor {
245 public: 245 public:
246 ConstantPropagator(FlowGraph* graph, 246 ConstantPropagator(FlowGraph* graph,
247 const GrowableArray<BlockEntryInstr*>& ignored); 247 const GrowableArray<BlockEntryInstr*>& ignored);
248 248
249 static void Optimize(FlowGraph* graph); 249 static void Optimize(FlowGraph* graph);
250 250
251 // (1) Visit branches to optimize away unreachable blocks discovered by range 251 // Only visit branches to optimize away unreachable blocks discovered
252 // analysis. 252 // by range analysis.
253 // (2) Eliminate branches that have the same true- and false-target: For
254 // example, this occurs after expressions like
255 //
256 // if (a == null || b == null) {
257 // ...
258 // }
259 //
260 // where b is known to be null.
261 static void OptimizeBranches(FlowGraph* graph); 253 static void OptimizeBranches(FlowGraph* graph);
262 254
263 // Used to initialize the abstract value of definitions. 255 // Used to initialize the abstract value of definitions.
264 static RawObject* Unknown() { return Object::unknown_constant().raw(); } 256 static RawObject* Unknown() { return Object::unknown_constant().raw(); }
265 257
266 private: 258 private:
267 void Analyze(); 259 void Analyze();
268 void VisitBranches(); 260 void VisitBranches();
269 void Transform(); 261 void Transform();
270 void EliminateRedundantBranches();
271 262
272 void SetReachable(BlockEntryInstr* block); 263 void SetReachable(BlockEntryInstr* block);
273 void SetValue(Definition* definition, const Object& value); 264 void SetValue(Definition* definition, const Object& value);
274 265
275 // Assign the join (least upper bound) of a pair of abstract values to the 266 // Assign the join (least upper bound) of a pair of abstract values to the
276 // first one. 267 // first one.
277 void Join(Object* left, const Object& right); 268 void Join(Object* left, const Object& right);
278 269
279 bool IsUnknown(const Object& value) { 270 bool IsUnknown(const Object& value) {
280 return value.raw() == unknown_.raw(); 271 return value.raw() == unknown_.raw();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // Optimize spill stores inside try-blocks by identifying values that always 371 // Optimize spill stores inside try-blocks by identifying values that always
381 // contain a single known constant at catch block entry. 372 // contain a single known constant at catch block entry.
382 class TryCatchAnalyzer : public AllStatic { 373 class TryCatchAnalyzer : public AllStatic {
383 public: 374 public:
384 static void Optimize(FlowGraph* flow_graph); 375 static void Optimize(FlowGraph* flow_graph);
385 }; 376 };
386 377
387 } // namespace dart 378 } // namespace dart
388 379
389 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 380 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698