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

Issue 3008923002: Improve the performance of closure-converted code. (Closed)

Created:
3 years, 3 months ago by sjindel
Modified:
3 years, 3 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org, Vyacheslav Egorov (Google), Kevin Millikin (Google)
Target Ref:
refs/heads/master
Visibility:
Public.

Description

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

Patch Set 1 #

Total comments: 2

Patch Set 2 : Additional bug fixes. #

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

Messages

Total messages: 8 (3 generated)
sjindel
3 years, 3 months ago (2017-08-30 16:18:56 UTC) #2
regis
The VM changes LGTM. Thanks
3 years, 3 months ago (2017-08-30 16:28:19 UTC) #4
Dmitry Stefantsov
This great optimization LGTM! :) The remark bellow is a small nitpick about phrasing in ...
3 years, 3 months ago (2017-09-01 12:42:30 UTC) #5
sjindel
https://codereview.chromium.org/3008923002/diff/1/pkg/kernel/lib/transformations/closure/rewriter.dart File pkg/kernel/lib/transformations/closure/rewriter.dart (right): https://codereview.chromium.org/3008923002/diff/1/pkg/kernel/lib/transformations/closure/rewriter.dart#newcode30 pkg/kernel/lib/transformations/closure/rewriter.dart:30: /// Inserts an expression that sets a parameter to ...
3 years, 3 months ago (2017-09-01 12:59:17 UTC) #6
sjindel
3 years, 3 months ago (2017-09-01 12:59:47 UTC) #8
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as
f0941f7c7d5c03fadf299c9f41962b98a8ed1db7 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698