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

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

Issue 10949020: Reapply "Initial implementation of sparse conditional constant propagation." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase to HEAD. 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/lib/integers.cc ('k') | runtime/vm/flow_graph.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 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 17 matching lines...) Expand all
28 #include "vm/scanner.h" 28 #include "vm/scanner.h"
29 #include "vm/symbols.h" 29 #include "vm/symbols.h"
30 #include "vm/timer.h" 30 #include "vm/timer.h"
31 31
32 namespace dart { 32 namespace dart {
33 33
34 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code."); 34 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code.");
35 DEFINE_FLAG(bool, disassemble_optimized, false, "Disassemble optimized code."); 35 DEFINE_FLAG(bool, disassemble_optimized, false, "Disassemble optimized code.");
36 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); 36 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler.");
37 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); 37 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations.");
38 DEFINE_FLAG(bool, cp, true,
Ivan Posva 2012/09/19 22:20:18 This is a perfect example of a bad flag name. I am
39 "Do conditional constant propagation/unreachable code elimination.");
38 DEFINE_FLAG(bool, cse, true, "Do common subexpression elimination."); 40 DEFINE_FLAG(bool, cse, true, "Do common subexpression elimination.");
Ivan Posva 2012/09/19 22:20:18 ditto
39 DEFINE_FLAG(bool, licm, true, "Do loop invariant code motion."); 41 DEFINE_FLAG(bool, licm, true, "Do loop invariant code motion.");
Ivan Posva 2012/09/19 22:20:18 ditto
40 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, 42 DEFINE_FLAG(int, deoptimization_counter_threshold, 5,
41 "How many times we allow deoptimization before we disallow" 43 "How many times we allow deoptimization before we disallow"
42 " certain optimizations"); 44 " certain optimizations");
43 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); 45 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining");
44 DECLARE_FLAG(bool, print_flow_graph); 46 DECLARE_FLAG(bool, print_flow_graph);
45 47
46 48
47 // Compile a function. Should call only if the function has not been compiled. 49 // Compile a function. Should call only if the function has not been compiled.
48 // Arg0: function object. 50 // Arg0: function object.
49 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { 51 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // Propagate sminess from CheckSmi to phis. 190 // Propagate sminess from CheckSmi to phis.
189 optimizer.PropagateSminess(); 191 optimizer.PropagateSminess();
190 192
191 // Do optimizations that depend on the propagated type information. 193 // Do optimizations that depend on the propagated type information.
192 optimizer.OptimizeComputations(); 194 optimizer.OptimizeComputations();
193 195
194 // Unbox doubles. 196 // Unbox doubles.
195 flow_graph->ComputeUseLists(); 197 flow_graph->ComputeUseLists();
196 optimizer.SelectRepresentations(); 198 optimizer.SelectRepresentations();
197 199
198 if (FLAG_cse) { 200 if (FLAG_cp || FLAG_cse) flow_graph->ComputeUseLists();
199 flow_graph->ComputeUseLists(); 201 if (FLAG_cp) ConstantPropagator::Optimize(flow_graph);
200 DominatorBasedCSE::Optimize(flow_graph); 202 if (FLAG_cse) DominatorBasedCSE::Optimize(flow_graph);
201 } 203 if (FLAG_licm) LICM::Optimize(flow_graph);
202 if (FLAG_licm) {
203 LICM::Optimize(flow_graph);
204 }
205 204
206 // Perform register allocation on the SSA graph. 205 // Perform register allocation on the SSA graph.
207 FlowGraphAllocator allocator(*flow_graph); 206 FlowGraphAllocator allocator(*flow_graph);
208 allocator.AllocateRegisters(); 207 allocator.AllocateRegisters();
209 208
210 if (FLAG_print_flow_graph) { 209 if (FLAG_print_flow_graph) {
211 OS::Print("After Optimizations:\n"); 210 OS::Print("After Optimizations:\n");
212 FlowGraphPrinter printer(*flow_graph); 211 FlowGraphPrinter printer(*flow_graph);
213 printer.PrintBlocks(); 212 printer.PrintBlocks();
214 } 213 }
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 result = isolate->object_store()->sticky_error(); 559 result = isolate->object_store()->sticky_error();
561 isolate->object_store()->clear_sticky_error(); 560 isolate->object_store()->clear_sticky_error();
562 isolate->set_long_jump_base(base); 561 isolate->set_long_jump_base(base);
563 return result.raw(); 562 return result.raw();
564 } 563 }
565 UNREACHABLE(); 564 UNREACHABLE();
566 return Object::null(); 565 return Object::null();
567 } 566 }
568 567
569 } // namespace dart 568 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/integers.cc ('k') | runtime/vm/flow_graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698