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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
6 | 6 |
7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
8 | 8 |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 cpu_reg_slots[i] = next_slot++; | 681 cpu_reg_slots[i] = next_slot++; |
682 } else { | 682 } else { |
683 cpu_reg_slots[i] = -1; | 683 cpu_reg_slots[i] = -1; |
684 } | 684 } |
685 } | 685 } |
686 | 686 |
687 // 2. Iterate the environment and replace register locations with the | 687 // 2. Iterate the environment and replace register locations with the |
688 // corresponding spill slot locations. | 688 // corresponding spill slot locations. |
689 for (Environment::DeepIterator it(env); !it.Done(); it.Advance()) { | 689 for (Environment::DeepIterator it(env); !it.Done(); it.Advance()) { |
690 Location loc = it.CurrentLocation(); | 690 Location loc = it.CurrentLocation(); |
691 if (loc.IsRegister()) { | 691 Value* value = it.CurrentValue(); |
692 intptr_t index = cpu_reg_slots[loc.reg()]; | 692 it.SetCurrentLocation(loc.RemapForSlowPath( |
693 ASSERT(index >= 0); | 693 value->definition(), cpu_reg_slots, fpu_reg_slots)); |
694 it.SetCurrentLocation(Location::StackSlot(index)); | |
695 } else if (loc.IsFpuRegister()) { | |
696 intptr_t index = fpu_reg_slots[loc.fpu_reg()]; | |
697 ASSERT(index >= 0); | |
698 Value* value = it.CurrentValue(); | |
699 switch (value->definition()->representation()) { | |
700 case kUnboxedDouble: | |
701 it.SetCurrentLocation(Location::DoubleStackSlot(index)); | |
702 break; | |
703 case kUnboxedFloat32x4: | |
704 case kUnboxedInt32x4: | |
705 case kUnboxedFloat64x2: | |
706 it.SetCurrentLocation(Location::QuadStackSlot(index)); | |
707 break; | |
708 default: | |
709 UNREACHABLE(); | |
710 } | |
711 } else if (loc.IsPairLocation()) { | |
712 intptr_t representation = | |
713 it.CurrentValue()->definition()->representation(); | |
714 ASSERT(representation == kUnboxedMint); | |
715 PairLocation* value_pair = loc.AsPairLocation(); | |
716 intptr_t index_lo; | |
717 intptr_t index_hi; | |
718 if (value_pair->At(0).IsRegister()) { | |
719 index_lo = cpu_reg_slots[value_pair->At(0).reg()]; | |
720 } else { | |
721 ASSERT(value_pair->At(0).IsStackSlot()); | |
722 index_lo = value_pair->At(0).stack_index(); | |
723 } | |
724 if (value_pair->At(1).IsRegister()) { | |
725 index_hi = cpu_reg_slots[value_pair->At(1).reg()]; | |
726 } else { | |
727 ASSERT(value_pair->At(1).IsStackSlot()); | |
728 index_hi = value_pair->At(1).stack_index(); | |
729 } | |
730 it.SetCurrentLocation(Location::Pair(Location::StackSlot(index_lo), | |
731 Location::StackSlot(index_hi))); | |
732 } else if (loc.IsInvalid()) { | |
733 Definition* def = | |
734 it.CurrentValue()->definition(); | |
735 ASSERT(def != NULL); | |
736 if (def->IsMaterializeObject()) { | |
737 def->AsMaterializeObject()->RemapRegisters(fpu_reg_slots, | |
738 cpu_reg_slots); | |
739 } | |
740 } | |
741 } | 694 } |
| 695 |
742 return env; | 696 return env; |
743 } | 697 } |
744 | 698 |
745 | 699 |
746 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, | 700 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, |
747 ICData::DeoptReasonId reason, | 701 ICData::DeoptReasonId reason, |
748 uint32_t flags) { | 702 uint32_t flags) { |
749 if (intrinsic_mode()) { | 703 if (intrinsic_mode()) { |
750 return &intrinsic_slow_path_label_; | 704 return &intrinsic_slow_path_label_; |
751 } | 705 } |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 case kUnboxedMint: | 1480 case kUnboxedMint: |
1527 return mint_class(); | 1481 return mint_class(); |
1528 default: | 1482 default: |
1529 UNREACHABLE(); | 1483 UNREACHABLE(); |
1530 return Class::ZoneHandle(); | 1484 return Class::ZoneHandle(); |
1531 } | 1485 } |
1532 } | 1486 } |
1533 | 1487 |
1534 | 1488 |
1535 } // namespace dart | 1489 } // namespace dart |
OLD | NEW |