| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 block_order.Add(graph_builder.postorder_block_entries()[i]); | 171 block_order.Add(graph_builder.postorder_block_entries()[i]); |
| 172 } | 172 } |
| 173 if (optimized) { | 173 if (optimized) { |
| 174 FlowGraphOptimizer optimizer(block_order); | 174 FlowGraphOptimizer optimizer(block_order); |
| 175 optimizer.ApplyICData(); | 175 optimizer.ApplyICData(); |
| 176 | 176 |
| 177 // Propagate types and eliminate more type tests. | 177 // Propagate types and eliminate more type tests. |
| 178 FlowGraphTypePropagator propagator(parsed_function, block_order); | 178 FlowGraphTypePropagator propagator(parsed_function, block_order); |
| 179 propagator.PropagateTypes(); | 179 propagator.PropagateTypes(); |
| 180 | 180 |
| 181 // Do optimizations that depend on the propagated type information. |
| 182 optimizer.OptimizeComputations(); |
| 183 |
| 181 if (use_ssa) { | 184 if (use_ssa) { |
| 182 // Perform register allocation on the SSA graph. | 185 // Perform register allocation on the SSA graph. |
| 183 FlowGraphAllocator allocator(block_order, &graph_builder); | 186 FlowGraphAllocator allocator(block_order, &graph_builder); |
| 184 allocator.AllocateRegisters(); | 187 allocator.AllocateRegisters(); |
| 185 } | 188 } |
| 186 if (FLAG_print_flow_graph) { | 189 if (FLAG_print_flow_graph) { |
| 187 OS::Print("After Optimizations:\n"); | 190 OS::Print("After Optimizations:\n"); |
| 188 FlowGraphPrinter printer(Function::Handle(), block_order); | 191 FlowGraphPrinter printer(Function::Handle(), block_order); |
| 189 printer.PrintBlocks(); | 192 printer.PrintBlocks(); |
| 190 } | 193 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 if (FLAG_trace_compiler) { | 383 if (FLAG_trace_compiler) { |
| 381 OS::Print("--> '%s' entry: 0x%x\n", | 384 OS::Print("--> '%s' entry: 0x%x\n", |
| 382 function.ToFullyQualifiedCString(), | 385 function.ToFullyQualifiedCString(), |
| 383 Code::Handle(function.CurrentCode()).EntryPoint()); | 386 Code::Handle(function.CurrentCode()).EntryPoint()); |
| 384 } | 387 } |
| 385 if (Isolate::Current()->debugger()->IsActive()) { | 388 if (Isolate::Current()->debugger()->IsActive()) { |
| 386 Isolate::Current()->debugger()->NotifyCompilation(function); | 389 Isolate::Current()->debugger()->NotifyCompilation(function); |
| 387 } | 390 } |
| 388 if (FLAG_disassemble) { | 391 if (FLAG_disassemble) { |
| 389 DisassembleCode(function, optimized); | 392 DisassembleCode(function, optimized); |
| 390 } | 393 } else if (FLAG_disassemble_optimized && optimized) { |
| 391 if (FLAG_disassemble_optimized && optimized) { | |
| 392 // Print unoptimized code along with the optimized code. | 394 // Print unoptimized code along with the optimized code. |
| 393 DisassembleCode(function, false); | 395 DisassembleCode(function, false); |
| 394 DisassembleCode(function, true); | 396 DisassembleCode(function, true); |
| 395 } | 397 } |
| 396 isolate->set_long_jump_base(base); | 398 isolate->set_long_jump_base(base); |
| 397 return Error::null(); | 399 return Error::null(); |
| 398 } else { | 400 } else { |
| 399 Error& error = Error::Handle(); | 401 Error& error = Error::Handle(); |
| 400 // We got an error during compilation. | 402 // We got an error during compilation. |
| 401 error = isolate->object_store()->sticky_error(); | 403 error = isolate->object_store()->sticky_error(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 result = isolate->object_store()->sticky_error(); | 518 result = isolate->object_store()->sticky_error(); |
| 517 isolate->object_store()->clear_sticky_error(); | 519 isolate->object_store()->clear_sticky_error(); |
| 518 isolate->set_long_jump_base(base); | 520 isolate->set_long_jump_base(base); |
| 519 return result.raw(); | 521 return result.raw(); |
| 520 } | 522 } |
| 521 UNREACHABLE(); | 523 UNREACHABLE(); |
| 522 return Object::null(); | 524 return Object::null(); |
| 523 } | 525 } |
| 524 | 526 |
| 525 } // namespace dart | 527 } // namespace dart |
| OLD | NEW |