| 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 env.liveInstructions.forEach((HInstruction instruction, int id) { | 302 new Map.from(env.liveInstructions).forEach((HInstruction instruction, |
| 303 int id) { |
| 303 LiveInterval range = env.liveIntervals.putIfAbsent( | 304 LiveInterval range = env.liveIntervals.putIfAbsent( |
| 304 instruction, () => new LiveInterval()); | 305 instruction, () => new LiveInterval()); |
| 305 range.loopUpdate(env.startId, lastId); | 306 range.loopUpdate(env.startId, lastId); |
| 306 env.liveInstructions[instruction] = lastId; | 307 env.liveInstructions[instruction] = lastId; |
| 307 }); | 308 }); |
| 308 | 309 |
| 309 env.removeLoopMarker(header); | 310 env.removeLoopMarker(header); |
| 310 | 311 |
| 311 // Update all liveIns set to contain the liveIns of [header]. | 312 // Update all liveIns set to contain the liveIns of [header]. |
| 312 liveInstructions.forEach((HBasicBlock block, LiveEnvironment other) { | 313 liveInstructions.forEach((HBasicBlock block, LiveEnvironment other) { |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 if (!needsName(input)) { | 661 if (!needsName(input)) { |
| 661 names.addAssignment(predecessor, input, phi); | 662 names.addAssignment(predecessor, input, phi); |
| 662 } else { | 663 } else { |
| 663 names.addCopy(predecessor, input, phi); | 664 names.addCopy(predecessor, input, phi); |
| 664 } | 665 } |
| 665 } | 666 } |
| 666 | 667 |
| 667 namer.allocateName(phi); | 668 namer.allocateName(phi); |
| 668 } | 669 } |
| 669 } | 670 } |
| OLD | NEW |