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

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

Issue 12212093: Convert some compiler passes to preserve valid def-use chains. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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.h » ('j') | runtime/vm/flow_graph.cc » ('J')
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (optimized) { 171 if (optimized) {
172 TimerScope timer(FLAG_compiler_stats, 172 TimerScope timer(FLAG_compiler_stats,
173 &CompilerStats::graphoptimizer_timer, 173 &CompilerStats::graphoptimizer_timer,
174 isolate); 174 isolate);
175 175
176 flow_graph->ComputeUseLists(); 176 flow_graph->ComputeUseLists();
177 177
178 FlowGraphOptimizer optimizer(flow_graph); 178 FlowGraphOptimizer optimizer(flow_graph);
179 optimizer.ApplyICData(); 179 optimizer.ApplyICData();
180 180
181 // Compute the use lists.
182 flow_graph->ComputeUseLists();
183
184 // Inlining (mutates the flow graph) 181 // Inlining (mutates the flow graph)
185 if (FLAG_use_inlining) { 182 if (FLAG_use_inlining) {
186 TimerScope timer(FLAG_compiler_stats, 183 TimerScope timer(FLAG_compiler_stats,
187 &CompilerStats::graphinliner_timer); 184 &CompilerStats::graphinliner_timer);
188 FlowGraphInliner inliner(flow_graph); 185 FlowGraphInliner inliner(flow_graph);
189 inliner.Inline(); 186 inliner.Inline();
190 // Use lists are maintained and validated by the inliner. 187 // Use lists are maintained and validated by the inliner.
191 } 188 }
192 189
193 // Propagate types and eliminate more type tests. 190 // Propagate types and eliminate more type tests.
194 if (FLAG_propagate_types) { 191 if (FLAG_propagate_types) {
195 FlowGraphTypePropagator propagator(flow_graph); 192 FlowGraphTypePropagator propagator(flow_graph);
196 propagator.PropagateTypes(); 193 propagator.PropagateTypes();
197 } 194 }
198 195
199 // Propagate sminess from CheckSmi to phis. 196 // Propagate sminess from CheckSmi to phis.
200 flow_graph->ComputeUseLists(); 197 flow_graph->ComputeUseLists();
201 optimizer.PropagateSminess(); 198 optimizer.PropagateSminess();
202 199
203 // Use propagated class-ids to optimize further. 200 // Use propagated class-ids to optimize further.
204 optimizer.ApplyClassIds(); 201 optimizer.ApplyClassIds();
205 202
206 // Recompute use lists after applying class ids.
207 flow_graph->ComputeUseLists();
208
209 // Do optimizations that depend on the propagated type information. 203 // Do optimizations that depend on the propagated type information.
210 optimizer.Canonicalize(); 204 optimizer.Canonicalize();
211 205
212 flow_graph->ComputeUseLists();
213
214 if (FLAG_constant_propagation) { 206 if (FLAG_constant_propagation) {
215 ConstantPropagator::Optimize(flow_graph); 207 ConstantPropagator::Optimize(flow_graph);
216 // A canonicalization pass to remove e.g. smi checks on smi constants. 208 // A canonicalization pass to remove e.g. smi checks on smi constants.
217 optimizer.Canonicalize(); 209 optimizer.Canonicalize();
218 } 210 }
219 211
220 // Unbox doubles. Performed after constant propagation to minimize 212 // Unbox doubles. Performed after constant propagation to minimize
221 // interference from phis merging double values and tagged 213 // interference from phis merging double values and tagged
222 // values comming from dead paths. 214 // values comming from dead paths.
223 flow_graph->ComputeUseLists();
224 optimizer.SelectRepresentations(); 215 optimizer.SelectRepresentations();
225 flow_graph->ComputeUseLists();
226 216
227 if (FLAG_common_subexpression_elimination) { 217 if (FLAG_common_subexpression_elimination) {
228 if (DominatorBasedCSE::Optimize(flow_graph)) { 218 if (DominatorBasedCSE::Optimize(flow_graph)) {
229 // Do another round of CSE to take secondary effects into account: 219 // Do another round of CSE to take secondary effects into account:
230 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) 220 // e.g. when eliminating dependent loads (a.x[0] + a.x[0])
231 // TODO(fschneider): Change to a one-pass optimization pass. 221 // TODO(fschneider): Change to a one-pass optimization pass.
232 DominatorBasedCSE::Optimize(flow_graph); 222 DominatorBasedCSE::Optimize(flow_graph);
233 } 223 }
234 } 224 }
235 if (FLAG_loop_invariant_code_motion && 225 if (FLAG_loop_invariant_code_motion &&
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 Object::Handle(isolate->object_store()->sticky_error()); 629 Object::Handle(isolate->object_store()->sticky_error());
640 isolate->object_store()->clear_sticky_error(); 630 isolate->object_store()->clear_sticky_error();
641 isolate->set_long_jump_base(base); 631 isolate->set_long_jump_base(base);
642 return result.raw(); 632 return result.raw();
643 } 633 }
644 UNREACHABLE(); 634 UNREACHABLE();
645 return Object::null(); 635 return Object::null();
646 } 636 }
647 637
648 } // namespace dart 638 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph.h » ('j') | runtime/vm/flow_graph.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698