| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 void markInputsAsLiveInEnvironment(HInstruction instruction, | 219 void markInputsAsLiveInEnvironment(HInstruction instruction, |
| 220 LiveEnvironment environment) { | 220 LiveEnvironment environment) { |
| 221 for (int i = 0, len = instruction.inputs.length; i < len; i++) { | 221 for (int i = 0, len = instruction.inputs.length; i < len; i++) { |
| 222 markAsLiveInEnvironment(instruction.inputs[i], environment); | 222 markAsLiveInEnvironment(instruction.inputs[i], environment); |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Returns the non-HCheck instruction, or the last [HCheck] in the | 226 // Returns the non-HCheck instruction, or the last [HCheck] in the |
| 227 // check chain that is not generate at use site. | 227 // check chain that is not generate at use site. |
| 228 // |
| 229 // For example: |
| 230 // |
| 231 // t1 = GeneratedAtUseSite instruction |
| 232 // t2 = check(t1) |
| 233 // t3 = check(t2) |
| 234 // t4 = use(t3) |
| 235 // t5 = use(t3) |
| 236 // t6 = use(t2) |
| 237 // |
| 238 // The t1 is generate-at-use site, and the live-range must thus be on t2 and |
| 239 // not on the checked instruction t1. |
| 240 // When looking for the checkedInstructionOrNonGenerateAtUseSite of t3 we must |
| 241 // return t2. |
| 228 HInstruction checkedInstructionOrNonGenerateAtUseSite(HCheck check) { | 242 HInstruction checkedInstructionOrNonGenerateAtUseSite(HCheck check) { |
| 229 var checked = check.checkedInput; | 243 var checked = check.checkedInput; |
| 230 while (checked is HCheck) { | 244 while (checked is HCheck) { |
| 231 HInstruction next = checked.checkedInput; | 245 HInstruction next = checked.checkedInput; |
| 232 if (generateAtUseSite.contains(next)) break; | 246 if (generateAtUseSite.contains(next)) break; |
| 233 checked = next; | 247 checked = next; |
| 234 } | 248 } |
| 235 return checked; | 249 return checked; |
| 236 } | 250 } |
| 237 | 251 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 if (!needsName(input)) { | 707 if (!needsName(input)) { |
| 694 names.addAssignment(predecessor, input, phi); | 708 names.addAssignment(predecessor, input, phi); |
| 695 } else { | 709 } else { |
| 696 names.addCopy(predecessor, input, phi); | 710 names.addCopy(predecessor, input, phi); |
| 697 } | 711 } |
| 698 } | 712 } |
| 699 | 713 |
| 700 namer.allocateName(phi); | 714 namer.allocateName(phi); |
| 701 } | 715 } |
| 702 } | 716 } |
| OLD | NEW |