| 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 18 matching lines...) Expand all Loading... |
| 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, cse, true, "Do common subexpression elimination."); | 38 DEFINE_FLAG(bool, cse, true, "Do common subexpression elimination."); |
| 39 DEFINE_FLAG(bool, licm, true, "Do loop invariant code motion."); |
| 39 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, | 40 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, |
| 40 "How many times we allow deoptimization before we disallow" | 41 "How many times we allow deoptimization before we disallow" |
| 41 " certain optimizations"); | 42 " certain optimizations"); |
| 42 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 43 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
| 43 DECLARE_FLAG(bool, print_flow_graph); | 44 DECLARE_FLAG(bool, print_flow_graph); |
| 44 | 45 |
| 45 | 46 |
| 46 // Compile a function. Should call only if the function has not been compiled. | 47 // Compile a function. Should call only if the function has not been compiled. |
| 47 // Arg0: function object. | 48 // Arg0: function object. |
| 48 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | 49 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 optimizer.OptimizeComputations(); | 207 optimizer.OptimizeComputations(); |
| 207 | 208 |
| 208 // Unbox doubles. | 209 // Unbox doubles. |
| 209 flow_graph->ComputeUseLists(); | 210 flow_graph->ComputeUseLists(); |
| 210 optimizer.SelectRepresentations(); | 211 optimizer.SelectRepresentations(); |
| 211 | 212 |
| 212 if (FLAG_cse) { | 213 if (FLAG_cse) { |
| 213 flow_graph->ComputeUseLists(); | 214 flow_graph->ComputeUseLists(); |
| 214 DominatorBasedCSE::Optimize(flow_graph->graph_entry()); | 215 DominatorBasedCSE::Optimize(flow_graph->graph_entry()); |
| 215 } | 216 } |
| 217 if (FLAG_licm) { |
| 218 LICM::Optimize(flow_graph); |
| 219 } |
| 216 | 220 |
| 217 // Perform register allocation on the SSA graph. | 221 // Perform register allocation on the SSA graph. |
| 218 FlowGraphAllocator allocator(*flow_graph); | 222 FlowGraphAllocator allocator(*flow_graph); |
| 219 allocator.AllocateRegisters(); | 223 allocator.AllocateRegisters(); |
| 220 | 224 |
| 221 if (FLAG_print_flow_graph) { | 225 if (FLAG_print_flow_graph) { |
| 222 OS::Print("After Optimizations:\n"); | 226 OS::Print("After Optimizations:\n"); |
| 223 FlowGraphPrinter printer(*flow_graph); | 227 FlowGraphPrinter printer(*flow_graph); |
| 224 printer.PrintBlocks(); | 228 printer.PrintBlocks(); |
| 225 } | 229 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 result = isolate->object_store()->sticky_error(); | 575 result = isolate->object_store()->sticky_error(); |
| 572 isolate->object_store()->clear_sticky_error(); | 576 isolate->object_store()->clear_sticky_error(); |
| 573 isolate->set_long_jump_base(base); | 577 isolate->set_long_jump_base(base); |
| 574 return result.raw(); | 578 return result.raw(); |
| 575 } | 579 } |
| 576 UNREACHABLE(); | 580 UNREACHABLE(); |
| 577 return Object::null(); | 581 return Object::null(); |
| 578 } | 582 } |
| 579 | 583 |
| 580 } // namespace dart | 584 } // namespace dart |
| OLD | NEW |