| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 converted = new(Z) UnboxedIntConverterInstr(from, | 716 converted = new(Z) UnboxedIntConverterInstr(from, |
| 717 to, | 717 to, |
| 718 use->CopyWithType(), | 718 use->CopyWithType(), |
| 719 deopt_id); | 719 deopt_id); |
| 720 } else if ((from == kUnboxedInt32) && (to == kUnboxedDouble)) { | 720 } else if ((from == kUnboxedInt32) && (to == kUnboxedDouble)) { |
| 721 converted = new Int32ToDoubleInstr(use->CopyWithType()); | 721 converted = new Int32ToDoubleInstr(use->CopyWithType()); |
| 722 } else if ((from == kUnboxedMint) && | 722 } else if ((from == kUnboxedMint) && |
| 723 (to == kUnboxedDouble) && | 723 (to == kUnboxedDouble) && |
| 724 CanConvertUnboxedMintToDouble()) { | 724 CanConvertUnboxedMintToDouble()) { |
| 725 const intptr_t deopt_id = (deopt_target != NULL) ? | 725 const intptr_t deopt_id = (deopt_target != NULL) ? |
| 726 deopt_target->DeoptimizationTarget() : Thread::kNoDeoptId; | 726 deopt_target->DeoptimizationTarget() : Thread::kNoDeoptId; |
| 727 ASSERT(CanUnboxDouble()); | 727 ASSERT(CanUnboxDouble()); |
| 728 converted = new MintToDoubleInstr(use->CopyWithType(), deopt_id); | 728 converted = new MintToDoubleInstr(use->CopyWithType(), deopt_id); |
| 729 } else if ((from == kTagged) && Boxing::Supports(to)) { | 729 } else if ((from == kTagged) && Boxing::Supports(to)) { |
| 730 const intptr_t deopt_id = (deopt_target != NULL) ? | 730 const intptr_t deopt_id = (deopt_target != NULL) ? |
| 731 deopt_target->DeoptimizationTarget() : Thread::kNoDeoptId; | 731 deopt_target->DeoptimizationTarget() : Thread::kNoDeoptId; |
| 732 converted = UnboxInstr::Create(to, use->CopyWithType(), deopt_id); | 732 converted = UnboxInstr::Create(to, use->CopyWithType(), deopt_id); |
| 733 } else if ((to == kTagged) && Boxing::Supports(from)) { | 733 } else if ((to == kTagged) && Boxing::Supports(from)) { |
| 734 converted = BoxInstr::Create(from, use->CopyWithType()); | 734 converted = BoxInstr::Create(from, use->CopyWithType()); |
| 735 } else { | 735 } else { |
| 736 // We have failed to find a suitable conversion instruction. | 736 // We have failed to find a suitable conversion instruction. |
| 737 // Insert two "dummy" conversion instructions with the correct | 737 // Insert two "dummy" conversion instructions with the correct |
| 738 // "from" and "to" representation. The inserted instructions will | 738 // "from" and "to" representation. The inserted instructions will |
| 739 // trigger a deoptimization if executed. See #12417 for a discussion. | 739 // trigger a deoptimization if executed. See #12417 for a discussion. |
| 740 const intptr_t deopt_id = (deopt_target != NULL) ? | 740 const intptr_t deopt_id = (deopt_target != NULL) ? |
| 741 deopt_target->DeoptimizationTarget() : Thread::kNoDeoptId; | 741 deopt_target->DeoptimizationTarget() : Thread::kNoDeoptId; |
| 742 ASSERT(Boxing::Supports(from)); | 742 ASSERT(Boxing::Supports(from)); |
| 743 ASSERT(Boxing::Supports(to)); | 743 ASSERT(Boxing::Supports(to)); |
| 744 Definition* boxed = BoxInstr::Create(from, use->CopyWithType()); | 744 Definition* boxed = BoxInstr::Create(from, use->CopyWithType()); |
| 745 use->BindTo(boxed); | 745 use->BindTo(boxed); |
| 746 InsertBefore(insert_before, boxed, NULL, FlowGraph::kValue); | 746 InsertBefore(insert_before, boxed, NULL, FlowGraph::kValue); |
| 747 converted = UnboxInstr::Create(to, new(Z) Value(boxed), deopt_id); | 747 converted = UnboxInstr::Create(to, new(Z) Value(boxed), deopt_id); |
| 748 } | 748 } |
| 749 ASSERT(converted != NULL); | 749 ASSERT(converted != NULL); |
| 750 InsertBefore(insert_before, converted, use->instruction()->env(), | 750 InsertBefore(insert_before, converted, use->instruction()->env(), |
| 751 FlowGraph::kValue); | 751 FlowGraph::kValue); |
| (...skipping 8034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8786 | 8786 |
| 8787 // Insert materializations at environment uses. | 8787 // Insert materializations at environment uses. |
| 8788 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { | 8788 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { |
| 8789 CreateMaterializationAt( | 8789 CreateMaterializationAt( |
| 8790 exits_collector_.exits()[i], alloc, *slots); | 8790 exits_collector_.exits()[i], alloc, *slots); |
| 8791 } | 8791 } |
| 8792 } | 8792 } |
| 8793 | 8793 |
| 8794 | 8794 |
| 8795 } // namespace dart | 8795 } // namespace dart |
| OLD | NEW |