Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/loop_effects.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/loop_effects.dart b/pkg/compiler/lib/src/cps_ir/loop_effects.dart |
| index 9dd39ff78518b5cfe9fc6e2d725f2c49fe7695f2..8552786e241d21f8b61b3ae4d9da5799ab7b3234 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/loop_effects.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/loop_effects.dart |
| @@ -46,9 +46,7 @@ class LoopSideEffects extends TrampolineRecursiveVisitor { |
| Expression traverseContinuation(Continuation cont) { |
| if (cont.isRecursive) { |
| SideEffects oldEffects = currentLoopSideEffects; |
| - Continuation oldLoopHeader = currentLoopHeader; |
| bool oldChangesLength = currentLoopChangesLength; |
| - currentLoopHeader = cont; |
| loopSideEffects[cont] = currentLoopSideEffects = new SideEffects.empty(); |
| exitContinuations[cont] = <Continuation>[]; |
| pushAction(() { |
| @@ -57,11 +55,15 @@ class LoopSideEffects extends TrampolineRecursiveVisitor { |
| loopsChangingLength.add(cont); |
| } |
| currentLoopChangesLength = currentLoopChangesLength || oldChangesLength; |
| - currentLoopHeader = oldLoopHeader; |
| currentLoopSideEffects = oldEffects; |
| exitContinuations[cont].forEach(push); |
| }); |
| } |
| + Continuation oldLoopHeader = currentLoopHeader; |
| + currentLoopHeader = loopHierarchy.getLoopHeader(cont); |
| + pushAction(() { |
| + currentLoopHeader = oldLoopHeader; |
| + }); |
| return cont.body; |
| } |
| @@ -87,6 +89,12 @@ class LoopSideEffects extends TrampolineRecursiveVisitor { |
| Continuation inner = currentLoopHeader; |
| Continuation outer = loopHierarchy.getEnclosingLoop(currentLoopHeader); |
| while (outer != loop) { |
| + if (inner == null) { |
| + // The shrinking reductions pass must run before any pass that relies |
| + // on computing loop side effects. |
| + throw 'Unreachable continuations must be removed before computing ' |
| + 'loop side effects.'; |
|
asgerf
2015/11/16 15:42:39
This is similar to the problem of putting unreacha
sra1
2015/11/17 05:41:14
Use the proper internal error (possibly as separat
asgerf
2015/11/17 12:43:43
Done.
|
| + } |
| inner = outer; |
| outer = loopHierarchy.getEnclosingLoop(outer); |
| } |
| @@ -171,6 +179,7 @@ class LoopSideEffects extends TrampolineRecursiveVisitor { |
| } |
| void visitApplyBuiltinMethod(ApplyBuiltinMethod node) { |
| + currentLoopSideEffects.setChangesIndex(); |
| currentLoopChangesLength = true; // Push and pop. |
| } |
| } |