| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * The [LiveRange] class covers a range where an instruction is live. | 6 * The [LiveRange] class covers a range where an instruction is live. |
| 7 */ | 7 */ |
| 8 class LiveRange { | 8 class LiveRange { |
| 9 final int start; | 9 final int start; |
| 10 // [end] is not final because it can be updated due to loops. | 10 // [end] is not final because it can be updated due to loops. |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 void addCopy(HInstruction source, HInstruction destination) { | 328 void addCopy(HInstruction source, HInstruction destination) { |
| 329 copies.add(new Copy(source, destination)); | 329 copies.add(new Copy(source, destination)); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void addAssignment(HInstruction source, HInstruction destination) { | 332 void addAssignment(HInstruction source, HInstruction destination) { |
| 333 assignments.add(new Copy(source, destination)); | 333 assignments.add(new Copy(source, destination)); |
| 334 } | 334 } |
| 335 | 335 |
| 336 String toString() => 'Copies: $copies, assignments: $assignments'; | 336 String toString() => 'Copies: $copies, assignments: $assignments'; |
| 337 bool isEmpty() => copies.isEmpty() && assignments.isEmpty(); |
| 337 } | 338 } |
| 338 | 339 |
| 339 /** | 340 /** |
| 340 * Contains the mapping between instructions and their names for code | 341 * Contains the mapping between instructions and their names for code |
| 341 * generation, as well as the [CopyHandler] for each basic block. | 342 * generation, as well as the [CopyHandler] for each basic block. |
| 342 */ | 343 */ |
| 343 class VariableNames { | 344 class VariableNames { |
| 344 final Map<HInstruction, String> ownName; | 345 final Map<HInstruction, String> ownName; |
| 345 final Map<HBasicBlock, CopyHandler> copyHandlers; | 346 final Map<HBasicBlock, CopyHandler> copyHandlers; |
| 346 /** | 347 /** |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 if (!needsName(input)) { | 564 if (!needsName(input)) { |
| 564 names.addAssignment(predecessor, input, phi); | 565 names.addAssignment(predecessor, input, phi); |
| 565 } else { | 566 } else { |
| 566 names.addCopy(predecessor, input, phi); | 567 names.addCopy(predecessor, input, phi); |
| 567 } | 568 } |
| 568 } | 569 } |
| 569 | 570 |
| 570 namer.allocateName(phi); | 571 namer.allocateName(phi); |
| 571 } | 572 } |
| 572 } | 573 } |
| OLD | NEW |