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

Unified Diff: runtime/vm/kernel_binary_flowgraph.cc

Issue 3007623002: Fix many bugs with closure conversion in checked mode. (Closed)
Patch Set: Review comments 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 | « pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart.expect ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_binary_flowgraph.cc
diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc
index f0b3984379d0af31e41406d3a79417f2e47e7d8b..a9fdd607e3cc2a1342e8c6c7b78004001c729985 100644
--- a/runtime/vm/kernel_binary_flowgraph.cc
+++ b/runtime/vm/kernel_binary_flowgraph.cc
@@ -6409,8 +6409,6 @@ Fragment StreamingFlowGraphBuilder::BuildClosureCreation(
instructions +=
StoreInstanceField(TokenPosition::kNoSource, Closure::context_offset());
- instructions += Drop();
-
SkipDartType(); // skip function type of the closure.
// TODO(30455): Kernel generic methods undone. When generic methods are
@@ -6421,16 +6419,25 @@ Fragment StreamingFlowGraphBuilder::BuildClosureCreation(
intptr_t types_count = ReadListLength(); // read type count.
if (types_count > 0) {
- instructions += LoadLocal(context);
-
const TypeArguments& type_args =
T.BuildTypeArguments(types_count); // read list of type arguments.
instructions += TranslateInstantiatedTypeArguments(type_args);
+ LocalVariable* type_args_slot = MakeTemporary();
+ instructions += LoadLocal(context);
+ instructions += LoadLocal(type_args_slot);
instructions += StoreInstanceField(TokenPosition::kNoSource,
Context::variable_offset(0));
+
+ instructions += LoadLocal(closure);
+ instructions += LoadLocal(type_args_slot);
+ instructions += StoreInstanceField(
+ TokenPosition::kNoSource, Closure::function_type_arguments_offset());
+
+ instructions += Drop(); // type args
}
+ instructions += Drop(); // context
return instructions;
}
« no previous file with comments | « pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart.expect ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698