| OLD | NEW |
| 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 Loading... |
| 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, |
| 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."); |
| 39 DEFINE_FLAG(bool, licm, true, "Do loop invariant code motion."); | 41 DEFINE_FLAG(bool, licm, true, "Do loop invariant code motion."); |
| 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. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // Propagate sminess from CheckSmi to phis. | 208 // Propagate sminess from CheckSmi to phis. |
| 207 optimizer.PropagateSminess(); | 209 optimizer.PropagateSminess(); |
| 208 | 210 |
| 209 // Do optimizations that depend on the propagated type information. | 211 // Do optimizations that depend on the propagated type information. |
| 210 optimizer.OptimizeComputations(); | 212 optimizer.OptimizeComputations(); |
| 211 | 213 |
| 212 // Unbox doubles. | 214 // Unbox doubles. |
| 213 flow_graph->ComputeUseLists(); | 215 flow_graph->ComputeUseLists(); |
| 214 optimizer.SelectRepresentations(); | 216 optimizer.SelectRepresentations(); |
| 215 | 217 |
| 216 if (FLAG_cse) { | 218 if (FLAG_cp || FLAG_cse) flow_graph->ComputeUseLists(); |
| 217 flow_graph->ComputeUseLists(); | 219 if (FLAG_cp) ConstantPropagator::Optimize(flow_graph); |
| 218 DominatorBasedCSE::Optimize(flow_graph); | 220 if (FLAG_cse) DominatorBasedCSE::Optimize(flow_graph); |
| 219 } | 221 if (FLAG_licm) LICM::Optimize(flow_graph); |
| 220 if (FLAG_licm) { | |
| 221 LICM::Optimize(flow_graph); | |
| 222 } | |
| 223 | 222 |
| 224 // Perform register allocation on the SSA graph. | 223 // Perform register allocation on the SSA graph. |
| 225 FlowGraphAllocator allocator(*flow_graph); | 224 FlowGraphAllocator allocator(*flow_graph); |
| 226 allocator.AllocateRegisters(); | 225 allocator.AllocateRegisters(); |
| 227 | 226 |
| 228 if (FLAG_print_flow_graph) { | 227 if (FLAG_print_flow_graph) { |
| 229 OS::Print("After Optimizations:\n"); | 228 OS::Print("After Optimizations:\n"); |
| 230 FlowGraphPrinter printer(*flow_graph); | 229 FlowGraphPrinter printer(*flow_graph); |
| 231 printer.PrintBlocks(); | 230 printer.PrintBlocks(); |
| 232 } | 231 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 result = isolate->object_store()->sticky_error(); | 577 result = isolate->object_store()->sticky_error(); |
| 579 isolate->object_store()->clear_sticky_error(); | 578 isolate->object_store()->clear_sticky_error(); |
| 580 isolate->set_long_jump_base(base); | 579 isolate->set_long_jump_base(base); |
| 581 return result.raw(); | 580 return result.raw(); |
| 582 } | 581 } |
| 583 UNREACHABLE(); | 582 UNREACHABLE(); |
| 584 return Object::null(); | 583 return Object::null(); |
| 585 } | 584 } |
| 586 | 585 |
| 587 } // namespace dart | 586 } // namespace dart |
| OLD | NEW |