| 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..62f420add28d141d9d2fe432561241f7a71967d9 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 currentBox, List<Local> toBeCopiedElements) {
|
| // Create a new box and copy over the values from the old box into the
|
| // new one.
|
| - HInstruction oldBox = readLocal(boxElement);
|
| + HInstruction oldBox = readLocal(currentBox);
|
| 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 [currentBox] to find its box. By replacing it
|
| // behind its back we can still get to the old values.
|
| - updateLocal(boxElement, oldBox);
|
| + updateLocal(currentBox, oldBox);
|
| HInstruction oldValue = readLocal(boxedVariable);
|
| - updateLocal(boxElement, newBox);
|
| + updateLocal(currentBox, newBox);
|
| updateLocal(boxedVariable, oldValue);
|
| - });
|
| - updateLocal(boxElement, newBox);
|
| + }
|
| + updateLocal(currentBox, newBox);
|
| }
|
|
|
| /// Documentation wanted -- johnniwinther
|
| @@ -295,7 +294,7 @@ class LocalsHandler {
|
| bool isAccessedDirectly(Local local) {
|
| assert(local != null);
|
| return !redirectionMapping.containsKey(local) &&
|
| - !scopeInfo.variableIsUsedInTryOrSync(local);
|
| + !scopeInfo.localIsUsedInTryOrSync(local);
|
| }
|
|
|
| bool isStoredInClosureField(Local local) {
|
| @@ -314,7 +313,7 @@ class LocalsHandler {
|
| }
|
|
|
| bool _isUsedInTryOrGenerator(Local local) {
|
| - return scopeInfo.variableIsUsedInTryOrSync(local);
|
| + return scopeInfo.localIsUsedInTryOrSync(local);
|
| }
|
|
|
| /// Returns an [HInstruction] for the given element. If the element is
|
| @@ -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);
|
| }
|
| }
|
|
|
|
|