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

Side by Side Diff: runtime/vm/compiler.cc

Issue 11819031: Add canonicalize optimization for branches. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « no previous file | runtime/vm/flow_graph_optimizer.h » ('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 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // Propagate sminess from CheckSmi to phis. 203 // Propagate sminess from CheckSmi to phis.
204 optimizer.PropagateSminess(); 204 optimizer.PropagateSminess();
205 205
206 // Use propagated class-ids to optimize further. 206 // Use propagated class-ids to optimize further.
207 optimizer.ApplyClassIds(); 207 optimizer.ApplyClassIds();
208 208
209 // Recompute use lists after applying class ids. 209 // Recompute use lists after applying class ids.
210 flow_graph->ComputeUseLists(); 210 flow_graph->ComputeUseLists();
211 211
212 // Do optimizations that depend on the propagated type information. 212 // Do optimizations that depend on the propagated type information.
213 // TODO(srdjan): Should this be called CanonicalizeComputations? 213 optimizer.Canonicalize();
214 optimizer.OptimizeComputations();
215 214
216 // Unbox doubles. 215 // Unbox doubles.
217 flow_graph->ComputeUseLists(); 216 flow_graph->ComputeUseLists();
218 optimizer.SelectRepresentations(); 217 optimizer.SelectRepresentations();
219 218
220 if (FLAG_constant_propagation || 219 if (FLAG_constant_propagation ||
221 FLAG_common_subexpression_elimination) { 220 FLAG_common_subexpression_elimination) {
222 flow_graph->ComputeUseLists(); 221 flow_graph->ComputeUseLists();
223 } 222 }
224 if (FLAG_constant_propagation) { 223 if (FLAG_constant_propagation) {
225 ConstantPropagator::Optimize(flow_graph); 224 ConstantPropagator::Optimize(flow_graph);
226 // A canonicalization pass to remove e.g. smi checks on smi constants. 225 // A canonicalization pass to remove e.g. smi checks on smi constants.
227 optimizer.OptimizeComputations(); 226 optimizer.Canonicalize();
228 } 227 }
229 if (FLAG_common_subexpression_elimination) { 228 if (FLAG_common_subexpression_elimination) {
230 if (DominatorBasedCSE::Optimize(flow_graph)) { 229 if (DominatorBasedCSE::Optimize(flow_graph)) {
231 // Do another round of CSE to take secondary effects into account: 230 // Do another round of CSE to take secondary effects into account:
232 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) 231 // e.g. when eliminating dependent loads (a.x[0] + a.x[0])
233 // TODO(fschneider): Change to a one-pass optimization pass. 232 // TODO(fschneider): Change to a one-pass optimization pass.
234 DominatorBasedCSE::Optimize(flow_graph); 233 DominatorBasedCSE::Optimize(flow_graph);
235 } 234 }
236 } 235 }
237 if (FLAG_loop_invariant_code_motion && 236 if (FLAG_loop_invariant_code_motion &&
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 Object::Handle(isolate->object_store()->sticky_error()); 636 Object::Handle(isolate->object_store()->sticky_error());
638 isolate->object_store()->clear_sticky_error(); 637 isolate->object_store()->clear_sticky_error();
639 isolate->set_long_jump_base(base); 638 isolate->set_long_jump_base(base);
640 return result.raw(); 639 return result.raw();
641 } 640 }
642 UNREACHABLE(); 641 UNREACHABLE();
643 return Object::null(); 642 return Object::null();
644 } 643 }
645 644
646 } // namespace dart 645 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698