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