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

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

Issue 10872035: Add a simple dominator based redundancy elimination. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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_optimizer.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 #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 16 matching lines...) Expand all
27 #include "vm/scanner.h" 27 #include "vm/scanner.h"
28 #include "vm/symbols.h" 28 #include "vm/symbols.h"
29 #include "vm/timer.h" 29 #include "vm/timer.h"
30 30
31 namespace dart { 31 namespace dart {
32 32
33 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code."); 33 DEFINE_FLAG(bool, disassemble, false, "Disassemble dart code.");
34 DEFINE_FLAG(bool, disassemble_optimized, false, "Disassemble optimized code."); 34 DEFINE_FLAG(bool, disassemble_optimized, false, "Disassemble optimized code.");
35 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); 35 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler.");
36 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); 36 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations.");
37 DEFINE_FLAG(bool, local_cse, true, "Do local subexpression elimination."); 37 DEFINE_FLAG(bool, cse, true, "Do common subexpression elimination.");
38 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, 38 DEFINE_FLAG(int, deoptimization_counter_threshold, 5,
39 "How many times we allow deoptimization before we disallow" 39 "How many times we allow deoptimization before we disallow"
40 " certain optimizations"); 40 " certain optimizations");
41 DECLARE_FLAG(bool, print_flow_graph); 41 DECLARE_FLAG(bool, print_flow_graph);
42 42
43 43
44 // Compile a function. Should call only if the function has not been compiled. 44 // Compile a function. Should call only if the function has not been compiled.
45 // Arg0: function object. 45 // Arg0: function object.
46 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { 46 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
47 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count()); 47 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count());
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 FlowGraphOptimizer optimizer(*flow_graph); 182 FlowGraphOptimizer optimizer(*flow_graph);
183 optimizer.ApplyICData(); 183 optimizer.ApplyICData();
184 184
185 // Propagate types and eliminate more type tests. 185 // Propagate types and eliminate more type tests.
186 FlowGraphTypePropagator propagator(*flow_graph); 186 FlowGraphTypePropagator propagator(*flow_graph);
187 propagator.PropagateTypes(); 187 propagator.PropagateTypes();
188 188
189 // Do optimizations that depend on the propagated type information. 189 // Do optimizations that depend on the propagated type information.
190 optimizer.OptimizeComputations(); 190 optimizer.OptimizeComputations();
191 191
192 if (FLAG_local_cse) { 192 if (FLAG_cse) {
193 LocalCSE local_cse(*flow_graph); 193 DominatorBasedCSE::Optimize(flow_graph->graph_entry());
194 local_cse.Optimize();
195 } 194 }
196 195
197 // Perform register allocation on the SSA graph. 196 // Perform register allocation on the SSA graph.
198 FlowGraphAllocator allocator(*flow_graph); 197 FlowGraphAllocator allocator(*flow_graph);
199 allocator.AllocateRegisters(); 198 allocator.AllocateRegisters();
200 199
201 if (FLAG_print_flow_graph) { 200 if (FLAG_print_flow_graph) {
202 OS::Print("After Optimizations:\n"); 201 OS::Print("After Optimizations:\n");
203 FlowGraphPrinter printer(*flow_graph); 202 FlowGraphPrinter printer(*flow_graph);
204 printer.PrintBlocks(); 203 printer.PrintBlocks();
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 result = isolate->object_store()->sticky_error(); 550 result = isolate->object_store()->sticky_error();
552 isolate->object_store()->clear_sticky_error(); 551 isolate->object_store()->clear_sticky_error();
553 isolate->set_long_jump_base(base); 552 isolate->set_long_jump_base(base);
554 return result.raw(); 553 return result.raw();
555 } 554 }
556 UNREACHABLE(); 555 UNREACHABLE();
557 return Object::null(); 556 return Object::null();
558 } 557 }
559 558
560 } // namespace dart 559 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph.h » ('j') | runtime/vm/flow_graph_optimizer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698