| Index: lib/compiler/implementation/ssa/builder.dart
|
| ===================================================================
|
| --- lib/compiler/implementation/ssa/builder.dart (revision 7983)
|
| +++ lib/compiler/implementation/ssa/builder.dart (working copy)
|
| @@ -412,7 +412,8 @@
|
| return lookup;
|
| } else {
|
| assert(isUsedInTry(element));
|
| - HInstruction variable = new HFieldGet.fromActivation(element.name);
|
| + HParameterValue parameter = getActivationParameter(element);
|
| + HInstruction variable = new HFieldGet.fromActivation(parameter);
|
| builder.add(variable);
|
| return variable;
|
| }
|
| @@ -435,6 +436,16 @@
|
| return res;
|
| }
|
|
|
| + HParameterValue getActivationParameter(Element element) {
|
| + if (element.isParameter()) return directLocals[element];
|
| +
|
| + return builder.activationVariables.putIfAbsent(element, () {
|
| + HParameterValue parameter = new HParameterValue(element);
|
| + builder.add(parameter);
|
| + return parameter;
|
| + });
|
| + }
|
| +
|
| /**
|
| * Sets the [element] to [value]. If the element is boxed or stored in a
|
| * closure then the method generates code to set the value.
|
| @@ -461,7 +472,8 @@
|
| builder.add(new HFieldSet(redirect.name, box, value));
|
| } else {
|
| assert(isUsedInTry(element));
|
| - builder.add(new HFieldSet.fromActivation(element.name, value));
|
| + HParameterValue parameter = getActivationParameter(element);
|
| + builder.add(new HFieldSet.fromActivation(parameter, value));
|
| }
|
| }
|
|
|
| @@ -779,6 +791,13 @@
|
|
|
| Map<TargetElement, JumpHandler> jumpTargets;
|
|
|
| + /**
|
| + * Variables stored in the current activation. These variables are
|
| + * being updated in try/catch blocks, and should be
|
| + * accessed indirectly through HFieldGet and HFieldSet.
|
| + */
|
| + Map<Element, HParameterValue> activationVariables;
|
| +
|
| // We build the Ssa graph by simulating a stack machine.
|
| List<HInstruction> stack;
|
|
|
| @@ -802,6 +821,7 @@
|
| elements = work.resolutionTree,
|
| graph = new HGraph(),
|
| stack = new List<HInstruction>(),
|
| + activationVariables = new Map<Element, HParameterValue>(),
|
| jumpTargets = new Map<TargetElement, JumpHandler>() {
|
| localsHandler = new LocalsHandler(this);
|
| }
|
|
|