| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The [LiveRange] class covers a range where an instruction is live. | 8 * The [LiveRange] class covers a range where an instruction is live. |
| 9 */ | 9 */ |
| 10 class LiveRange { | 10 class LiveRange { |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 namer.allocateName(instruction); | 675 namer.allocateName(instruction); |
| 676 } | 676 } |
| 677 } | 677 } |
| 678 | 678 |
| 679 void handlePhi(HPhi phi, VariableNamer namer) { | 679 void handlePhi(HPhi phi, VariableNamer namer) { |
| 680 if (!needsName(phi)) return; | 680 if (!needsName(phi)) return; |
| 681 | 681 |
| 682 for (int i = 0; i < phi.inputs.length; i++) { | 682 for (int i = 0; i < phi.inputs.length; i++) { |
| 683 HInstruction input = phi.inputs[i]; | 683 HInstruction input = phi.inputs[i]; |
| 684 HBasicBlock predecessor = phi.block.predecessors[i]; | 684 HBasicBlock predecessor = phi.block.predecessors[i]; |
| 685 // A [HTypeKnown] instruction never has a name, but its checked |
| 686 // input might, therefore we need to do a copy instead of an |
| 687 // assignment. |
| 688 while (input is HTypeKnown) input = input.inputs[0]; |
| 685 if (!needsName(input)) { | 689 if (!needsName(input)) { |
| 686 names.addAssignment(predecessor, input, phi); | 690 names.addAssignment(predecessor, input, phi); |
| 687 } else { | 691 } else { |
| 688 names.addCopy(predecessor, input, phi); | 692 names.addCopy(predecessor, input, phi); |
| 689 } | 693 } |
| 690 } | 694 } |
| 691 | 695 |
| 692 namer.allocateName(phi); | 696 namer.allocateName(phi); |
| 693 } | 697 } |
| 694 } | 698 } |
| OLD | NEW |