Chromium Code Reviews| 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 * Instead of emitting each SSA instruction with a temporary variable | 6 * Instead of emitting each SSA instruction with a temporary variable |
| 7 * mark instructions that can be emitted at their use-site. | 7 * mark instructions that can be emitted at their use-site. |
| 8 * For example, in: | 8 * For example, in: |
| 9 * t0 = 4; | 9 * t0 = 4; |
| 10 * t1 = 3; | 10 * t1 = 3; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 for (HInstruction instruction = block.last.previous; | 127 for (HInstruction instruction = block.last.previous; |
| 128 instruction !== null; | 128 instruction !== null; |
| 129 instruction = instruction.previous) { | 129 instruction = instruction.previous) { |
| 130 if (generateAtUseSite.contains(instruction)) { | 130 if (generateAtUseSite.contains(instruction)) { |
| 131 continue; | 131 continue; |
| 132 } | 132 } |
| 133 if (instruction.isCodeMotionInvariant()) { | 133 if (instruction.isCodeMotionInvariant()) { |
| 134 generateAtUseSite.add(instruction); | 134 generateAtUseSite.add(instruction); |
| 135 continue; | 135 continue; |
| 136 } | 136 } |
| 137 bool foundInInputs = false; | |
| 138 // See if the current instruction is the next non-trivial | 137 // See if the current instruction is the next non-trivial |
| 139 // expected input. If not, drop the expectedInputs and | 138 // expected input. |
| 140 // start over. | 139 if (findInInputs(instruction)) tryGenerateAtUseSite(instruction); |
|
floitsch
2012/04/18 13:13:24
as discussed change this to findInInputsAndPopNonM
ngeoffray
2012/04/18 13:17:19
Done.
| |
| 141 if (findInInputs(instruction)) { | 140 instruction.accept(this); |
| 142 foundInInputs = true; | |
| 143 tryGenerateAtUseSite(instruction); | |
| 144 } else { | |
| 145 assert(expectedInputs.isEmpty()); | |
| 146 } | |
| 147 if (foundInInputs || usedOnlyByPhis(instruction)) { | |
| 148 // Try merging all non-trivial inputs. | |
| 149 instruction.accept(this); | |
| 150 } | |
| 151 } | 141 } |
| 152 | 142 |
| 153 if (block.predecessors.length === 1 | 143 if (block.predecessors.length === 1 |
| 154 && isBlockSinglePredecessor(block.predecessors[0])) { | 144 && isBlockSinglePredecessor(block.predecessors[0])) { |
| 155 assert(block.phis.isEmpty()); | 145 assert(block.phis.isEmpty()); |
| 156 tryMergingExpressions(block.predecessors[0]); | 146 tryMergingExpressions(block.predecessors[0]); |
| 157 } else { | 147 } else { |
| 158 expectedInputs = null; | 148 expectedInputs = null; |
| 159 } | 149 } |
| 160 } | 150 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 // improving the performance of future lookups. | 421 // improving the performance of future lookups. |
| 432 T root = getRepresentative(parent); | 422 T root = getRepresentative(parent); |
| 433 if (root !== parent) representative[element] = root; | 423 if (root !== parent) representative[element] = root; |
| 434 return root; | 424 return root; |
| 435 } | 425 } |
| 436 | 426 |
| 437 bool areEquivalent(T a, T b) { | 427 bool areEquivalent(T a, T b) { |
| 438 return getRepresentative(a) === getRepresentative(b); | 428 return getRepresentative(a) === getRepresentative(b); |
| 439 } | 429 } |
| 440 } | 430 } |
| OLD | NEW |