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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 cpu_reg_slots[i] = next_slot++; | 678 cpu_reg_slots[i] = next_slot++; |
679 } else { | 679 } else { |
680 cpu_reg_slots[i] = -1; | 680 cpu_reg_slots[i] = -1; |
681 } | 681 } |
682 } | 682 } |
683 | 683 |
684 // 2. Iterate the environment and replace register locations with the | 684 // 2. Iterate the environment and replace register locations with the |
685 // corresponding spill slot locations. | 685 // corresponding spill slot locations. |
686 for (Environment::DeepIterator it(env); !it.Done(); it.Advance()) { | 686 for (Environment::DeepIterator it(env); !it.Done(); it.Advance()) { |
687 Location loc = it.CurrentLocation(); | 687 Location loc = it.CurrentLocation(); |
688 if (loc.IsRegister()) { | 688 Value* value = it.CurrentValue(); |
689 intptr_t index = cpu_reg_slots[loc.reg()]; | 689 it.SetCurrentLocation(loc.RemapForSlowPath( |
690 ASSERT(index >= 0); | 690 value->definition(), cpu_reg_slots, fpu_reg_slots)); |
691 it.SetCurrentLocation(Location::StackSlot(index)); | |
692 } else if (loc.IsFpuRegister()) { | |
693 intptr_t index = fpu_reg_slots[loc.fpu_reg()]; | |
694 ASSERT(index >= 0); | |
695 Value* value = it.CurrentValue(); | |
696 switch (value->definition()->representation()) { | |
697 case kUnboxedDouble: | |
698 it.SetCurrentLocation(Location::DoubleStackSlot(index)); | |
699 break; | |
700 case kUnboxedFloat32x4: | |
701 case kUnboxedInt32x4: | |
702 case kUnboxedFloat64x2: | |
703 it.SetCurrentLocation(Location::QuadStackSlot(index)); | |
704 break; | |
705 default: | |
706 UNREACHABLE(); | |
707 } | |
708 } else if (loc.IsPairLocation()) { | |
709 intptr_t representation = | |
710 it.CurrentValue()->definition()->representation(); | |
711 ASSERT(representation == kUnboxedMint); | |
712 PairLocation* value_pair = loc.AsPairLocation(); | |
713 intptr_t index_lo; | |
714 intptr_t index_hi; | |
715 if (value_pair->At(0).IsRegister()) { | |
716 index_lo = cpu_reg_slots[value_pair->At(0).reg()]; | |
717 } else { | |
718 ASSERT(value_pair->At(0).IsStackSlot()); | |
719 index_lo = value_pair->At(0).stack_index(); | |
720 } | |
721 if (value_pair->At(1).IsRegister()) { | |
722 index_hi = cpu_reg_slots[value_pair->At(1).reg()]; | |
723 } else { | |
724 ASSERT(value_pair->At(1).IsStackSlot()); | |
725 index_hi = value_pair->At(1).stack_index(); | |
726 } | |
727 it.SetCurrentLocation(Location::Pair(Location::StackSlot(index_lo), | |
728 Location::StackSlot(index_hi))); | |
729 } else if (loc.IsInvalid()) { | |
730 Definition* def = | |
731 it.CurrentValue()->definition(); | |
732 ASSERT(def != NULL); | |
733 if (def->IsMaterializeObject()) { | |
734 def->AsMaterializeObject()->RemapRegisters(fpu_reg_slots, | |
735 cpu_reg_slots); | |
736 } | |
737 } | |
738 } | 691 } |
| 692 |
739 return env; | 693 return env; |
740 } | 694 } |
741 | 695 |
742 | 696 |
743 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, | 697 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, |
744 ICData::DeoptReasonId reason, | 698 ICData::DeoptReasonId reason, |
745 uint32_t flags) { | 699 uint32_t flags) { |
746 if (intrinsic_mode()) { | 700 if (intrinsic_mode()) { |
747 return &intrinsic_slow_path_label_; | 701 return &intrinsic_slow_path_label_; |
748 } | 702 } |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 case kUnboxedMint: | 1464 case kUnboxedMint: |
1511 return mint_class(); | 1465 return mint_class(); |
1512 default: | 1466 default: |
1513 UNREACHABLE(); | 1467 UNREACHABLE(); |
1514 return Class::ZoneHandle(); | 1468 return Class::ZoneHandle(); |
1515 } | 1469 } |
1516 } | 1470 } |
1517 | 1471 |
1518 | 1472 |
1519 } // namespace dart | 1473 } // namespace dart |
OLD | NEW |