OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.cps_ir.mutable_ssa; | 5 library dart2js.cps_ir.mutable_ssa; |
6 | 6 |
7 import 'cps_ir_nodes.dart'; | 7 import 'cps_ir_nodes.dart'; |
8 import 'optimizers.dart'; | 8 import 'optimizers.dart'; |
9 | 9 |
10 /// Determines which mutable variables should be rewritten to phi assignments | 10 /// Determines which mutable variables should be rewritten to phi assignments |
11 /// in this pass. | 11 /// in this pass. |
12 /// | 12 /// |
13 /// We do not rewrite variables that have an assignment inside a try block that | 13 /// We do not rewrite variables that have an assignment inside a try block that |
14 /// does not contain its declaration. | 14 /// does not contain its declaration. |
15 class MutableVariablePreanalysis extends TrampolineRecursiveVisitor { | 15 class MutableVariablePreanalysis extends RecursiveVisitor { |
16 // Number of try blocks enclosing the current position. | 16 // Number of try blocks enclosing the current position. |
17 int currentDepth = 0; | 17 int currentDepth = 0; |
18 | 18 |
19 /// Number of try blocks enclosing the declaration of a given mutable | 19 /// Number of try blocks enclosing the declaration of a given mutable |
20 /// variable. | 20 /// variable. |
21 /// | 21 /// |
22 /// All mutable variables seen will be present in the map after the analysis. | 22 /// All mutable variables seen will be present in the map after the analysis. |
23 Map<MutableVariable, int> variableDepth = <MutableVariable, int>{}; | 23 Map<MutableVariable, int> variableDepth = <MutableVariable, int>{}; |
24 | 24 |
25 /// Variables with an assignment inside a try block that does not contain | 25 /// Variables with an assignment inside a try block that does not contain |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 class VariableItem extends StackItem {} | 242 class VariableItem extends StackItem {} |
243 | 243 |
244 /// Represents a yet unprocessed continuation together with the | 244 /// Represents a yet unprocessed continuation together with the |
245 /// environment in which to process it. | 245 /// environment in which to process it. |
246 class ContinuationItem extends StackItem { | 246 class ContinuationItem extends StackItem { |
247 final Continuation continuation; | 247 final Continuation continuation; |
248 final Map<MutableVariable, Primitive> environment; | 248 final Map<MutableVariable, Primitive> environment; |
249 | 249 |
250 ContinuationItem(this.continuation, this.environment); | 250 ContinuationItem(this.continuation, this.environment); |
251 } | 251 } |
OLD | NEW |