Index: runtime/vm/flow_graph_allocator.cc |
diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc |
index e70a5b781eec4f1a248a02ceca48921dbac1fdbe..e3e0e4b188ae404d4dfa3fa3394ca4dc94bd5fe0 100644 |
--- a/runtime/vm/flow_graph_allocator.cc |
+++ b/runtime/vm/flow_graph_allocator.cc |
@@ -703,11 +703,19 @@ 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; |
+#if defined(TARGET_ARCH_DBC) |
+ intptr_t context_reg = flow_graph_.num_copied_params(); |
+ ASSERT(-flow_graph_.parsed_function().first_stack_local_index() - 1 == |
+ context_reg); |
+ if (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. |
+ context_reg++; |
+ } |
#else |
- const intptr_t context_reg = flow_graph_.num_copied_params(); |
-#endif |
+ const Register context_reg = CTX; |
+#endif // defined(TARGET_ARCH_DBC) |
AssignSafepoints(defn, range); |
range->finger()->Initialize(range); |
@@ -721,11 +729,15 @@ void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, |
} |
ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs); |
#if defined(TARGET_ARCH_DBC) |
- UNIMPLEMENTED(); |
-#endif |
+ const intptr_t slot_index = flow_graph_.num_copied_params(); |
+ ASSERT(-flow_graph_.parsed_function().first_stack_local_index() - 1 == |
+ slot_index); |
+ range->set_assigned_location(Location::RegisterLocation(slot_index)); |
+#else |
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)); |
+#endif // defined(TARGET_ARCH_DBC) |
} else { |
ConstantInstr* constant = defn->AsConstant(); |
ASSERT(constant != NULL); |