| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library tree_ir_builder; | 5 library tree_ir_builder; |
| 6 | 6 |
| 7 import '../dart2jslib.dart' as dart2js; | 7 import '../dart2jslib.dart' as dart2js; |
| 8 import '../dart_types.dart'; | 8 import '../dart_types.dart'; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; | 10 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 Builder createInnerBuilder() { | 76 Builder createInnerBuilder() { |
| 77 return new Builder(internalError, this); | 77 return new Builder(internalError, this); |
| 78 } | 78 } |
| 79 | 79 |
| 80 /// Variable used in [buildPhiAssignments] as a temporary when swapping | 80 /// Variable used in [buildPhiAssignments] as a temporary when swapping |
| 81 /// variables. | 81 /// variables. |
| 82 Variable phiTempVar; | 82 Variable phiTempVar; |
| 83 | 83 |
| 84 Variable addMutableVariable(cps_ir.MutableVariable irVariable) { | 84 Variable addMutableVariable(cps_ir.MutableVariable irVariable) { |
| 85 assert(irVariable.host == currentElement); | |
| 86 assert(!mutable2variable.containsKey(irVariable)); | 85 assert(!mutable2variable.containsKey(irVariable)); |
| 87 Variable variable = new Variable(currentElement, irVariable.hint); | 86 Variable variable = new Variable(currentElement, irVariable.hint); |
| 88 mutable2variable[irVariable] = variable; | 87 mutable2variable[irVariable] = variable; |
| 89 return variable; | 88 return variable; |
| 90 } | 89 } |
| 91 | 90 |
| 92 Variable getMutableVariable(cps_ir.MutableVariable mutableVariable) { | 91 Variable getMutableVariable(cps_ir.MutableVariable mutableVariable) { |
| 93 if (mutableVariable.host != currentElement) { | 92 if (!mutable2variable.containsKey(mutableVariable)) { |
| 94 return parent.getMutableVariable(mutableVariable)..isCaptured = true; | 93 return parent.getMutableVariable(mutableVariable)..isCaptured = true; |
| 95 } | 94 } |
| 96 return mutable2variable[mutableVariable]; | 95 return mutable2variable[mutableVariable]; |
| 97 } | 96 } |
| 98 | 97 |
| 99 VariableUse getMutableVariableUse( | 98 VariableUse getMutableVariableUse( |
| 100 cps_ir.Reference<cps_ir.MutableVariable> reference) { | 99 cps_ir.Reference<cps_ir.MutableVariable> reference) { |
| 101 Variable variable = getMutableVariable(reference.definition); | 100 Variable variable = getMutableVariable(reference.definition); |
| 102 return new VariableUse(variable); | 101 return new VariableUse(variable); |
| 103 } | 102 } |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 | 675 |
| 677 Statement visitSetStatic(cps_ir.SetStatic node) { | 676 Statement visitSetStatic(cps_ir.SetStatic node) { |
| 678 SetStatic setStatic = new SetStatic( | 677 SetStatic setStatic = new SetStatic( |
| 679 node.element, | 678 node.element, |
| 680 getVariableUse(node.value), | 679 getVariableUse(node.value), |
| 681 node.sourceInformation); | 680 node.sourceInformation); |
| 682 return new ExpressionStatement(setStatic, visit(node.body)); | 681 return new ExpressionStatement(setStatic, visit(node.body)); |
| 683 } | 682 } |
| 684 } | 683 } |
| 685 | 684 |
| OLD | NEW |