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

Unified Diff: runtime/vm/flow_graph_compiler_dbc.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/flow_graph_allocator.cc ('k') | runtime/vm/intermediate_language_dbc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_dbc.cc
diff --git a/runtime/vm/flow_graph_compiler_dbc.cc b/runtime/vm/flow_graph_compiler_dbc.cc
index 06114b23b921b91dfffa90f1522e8b4ec8c13dd0..c65b6c91cf8528c67694b03354de7020bf0d38b0 100644
--- a/runtime/vm/flow_graph_compiler_dbc.cc
+++ b/runtime/vm/flow_graph_compiler_dbc.cc
@@ -381,14 +381,22 @@ void FlowGraphCompiler::EmitFrameEntry() {
}
}
+ const bool has_type_arguments =
+ FLAG_reify_generic_functions && function.IsGeneric();
if (function.IsClosureFunction()) {
// In optimized mode the register allocator expects CurrentContext in the
- // flow_graph_.num_copied_params() register at function entry.
+ // flow_graph_.num_copied_params() register at function entry, unless that
+ // register is used for function type arguments, either as their
+ // permanent location or as their temporary location when captured.
+ // In that case, the next register holds CurrentContext.
// (see FlowGraphAllocator::ProcessInitialDefinition)
Register context_reg =
- is_optimizing() ? flow_graph_.num_copied_params() : context_index;
+ is_optimizing()
+ ? (has_type_arguments ? flow_graph_.num_copied_params() + 1
+ : flow_graph_.num_copied_params())
+ : context_index;
LocalScope* scope = parsed_function().node_sequence()->scope();
- LocalVariable* local = scope->VariableAt(0);
+ LocalVariable* local = scope->VariableAt(0); // Closure instance receiver.
Register closure_reg;
if (local->index() > 0) {
@@ -404,11 +412,15 @@ void FlowGraphCompiler::EmitFrameEntry() {
}
// Check for a passed type argument vector if the function is generic.
- if (FLAG_reify_generic_functions && function.IsGeneric() &&
- !flow_graph().IsCompiledForOsr()) {
- __ Comment("Check passed-in type args");
- UNIMPLEMENTED(); // TODO(regis): Not yet supported.
+ if (has_type_arguments && !flow_graph().IsCompiledForOsr()) {
+ ASSERT(-parsed_function().first_stack_local_index() - 1 ==
+ flow_graph_.num_copied_params());
+ __ CheckFunctionTypeArgs(function.NumTypeParameters(),
+ flow_graph_.num_copied_params());
}
+
+ // TODO(regis): Verify that no vector is passed if not generic, unless already
+ // checked during resolution.
}
void FlowGraphCompiler::CompileGraph() {
« no previous file with comments | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/intermediate_language_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698