| 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 #if !defined(DART_PRECOMPILED_RUNTIME) | 5 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 6 | 6 |
| 7 #include "vm/flow_graph_allocator.h" | 7 #include "vm/flow_graph_allocator.h" |
| 8 | 8 |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 ConvertAllUses(range); | 697 ConvertAllUses(range); |
| 698 return; | 698 return; |
| 699 } | 699 } |
| 700 #endif // defined(TARGET_ARCH_DBC) | 700 #endif // defined(TARGET_ARCH_DBC) |
| 701 range->set_assigned_location( | 701 range->set_assigned_location( |
| 702 Location::StackSlot(slot_index, param->base_reg())); | 702 Location::StackSlot(slot_index, param->base_reg())); |
| 703 range->set_spill_slot(Location::StackSlot(slot_index, param->base_reg())); | 703 range->set_spill_slot(Location::StackSlot(slot_index, param->base_reg())); |
| 704 | 704 |
| 705 } else if (defn->IsSpecialParameter()) { | 705 } else if (defn->IsSpecialParameter()) { |
| 706 SpecialParameterInstr* param = defn->AsSpecialParameter(); | 706 SpecialParameterInstr* param = defn->AsSpecialParameter(); |
| 707 Location loc; |
| 708 #if defined(TARGET_ARCH_DBC) |
| 709 intptr_t slot_index = flow_graph_.num_copied_params(); |
| 710 if ((param->kind() == SpecialParameterInstr::kContext) && |
| 711 (flow_graph_.parsed_function().function_type_arguments() != NULL)) { |
| 712 // The first slot is used for function type arguments, either as their |
| 713 // permanent location or as their temporary location when captured. |
| 714 // So use the next one for the context. |
| 715 // (see FlowGraphCompiler::EmitFrameEntry) |
| 716 slot_index++; |
| 717 } |
| 718 loc = Location::RegisterLocation(slot_index); |
| 719 #else |
| 707 if (param->kind() == SpecialParameterInstr::kContext) { | 720 if (param->kind() == SpecialParameterInstr::kContext) { |
| 708 #if !defined(TARGET_ARCH_DBC) | 721 loc = Location::RegisterLocation(CTX); |
| 709 const Register context_reg = CTX; | 722 } else { |
| 710 #else | 723 ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs); |
| 711 const intptr_t context_reg = flow_graph_.num_copied_params(); | 724 loc = Location::StackSlot(flow_graph_.num_copied_params(), FPREG); |
| 712 #endif | 725 range->set_assigned_location(loc); |
| 726 range->set_spill_slot(loc); |
| 727 } |
| 728 #endif // defined(TARGET_ARCH_DBC) |
| 713 | 729 |
| 730 if (loc.IsRegister()) { |
| 714 AssignSafepoints(defn, range); | 731 AssignSafepoints(defn, range); |
| 715 range->finger()->Initialize(range); | 732 range->set_assigned_location(loc); |
| 716 range->set_assigned_location(Location::RegisterLocation(context_reg)); | |
| 717 if (range->End() > kNormalEntryPos) { | 733 if (range->End() > kNormalEntryPos) { |
| 718 LiveRange* tail = range->SplitAt(kNormalEntryPos); | 734 LiveRange* tail = range->SplitAt(kNormalEntryPos); |
| 719 CompleteRange(tail, Location::kRegister); | 735 CompleteRange(tail, Location::kRegister); |
| 720 } | 736 } |
| 721 ConvertAllUses(range); | 737 ConvertAllUses(range); |
| 722 return; | 738 return; |
| 723 } | 739 } |
| 724 ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs); | |
| 725 #if defined(TARGET_ARCH_DBC) | |
| 726 UNIMPLEMENTED(); | |
| 727 #endif | |
| 728 const intptr_t slot_index = flow_graph_.num_copied_params(); | |
| 729 range->set_assigned_location(Location::StackSlot(slot_index, FPREG)); | |
| 730 range->set_spill_slot(Location::StackSlot(slot_index, FPREG)); | |
| 731 } else { | 740 } else { |
| 732 ConstantInstr* constant = defn->AsConstant(); | 741 ConstantInstr* constant = defn->AsConstant(); |
| 733 ASSERT(constant != NULL); | 742 ASSERT(constant != NULL); |
| 734 range->set_assigned_location(Location::Constant(constant)); | 743 range->set_assigned_location(Location::Constant(constant)); |
| 735 range->set_spill_slot(Location::Constant(constant)); | 744 range->set_spill_slot(Location::Constant(constant)); |
| 736 } | 745 } |
| 737 AssignSafepoints(defn, range); | 746 AssignSafepoints(defn, range); |
| 738 range->finger()->Initialize(range); | 747 range->finger()->Initialize(range); |
| 739 UsePosition* use = | 748 UsePosition* use = |
| 740 range->finger()->FirstRegisterBeneficialUse(block->start_pos()); | 749 range->finger()->FirstRegisterBeneficialUse(block->start_pos()); |
| (...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3013 printer.PrintBlocks(); | 3022 printer.PrintBlocks(); |
| 3014 #endif | 3023 #endif |
| 3015 } | 3024 } |
| 3016 THR_Print("----------------------------------------------\n"); | 3025 THR_Print("----------------------------------------------\n"); |
| 3017 } | 3026 } |
| 3018 } | 3027 } |
| 3019 | 3028 |
| 3020 } // namespace dart | 3029 } // namespace dart |
| 3021 | 3030 |
| 3022 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 3031 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |