Chromium Code Reviews| 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,14 @@ |
| return lookup; |
| } else { |
| assert(isUsedInTry(element)); |
| - HInstruction variable = new HFieldGet.fromActivation(element.name); |
| + HParameterValue parameter = builder.activationVariables.putIfAbsent( |
|
kasperl
2012/05/25 10:05:15
This code should be refactored. There's a lot of d
ngeoffray
2012/05/25 10:45:10
Done.
|
| + element, () { |
| + HParameterValue parameter = new HParameterValue(element); |
| + builder.add(parameter); |
| + return parameter; |
| + } |
| + ); |
| + HInstruction variable = new HFieldGet.fromActivation(parameter); |
| builder.add(variable); |
| return variable; |
| } |
| @@ -461,7 +468,14 @@ |
| builder.add(new HFieldSet(redirect.name, box, value)); |
| } else { |
| assert(isUsedInTry(element)); |
| - builder.add(new HFieldSet.fromActivation(element.name, value)); |
| + HParameterValue parameter = builder.activationVariables.putIfAbsent( |
| + element, () { |
| + HParameterValue parameter = new HParameterValue(element); |
| + builder.add(parameter); |
| + return parameter; |
| + } |
| + ); |
| + builder.add(new HFieldSet.fromActivation(parameter, value)); |
| } |
| } |
| @@ -779,6 +793,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 +823,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); |
| } |