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

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: address review comments 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
« no previous file with comments | « runtime/vm/kernel_to_il.h ('k') | runtime/vm/native_arguments.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_to_il.cc
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
index f9f4e351199ec32af0e7bd1cf192853ce4f1f337..e4533735a159e2265ba6b7af62590101efdcdf14 100644
--- a/runtime/vm/kernel_to_il.cc
+++ b/runtime/vm/kernel_to_il.cc
@@ -1177,13 +1177,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);
@@ -2309,6 +2310,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);
@@ -2337,8 +2345,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);
}
« no previous file with comments | « runtime/vm/kernel_to_il.h ('k') | runtime/vm/native_arguments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698