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

Unified Diff: runtime/vm/kernel_to_il.cc

Issue 2941643002: Check for a passed-in type argument vector in the prolog of generic functions. (Closed)
Patch Set: Created 3 years, 6 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
Index: runtime/vm/kernel_to_il.cc
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
index 5b10f05fa41a64ffd304d0ef1c7eb76b1348fe06..54298f183ab4529fc96863eb74b1b30ce99be9e5 100644
--- a/runtime/vm/kernel_to_il.cc
+++ b/runtime/vm/kernel_to_il.cc
@@ -1797,13 +1797,14 @@ Fragment FlowGraphBuilder::InstanceCall(TokenPosition position,
}
-Fragment FlowGraphBuilder::ClosureCall(int argument_count,
+Fragment FlowGraphBuilder::ClosureCall(intptr_t type_args_len,
+ intptr_t argument_count,
const Array& argument_names) {
Value* function = Pop();
- ArgumentArray arguments = GetArguments(argument_count);
- const intptr_t kTypeArgsLen = 0; // Generic closures not yet supported.
+ const intptr_t total_count = argument_count + (type_args_len > 0 ? 1 : 0);
+ ArgumentArray arguments = GetArguments(total_count);
ClosureCallInstr* call = new (Z)
- ClosureCallInstr(function, arguments, kTypeArgsLen, argument_names,
+ ClosureCallInstr(function, arguments, type_args_len, argument_names,
TokenPosition::kNoSource, GetNextDeoptId());
Push(call);
return Fragment(call);
@@ -3460,6 +3461,13 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfInvokeFieldDispatcher(
LocalScope* scope = parsed_function_->node_sequence()->scope();
+ if (descriptor.TypeArgsLen() > 0) {
+ LocalVariable* type_args = parsed_function_->function_type_arguments();
+ ASSERT(type_args != NULL);
+ body += LoadLocal(type_args);
+ body += PushArgument();
+ }
+
LocalVariable* closure = NULL;
if (is_closure_call) {
closure = scope->VariableAt(0);
@@ -3488,8 +3496,12 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfInvokeFieldDispatcher(
body += LoadLocal(closure);
body += LoadField(Closure::function_offset());
- body += ClosureCall(descriptor.Count(), argument_names);
+ body += ClosureCall(descriptor.TypeArgsLen(), descriptor.Count(),
+ argument_names);
} else {
+ if (descriptor.TypeArgsLen() > 0) {
+ UNIMPLEMENTED();
+ }
body += InstanceCall(TokenPosition::kMinSource, Symbols::Call(),
Token::kILLEGAL, descriptor.Count(), argument_names);
}

Powered by Google App Engine
This is Rietveld 408576698