Chromium Code Reviews| Index: runtime/vm/flow_graph_allocator.cc |
| diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc |
| index 01e6d04fec6040ed389b05347d06031677612bd2..e4ca205545683dd56d5c0f18dee8dabed47c0148 100644 |
| --- a/runtime/vm/flow_graph_allocator.cc |
| +++ b/runtime/vm/flow_graph_allocator.cc |
| @@ -696,6 +696,7 @@ void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, |
| // Save the range end because it may change below. |
| intptr_t range_end = range->End(); |
| + bool is_type_args_param = false; |
| if (defn->IsParameter()) { |
| ParameterInstr* param = defn->AsParameter(); |
| // Assert that copied and non-copied parameters are mutually exclusive. |
| @@ -703,6 +704,7 @@ void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, |
| ASSERT((flow_graph_.num_copied_params() == 0) || |
| (flow_graph_.num_non_copied_params() == 0)); |
| intptr_t slot_index = param->index(); |
| + ASSERT(slot_index >= 0); // TODO(regis): Can we encounter a type args here? |
|
Vyacheslav Egorov (Google)
2017/07/03 16:15:43
I don't think we can encounter type args here.
regis
2017/07/05 18:41:29
Acknowledged.
|
| ASSERT((param->base_reg() == FPREG) || (param->base_reg() == SPREG)); |
| if (param->base_reg() == FPREG) { |
| // Slot index for the leftmost copied parameter is 0. |
| @@ -725,22 +727,33 @@ void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, |
| Location::StackSlot(slot_index, param->base_reg())); |
| range->set_spill_slot(Location::StackSlot(slot_index, param->base_reg())); |
| - } else if (defn->IsCurrentContext()) { |
| + } else if (defn->IsSpecialParameter()) { |
| + SpecialParameterInstr* param = defn->AsSpecialParameter(); |
| + if (param->kind() == SpecialParameterInstr::kContext) { |
| #if !defined(TARGET_ARCH_DBC) |
| - const Register context_reg = CTX; |
| + const Register context_reg = CTX; |
| #else |
| - const intptr_t context_reg = flow_graph_.num_copied_params(); |
| + const intptr_t context_reg = flow_graph_.num_copied_params(); |
| #endif |
| - AssignSafepoints(defn, range); |
| - range->finger()->Initialize(range); |
| - range->set_assigned_location(Location::RegisterLocation(context_reg)); |
| - if (range->End() > kNormalEntryPos) { |
| - LiveRange* tail = range->SplitAt(kNormalEntryPos); |
| - CompleteRange(tail, Location::kRegister); |
| + AssignSafepoints(defn, range); |
| + range->finger()->Initialize(range); |
| + range->set_assigned_location(Location::RegisterLocation(context_reg)); |
| + if (range->End() > kNormalEntryPos) { |
| + LiveRange* tail = range->SplitAt(kNormalEntryPos); |
| + CompleteRange(tail, Location::kRegister); |
| + } |
| + ConvertAllUses(range); |
| + return; |
| } |
| - ConvertAllUses(range); |
| - return; |
| + ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs); |
| + is_type_args_param = true; |
| +#if defined(TARGET_ARCH_DBC) |
| + UNIMPLEMENTED(); |
| +#endif |
| + const intptr_t slot_index = flow_graph_.num_copied_params(); |
| + range->set_assigned_location(Location::StackSlot(slot_index, FPREG)); |
| + range->set_spill_slot(Location::StackSlot(slot_index, FPREG)); |
| } else { |
| ConstantInstr* constant = defn->AsConstant(); |
| ASSERT(constant != NULL); |
| @@ -757,7 +770,8 @@ void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, |
| CompleteRange(tail, Location::kRegister); |
| } |
| ConvertAllUses(range); |
| - if (defn->IsParameter() && (range->spill_slot().stack_index() >= 0)) { |
| + if ((defn->IsParameter() || is_type_args_param) && |
| + (range->spill_slot().stack_index() >= 0)) { |
| // Parameters above the frame pointer consume spill slots and are marked |
| // in stack maps. |
| spill_slots_.Add(range_end); |