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

Unified Diff: runtime/vm/kernel_binary_flowgraph.cc

Issue 3007623002: Fix many bugs with closure conversion in checked mode. (Closed)
Patch Set: 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
Index: runtime/vm/kernel_binary_flowgraph.cc
diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc
index 47aab5d4a98fc32765e6c9a1023ee8347df19dc7..e8271cfd07649863220409577dc9efc072ba050b 100644
--- a/runtime/vm/kernel_binary_flowgraph.cc
+++ b/runtime/vm/kernel_binary_flowgraph.cc
@@ -6407,8 +6407,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
@@ -6419,16 +6417,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;
}

Powered by Google App Engine
This is Rietveld 408576698