|
Improve the performance of closure-converted code.
Summary:
Previously, we would create a wrapper function in the flowgraph around converted
closures, which would forward all the closure's arguments and unpack the context
argument before calling the real closure function.
Now, we perform the unpacking at the top of the real function to avoid having
any wrapper function.
Previously, captured parameters would still be appear live to the GC even if
they're updated, because after they are copied into the context, all updates to
them are done there.
Now, as in regular closures, we zero-out the parameter variable after copying
it's value into the context, avoiding potential memory leaks.
Test Plan:
Ran the closure conversion test suite.
Ran benchmarks on Golem -- all statistically significant regressions are gone.
BUG=
R=dmitryas@google.com, regis@google.com
Committed: https://github.com/dart-lang/sdk/commit/f0941f7c7d5c03fadf299c9f41962b98a8ed1db7
Total comments: 2
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+76 lines, -118 lines) |
Patch |
|
M |
pkg/kernel/lib/transformations/closure/context.dart
|
View
|
|
2 chunks |
+4 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/transformations/closure/rewriter.dart
|
View
|
|
3 chunks |
+17 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/blocks.dart.expect
|
View
|
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/capture_closure_parameter.dart.expect
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closure_in_constructor.dart.expect
|
View
|
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closure_in_initializer.dart.expect
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closure_in_initializer_closure.dart.expect
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closures.dart.expect
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/contexts_in_field_initializers.dart.expect
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/loop2.dart.expect
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/named_closure.dart.expect
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/syncstar.dart.expect
|
View
|
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
runtime/observatory/lib/src/elements/function_view.dart
|
View
|
1
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
runtime/observatory/lib/src/models/objects/function.dart
|
View
|
1
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
runtime/observatory/lib/src/service/object.dart
|
View
|
1
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
runtime/vm/kernel_binary_flowgraph.h
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/kernel_binary_flowgraph.cc
|
View
|
|
3 chunks |
+25 lines, -104 lines |
0 comments
|
Download
|
|
M |
runtime/vm/object.cc
|
View
|
1
|
7 chunks |
+10 lines, -9 lines |
0 comments
|
Download
|
Total messages: 8 (3 generated)
|