| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 // Special case the check instruction to use the name of its | 437 // Special case the check instruction to use the name of its |
| 438 // checked instruction. | 438 // checked instruction. |
| 439 HCheck check = instruction; | 439 HCheck check = instruction; |
| 440 name = names.ownName[check.checkedInput]; | 440 name = names.ownName[check.checkedInput]; |
| 441 // If the name is null, then the checked input is being | 441 // If the name is null, then the checked input is being |
| 442 // generated at use site, and we don't need a name for the check | 442 // generated at use site, and we don't need a name for the check |
| 443 // instruction. | 443 // instruction. |
| 444 if (name == null) return null; | 444 if (name == null) return null; |
| 445 } else if (instruction is HParameterValue) { | 445 } else if (instruction is HParameterValue) { |
| 446 HParameterValue parameter = instruction; | 446 HParameterValue parameter = instruction; |
| 447 name = parameterNames[parameter.element]; | 447 name = parameterNames[parameter.sourceElement]; |
| 448 if (name == null) { | 448 if (name == null) { |
| 449 name = allocateWithHint(parameter.element.name.slowToString()); | 449 name = allocateWithHint(parameter.sourceElement.name.slowToString()); |
| 450 } | 450 } |
| 451 } else if (instruction.sourceElement !== null) { | 451 } else if (instruction.sourceElement !== null) { |
| 452 name = allocateWithHint(instruction.sourceElement.name.slowToString()); | 452 name = allocateWithHint(instruction.sourceElement.name.slowToString()); |
| 453 } else { | 453 } else { |
| 454 // We could not find an element for the instruction. If the | 454 // We could not find an element for the instruction. If the |
| 455 // instruction is used by a phi, try to use the name of the phi. | 455 // instruction is used by a phi, try to use the name of the phi. |
| 456 // Otherwise, just allocate a temporary name. | 456 // Otherwise, just allocate a temporary name. |
| 457 HPhi phi = firstPhiUserWithElement(instruction); | 457 HPhi phi = firstPhiUserWithElement(instruction); |
| 458 if (phi !== null) { | 458 if (phi !== null) { |
| 459 name = allocateWithHint(phi.sourceElement.name.slowToString()); | 459 name = allocateWithHint(phi.sourceElement.name.slowToString()); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 if (!needsName(input)) { | 571 if (!needsName(input)) { |
| 572 names.addAssignment(predecessor, input, phi); | 572 names.addAssignment(predecessor, input, phi); |
| 573 } else { | 573 } else { |
| 574 names.addCopy(predecessor, input, phi); | 574 names.addCopy(predecessor, input, phi); |
| 575 } | 575 } |
| 576 } | 576 } |
| 577 | 577 |
| 578 namer.allocateName(phi); | 578 namer.allocateName(phi); |
| 579 } | 579 } |
| 580 } | 580 } |
| OLD | NEW |