Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: runtime/vm/flow_graph_allocator.cc

Issue 2987323003: [VM DBC compiler and simulator] Support reified generic functions. (Closed)
Patch Set: address review comments and sync Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/flow_graph_compiler_dbc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d49caddda3d69dead8942492129a7dc5fc127a2a 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -704,16 +704,32 @@ 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();
+ if ((param->kind() == SpecialParameterInstr::kContext) &&
+ FLAG_reify_generic_functions && flow_graph_.function().IsGeneric()) {
+ // 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.
+ // (see FlowGraphCompiler::EmitFrameEntry)
+ slot_index++;
+ }
+ 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 +737,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);
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/flow_graph_compiler_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698