Index: pkg/compiler/lib/src/ssa/locals_handler.dart |
diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart |
index 6c3bb870d8e88a70c69e9b2b79279e12bae32148..3c3ad5dca5a5949d786aeb105f6d6c0d2de5d2f2 100644 |
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart |
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart |
@@ -178,21 +178,20 @@ class LocalsHandler { |
/// Replaces the current box with a new box and copies over the given list |
/// of elements from the old box into the new box. |
- void updateCaptureBox(LoopClosureScope loopInfo) { |
- Local boxElement = loopInfo.context; |
+ void updateCaptureBox(Local context, List<Local> toBeCopiedElements) { |
Siggi Cherem (dart-lang)
2017/06/30 22:02:10
nit: maybe rename context or update the comment to
Emily Fortuna
2017/06/30 23:48:10
Done.
|
// Create a new box and copy over the values from the old box into the |
// new one. |
- HInstruction oldBox = readLocal(boxElement); |
+ HInstruction oldBox = readLocal(context); |
HInstruction newBox = createBox(); |
- loopInfo.forEachBoxedVariable((Local boxedVariable, _) { |
- // [readLocal] uses the [boxElement] to find its box. By replacing it |
+ for (Local boxedVariable in toBeCopiedElements) { |
+ // [readLocal] uses the [context] to find its box. By replacing it |
// behind its back we can still get to the old values. |
- updateLocal(boxElement, oldBox); |
+ updateLocal(context, oldBox); |
HInstruction oldValue = readLocal(boxedVariable); |
- updateLocal(boxElement, newBox); |
+ updateLocal(context, newBox); |
updateLocal(boxedVariable, oldValue); |
- }); |
- updateLocal(boxElement, newBox); |
+ } |
+ updateLocal(context, newBox); |
} |
/// Documentation wanted -- johnniwinther |
@@ -478,7 +477,7 @@ class LocalsHandler { |
/// goto loop-entry; |
/// loop-exit: |
void startLoop(LoopClosureScope loopInfo) { |
- if (loopInfo.hasBoxedVariables) { |
+ if (loopInfo.hasBoxedLoopVariables) { |
// If there are boxed loop variables then we set up the box and |
// redirections already now. This way the initializer can write its |
// values into the box. |
@@ -513,7 +512,7 @@ class LocalsHandler { |
void enterLoopBody(LoopClosureScope loopInfo) { |
// If there are no declared boxed loop variables then we did not create the |
// box before the initializer and we have to create the box now. |
- if (!loopInfo.hasBoxedVariables) { |
+ if (!loopInfo.hasBoxedLoopVariables) { |
enterScope(loopInfo); |
} |
} |
@@ -524,8 +523,8 @@ class LocalsHandler { |
// updates. |
// In all other cases a new box will be created when entering the body of |
// the next iteration. |
- if (loopInfo.hasBoxedVariables) { |
- updateCaptureBox(loopInfo); |
+ if (loopInfo.hasBoxedLoopVariables) { |
+ updateCaptureBox(loopInfo.context, loopInfo.boxedLoopVariables); |
} |
} |