| 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 | 8 |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 if (FLAG_print_flow_graph || | 300 if (FLAG_print_flow_graph || |
| 301 (optimized && FLAG_print_flow_graph_optimized)) { | 301 (optimized && FLAG_print_flow_graph_optimized)) { |
| 302 if (osr_id == Isolate::kNoDeoptId) { | 302 if (osr_id == Isolate::kNoDeoptId) { |
| 303 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); | 303 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); |
| 304 } else { | 304 } else { |
| 305 FlowGraphPrinter::PrintGraph("For OSR", flow_graph); | 305 FlowGraphPrinter::PrintGraph("For OSR", flow_graph); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 | 308 |
| 309 BlockScheduler block_scheduler(flow_graph); | 309 BlockScheduler block_scheduler(flow_graph); |
| 310 if (optimized && FLAG_reorder_basic_blocks) { | 310 const bool reorder_blocks = |
| 311 FlowGraph::ShouldReorderBlocks(function, optimized); |
| 312 if (reorder_blocks) { |
| 311 block_scheduler.AssignEdgeWeights(); | 313 block_scheduler.AssignEdgeWeights(); |
| 312 } | 314 } |
| 313 | 315 |
| 314 if (optimized) { | 316 if (optimized) { |
| 315 TimerScope timer(FLAG_compiler_stats, | 317 TimerScope timer(FLAG_compiler_stats, |
| 316 &CompilerStats::ssa_timer, | 318 &CompilerStats::ssa_timer, |
| 317 isolate); | 319 isolate); |
| 318 // Transform to SSA (virtual register 0 and no inlining arguments). | 320 // Transform to SSA (virtual register 0 and no inlining arguments). |
| 319 flow_graph->ComputeSSA(0, NULL); | 321 flow_graph->ComputeSSA(0, NULL); |
| 320 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 322 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 // Remove all MaterializeObject instructions inserted by allocation | 503 // Remove all MaterializeObject instructions inserted by allocation |
| 502 // sinking from the flow graph and let them float on the side | 504 // sinking from the flow graph and let them float on the side |
| 503 // referenced only from environments. Register allocator will consider | 505 // referenced only from environments. Register allocator will consider |
| 504 // them as part of a deoptimization environment. | 506 // them as part of a deoptimization environment. |
| 505 sinking->DetachMaterializations(); | 507 sinking->DetachMaterializations(); |
| 506 } | 508 } |
| 507 | 509 |
| 508 // Perform register allocation on the SSA graph. | 510 // Perform register allocation on the SSA graph. |
| 509 FlowGraphAllocator allocator(*flow_graph); | 511 FlowGraphAllocator allocator(*flow_graph); |
| 510 allocator.AllocateRegisters(); | 512 allocator.AllocateRegisters(); |
| 511 if (FLAG_reorder_basic_blocks) block_scheduler.ReorderBlocks(); | 513 if (reorder_blocks) block_scheduler.ReorderBlocks(); |
| 512 | 514 |
| 513 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { | 515 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { |
| 514 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); | 516 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); |
| 515 } | 517 } |
| 516 } | 518 } |
| 517 | 519 |
| 518 Assembler assembler(use_far_branches); | 520 Assembler assembler(use_far_branches); |
| 519 FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); | 521 FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); |
| 520 { | 522 { |
| 521 TimerScope timer(FLAG_compiler_stats, | 523 TimerScope timer(FLAG_compiler_stats, |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 Object::Handle(isolate->object_store()->sticky_error()); | 926 Object::Handle(isolate->object_store()->sticky_error()); |
| 925 isolate->object_store()->clear_sticky_error(); | 927 isolate->object_store()->clear_sticky_error(); |
| 926 isolate->set_long_jump_base(base); | 928 isolate->set_long_jump_base(base); |
| 927 return result.raw(); | 929 return result.raw(); |
| 928 } | 930 } |
| 929 UNREACHABLE(); | 931 UNREACHABLE(); |
| 930 return Object::null(); | 932 return Object::null(); |
| 931 } | 933 } |
| 932 | 934 |
| 933 } // namespace dart | 935 } // namespace dart |
| OLD | NEW |