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

Issue 1412663006: Fix handling of boxed loop variable in CPS IR (Closed)

Created:
5 years, 2 months ago by Siggi Cherem (dart-lang)
Modified:
5 years, 2 months ago
Reviewers:
asgerf, Johnni Winther
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Fix handling of boxed loop variable in CPS IR

Patch Set 1 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart View 1 chunk +1 line, -0 lines 2 comments Download
M tests/language/language_dart2js.status View 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 5 (2 generated)
Siggi Cherem (dart-lang)
https://codereview.chromium.org/1412663006/diff/20001/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart File pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart (right): https://codereview.chromium.org/1412663006/diff/20001/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart#newcode2538 pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart:2538: if (location == null) continue; I'm not certain that ...
5 years, 2 months ago (2015-10-23 01:39:58 UTC) #3
asgerf
https://codereview.chromium.org/1412663006/diff/20001/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart File pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart (right): https://codereview.chromium.org/1412663006/diff/20001/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart#newcode2538 pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart:2538: if (location == null) continue; On 2015/10/23 01:39:58, Siggi ...
5 years, 2 months ago (2015-10-23 09:37:30 UTC) #4
Siggi Cherem (dart-lang)
5 years, 2 months ago (2015-10-23 15:15:38 UTC) #5
On 2015/10/23 09:37:30, asgerf wrote:
>
https://codereview.chromium.org/1412663006/diff/20001/pkg/compiler/lib/src/cp...
> File pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart (right):
> 
>
https://codereview.chromium.org/1412663006/diff/20001/pkg/compiler/lib/src/cp...
> pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart:2538: if (location == null)
> continue;
> On 2015/10/23 01:39:58, Siggi Cherem (dart-lang) wrote:
> > I'm not certain that this is the right fix. What I'm seeing is that
> > boxedLoopVariables are also in capturedVariables if they are updated outside
> of
> > the loop-update section. In that case, we don't include it in the
> > capturedVariables map.
> > 
> > The example from the test where this happens looks like this:
> >     main() {
> >       var f;
> >       for (int n = 0; n < 10; n++) {
> >         int k = n;
> >         f = () => 'k $k n $n';
> >         k++;
> >       }
> >       print(f());
> >     }
> > 
> > `n` is in boxedLoopedVariables, but only `k` is in capturedVariables.
> > 
> > Rather than skipping it here, should this be handled differently by the
> > ClosureScope in `closure.dart`?
> 
> 'n' is captured but not boxed, so it's absurd that it should be in
> boxedLoopVariables and not capturedVariables.
> 
> I've proposed a fix in closure.dart here:
> https://codereview.chromium.org/1409933004/

Much better! Thanks for taking a look, that makes much more sense.

Powered by Google App Engine
This is Rietveld 408576698