| 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 24 matching lines...) Expand all Loading... |
| 35 for (HInstruction input in instruction.inputs) { | 35 for (HInstruction input in instruction.inputs) { |
| 36 if (!generateAtUseSite.contains(input) | 36 if (!generateAtUseSite.contains(input) |
| 37 && !input.isCodeMotionInvariant() | 37 && !input.isCodeMotionInvariant() |
| 38 && input.usedBy.length == 1 | 38 && input.usedBy.length == 1 |
| 39 && input is! HPhi) { | 39 && input is! HPhi) { |
| 40 expectedInputs.add(input); | 40 expectedInputs.add(input); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 void visitTypeConversion(HTypeConversion instruction) { | |
| 46 generateAtUseSite.add(instruction); | |
| 47 } | |
| 48 | |
| 49 // The codegen might use the input multiple times, so it must not be | 45 // The codegen might use the input multiple times, so it must not be |
| 50 // set generate at use site. | 46 // set generate at use site. |
| 51 void visitIs(HIs instruction) {} | 47 void visitIs(HIs instruction) {} |
| 52 | 48 |
| 53 // A check method must not have its input generate at use site, | 49 // A check method must not have its input generate at use site, |
| 54 // because it's using it multiple times. | 50 // because it's using it multiple times. |
| 55 void visitCheck(HCheck instruction) {} | 51 void visitCheck(HCheck instruction) {} |
| 56 | 52 |
| 57 // A type guard should not generate its input at use site, otherwise | 53 // A type guard should not generate its input at use site, otherwise |
| 58 // they would not be alive. | 54 // they would not be alive. |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 // improving the performance of future lookups. | 488 // improving the performance of future lookups. |
| 493 T root = getRepresentative(parent); | 489 T root = getRepresentative(parent); |
| 494 if (root !== parent) representative[element] = root; | 490 if (root !== parent) representative[element] = root; |
| 495 return root; | 491 return root; |
| 496 } | 492 } |
| 497 | 493 |
| 498 bool areEquivalent(T a, T b) { | 494 bool areEquivalent(T a, T b) { |
| 499 return getRepresentative(a) === getRepresentative(b); | 495 return getRepresentative(a) === getRepresentative(b); |
| 500 } | 496 } |
| 501 } | 497 } |
| OLD | NEW |