| 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/code_generator.h" | 10 #include "vm/code_generator.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 | 206 |
| 207 // Use propagated class-ids to optimize further. | 207 // Use propagated class-ids to optimize further. |
| 208 optimizer.ApplyClassIds(); | 208 optimizer.ApplyClassIds(); |
| 209 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 209 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 210 | 210 |
| 211 // Do optimizations that depend on the propagated type information. | 211 // Do optimizations that depend on the propagated type information. |
| 212 optimizer.Canonicalize(); | 212 optimizer.Canonicalize(); |
| 213 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 213 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 214 | 214 |
| 215 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { | |
| 216 FlowGraphPrinter::PrintGraph("Before BranchSimplifier", flow_graph); | |
| 217 } | |
| 218 | |
| 219 BranchSimplifier::Simplify(flow_graph); | 215 BranchSimplifier::Simplify(flow_graph); |
| 220 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 216 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 221 | 217 |
| 222 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { | |
| 223 FlowGraphPrinter::PrintGraph("Before CP", flow_graph); | |
| 224 } | |
| 225 | |
| 226 if (FLAG_constant_propagation) { | 218 if (FLAG_constant_propagation) { |
| 227 ConstantPropagator::Optimize(flow_graph); | 219 ConstantPropagator::Optimize(flow_graph); |
| 228 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 220 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 229 // A canonicalization pass to remove e.g. smi checks on smi constants. | 221 // A canonicalization pass to remove e.g. smi checks on smi constants. |
| 230 optimizer.Canonicalize(); | 222 optimizer.Canonicalize(); |
| 231 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 223 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 232 } | 224 } |
| 233 | 225 |
| 234 // Propagate types and eliminate even more type tests. | 226 // Propagate types and eliminate even more type tests. |
| 235 if (FLAG_propagate_types) { | 227 if (FLAG_propagate_types) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 if (FLAG_propagate_types) { | 268 if (FLAG_propagate_types) { |
| 277 // Recompute types after code movement was done to ensure correct | 269 // Recompute types after code movement was done to ensure correct |
| 278 // reaching types for hoisted values. | 270 // reaching types for hoisted values. |
| 279 FlowGraphTypePropagator propagator(flow_graph); | 271 FlowGraphTypePropagator propagator(flow_graph); |
| 280 propagator.Propagate(); | 272 propagator.Propagate(); |
| 281 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 273 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 282 } | 274 } |
| 283 optimizer.Canonicalize(); | 275 optimizer.Canonicalize(); |
| 284 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 276 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 285 | 277 |
| 286 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { | |
| 287 FlowGraphPrinter::PrintGraph("Before register allocation", flow_graph); | |
| 288 } | |
| 289 | |
| 290 // Perform register allocation on the SSA graph. | 278 // Perform register allocation on the SSA graph. |
| 291 FlowGraphAllocator allocator(*flow_graph); | 279 FlowGraphAllocator allocator(*flow_graph); |
| 292 allocator.AllocateRegisters(); | 280 allocator.AllocateRegisters(); |
| 293 | 281 |
| 294 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { | 282 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { |
| 295 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); | 283 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); |
| 296 } | 284 } |
| 297 } | 285 } |
| 298 | 286 |
| 299 Assembler assembler; | 287 Assembler assembler; |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 Object::Handle(isolate->object_store()->sticky_error()); | 680 Object::Handle(isolate->object_store()->sticky_error()); |
| 693 isolate->object_store()->clear_sticky_error(); | 681 isolate->object_store()->clear_sticky_error(); |
| 694 isolate->set_long_jump_base(base); | 682 isolate->set_long_jump_base(base); |
| 695 return result.raw(); | 683 return result.raw(); |
| 696 } | 684 } |
| 697 UNREACHABLE(); | 685 UNREACHABLE(); |
| 698 return Object::null(); | 686 return Object::null(); |
| 699 } | 687 } |
| 700 | 688 |
| 701 } // namespace dart | 689 } // namespace dart |
| OLD | NEW |