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 3a1ab0d1041be21a91dc85cccb162a8c4146fa63..171031af0f63541b8b1eddb1ca5c308e4b1a9aac 100644 |
| --- a/runtime/vm/flow_graph_allocator.cc |
| +++ b/runtime/vm/flow_graph_allocator.cc |
| @@ -704,16 +704,33 @@ void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, |
| } else if (defn->IsSpecialParameter()) { |
| SpecialParameterInstr* param = defn->AsSpecialParameter(); |
| - if (param->kind() == SpecialParameterInstr::kContext) { |
| -#if !defined(TARGET_ARCH_DBC) |
| - const Register context_reg = CTX; |
| + Location loc; |
| +#if defined(TARGET_ARCH_DBC) |
| + intptr_t slot_index = flow_graph_.num_copied_params(); |
| + ASSERT(-flow_graph_.parsed_function().first_stack_local_index() - 1 == |
| + slot_index); |
| + if ((param->kind() == SpecialParameterInstr::kContext) && |
| + (flow_graph_.parsed_function().function_type_arguments() != NULL)) { |
| + // The first slot is used for function type arguments, either as their |
| + // permanent location or as their temporary location when captured. |
| + // So use the next one for the context. |
| + slot_index++; |
|
regis
2017/08/14 23:29:19
If I remove this special handling on lines 712-718
Vyacheslav Egorov (Google)
2017/08/15 12:31:00
Actually if you change stuff here you need also to
regis
2017/08/15 22:01:53
That was it. Thanks!
Yes, we have very few tests f
|
| + } |
| + loc = Location::RegisterLocation(slot_index); |
| #else |
| - const intptr_t context_reg = flow_graph_.num_copied_params(); |
| -#endif |
| + if (param->kind() == SpecialParameterInstr::kContext) { |
| + loc = Location::RegisterLocation(CTX); |
| + } else { |
| + ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs); |
| + loc = Location::StackSlot(flow_graph_.num_copied_params(), FPREG); |
| + range->set_assigned_location(loc); |
| + range->set_spill_slot(loc); |
| + } |
| +#endif // defined(TARGET_ARCH_DBC) |
| + if (loc.IsRegister()) { |
| AssignSafepoints(defn, range); |
| - range->finger()->Initialize(range); |
| - range->set_assigned_location(Location::RegisterLocation(context_reg)); |
| + range->set_assigned_location(loc); |
| if (range->End() > kNormalEntryPos) { |
| LiveRange* tail = range->SplitAt(kNormalEntryPos); |
| CompleteRange(tail, Location::kRegister); |
| @@ -721,13 +738,6 @@ void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, |
| ConvertAllUses(range); |
| return; |
| } |
| - ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs); |
| -#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); |