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

Unified Diff: runtime/vm/kernel_binary_flowgraph.cc

Issue 3000333002: Fix several bugs in closure conversion. (Closed)
Patch Set: Fix bugs. 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 eb976d501057907c862ded382cf5c70f9c8cdba2..164b5eae3f4851a851a4192f27daeb1b5183acef 100644
--- a/runtime/vm/kernel_binary_flowgraph.cc
+++ b/runtime/vm/kernel_binary_flowgraph.cc
@@ -3464,8 +3464,13 @@ FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfConvertedClosureFunction(
// closures its context field contains the context vector that is used by the
// converted top-level function (target) explicitly and that should be passed
// to that function as the first parameter.
- body += LoadLocal(LookupVariable(
- ReaderOffset() + relative_kernel_offset_)); // 0th variable offset.
+ LocalVariable* var = LookupVariable(ReaderOffset() + relative_kernel_offset_);
+ LocalVariable* parameter =
+ new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+ Symbols::TempParam(), var->type());
+ parameter->set_index(parsed_function()->first_parameter_index());
+ if (var->is_captured()) parameter->set_is_captured_parameter(true);
+ body += LoadLocal(parameter); // 0th variable offset.
body += flow_graph_builder_->LoadField(Closure::context_offset());
LocalVariable* context = MakeTemporary();
« pkg/kernel/testcases/closures/syncstar.dart ('K') | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698