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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 404 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
405 // A canonicalization pass to remove e.g. smi checks on smi constants. | 405 // A canonicalization pass to remove e.g. smi checks on smi constants. |
406 optimizer.Canonicalize(); | 406 optimizer.Canonicalize(); |
407 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 407 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
408 // Canonicalization introduced more opportunities for constant | 408 // Canonicalization introduced more opportunities for constant |
409 // propagation. | 409 // propagation. |
410 ConstantPropagator::Optimize(flow_graph); | 410 ConstantPropagator::Optimize(flow_graph); |
411 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 411 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
412 } | 412 } |
413 | 413 |
| 414 // Optimistically convert loop phis that have a single non-smi input |
| 415 // coming from the loop pre-header into smi-phis. |
| 416 if (FLAG_loop_invariant_code_motion) { |
| 417 LICM licm(flow_graph); |
| 418 licm.OptimisticallySpecializeSmiPhis(); |
| 419 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 420 } |
| 421 |
414 // Propagate types and eliminate even more type tests. | 422 // Propagate types and eliminate even more type tests. |
415 // Recompute types after constant propagation to infer more precise | 423 // Recompute types after constant propagation to infer more precise |
416 // types for uses that were previously reached by now eliminated phis. | 424 // types for uses that were previously reached by now eliminated phis. |
417 FlowGraphTypePropagator::Propagate(flow_graph); | 425 FlowGraphTypePropagator::Propagate(flow_graph); |
418 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 426 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
419 | 427 |
| 428 // Where beneficial convert Smi operations into Int32 operations. |
| 429 // Only meanigful for 32bit platforms right now. |
| 430 optimizer.WidenSmiToInt32(); |
| 431 |
420 // Unbox doubles. Performed after constant propagation to minimize | 432 // Unbox doubles. Performed after constant propagation to minimize |
421 // interference from phis merging double values and tagged | 433 // interference from phis merging double values and tagged |
422 // values coming from dead paths. | 434 // values coming from dead paths. |
423 optimizer.SelectRepresentations(); | 435 optimizer.SelectRepresentations(); |
424 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 436 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
425 | 437 |
426 if (FLAG_common_subexpression_elimination || | 438 if (FLAG_common_subexpression_elimination || |
427 FLAG_loop_invariant_code_motion) { | 439 FLAG_loop_invariant_code_motion) { |
428 flow_graph->ComputeBlockEffects(); | 440 flow_graph->ComputeBlockEffects(); |
429 } | 441 } |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 const Object& result = | 1033 const Object& result = |
1022 Object::Handle(isolate->object_store()->sticky_error()); | 1034 Object::Handle(isolate->object_store()->sticky_error()); |
1023 isolate->object_store()->clear_sticky_error(); | 1035 isolate->object_store()->clear_sticky_error(); |
1024 return result.raw(); | 1036 return result.raw(); |
1025 } | 1037 } |
1026 UNREACHABLE(); | 1038 UNREACHABLE(); |
1027 return Object::null(); | 1039 return Object::null(); |
1028 } | 1040 } |
1029 | 1041 |
1030 } // namespace dart | 1042 } // namespace dart |
OLD | NEW |