| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 if (block.isLoopHeader() && block.predecessors.length > 1) { | 292 if (block.isLoopHeader() && block.predecessors.length > 1) { |
| 293 updateLoopMarker(block); | 293 updateLoopMarker(block); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 | 296 |
| 297 void updateLoopMarker(HBasicBlock header) { | 297 void updateLoopMarker(HBasicBlock header) { |
| 298 LiveEnvironment env = liveInstructions[header]; | 298 LiveEnvironment env = liveInstructions[header]; |
| 299 int lastId = env.loopMarkers[header]; | 299 int lastId = env.loopMarkers[header]; |
| 300 // Update all instructions that are liveIns in [header] to have a | 300 // Update all instructions that are liveIns in [header] to have a |
| 301 // range that covers the loop. | 301 // range that covers the loop. |
| 302 new Map.from(env.liveInstructions).forEach((HInstruction instruction, | 302 env.liveInstructions.forEach((HInstruction instruction, int id) { |
| 303 int id) { | |
| 304 LiveInterval range = env.liveIntervals.putIfAbsent( | 303 LiveInterval range = env.liveIntervals.putIfAbsent( |
| 305 instruction, () => new LiveInterval()); | 304 instruction, () => new LiveInterval()); |
| 306 range.loopUpdate(env.startId, lastId); | 305 range.loopUpdate(env.startId, lastId); |
| 307 env.liveInstructions[instruction] = lastId; | 306 env.liveInstructions[instruction] = lastId; |
| 308 }); | 307 }); |
| 309 | 308 |
| 310 env.removeLoopMarker(header); | 309 env.removeLoopMarker(header); |
| 311 | 310 |
| 312 // Update all liveIns set to contain the liveIns of [header]. | 311 // Update all liveIns set to contain the liveIns of [header]. |
| 313 liveInstructions.forEach((HBasicBlock block, LiveEnvironment other) { | 312 liveInstructions.forEach((HBasicBlock block, LiveEnvironment other) { |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 if (!needsName(input)) { | 660 if (!needsName(input)) { |
| 662 names.addAssignment(predecessor, input, phi); | 661 names.addAssignment(predecessor, input, phi); |
| 663 } else { | 662 } else { |
| 664 names.addCopy(predecessor, input, phi); | 663 names.addCopy(predecessor, input, phi); |
| 665 } | 664 } |
| 666 } | 665 } |
| 667 | 666 |
| 668 namer.allocateName(phi); | 667 namer.allocateName(phi); |
| 669 } | 668 } |
| 670 } | 669 } |
| OLD | NEW |