| 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 * Instead of emitting each SSA instruction with a temporary variable | 8 * Instead of emitting each SSA instruction with a temporary variable |
| 9 * mark instructions that can be emitted at their use-site. | 9 * mark instructions that can be emitted at their use-site. |
| 10 * For example, in: | 10 * For example, in: |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 HInstruction right = instruction.right; | 101 HInstruction right = instruction.right; |
| 102 if (singleIdentityComparison(left, right) != null) { | 102 if (singleIdentityComparison(left, right) != null) { |
| 103 super.visitIdentity(instruction); | 103 super.visitIdentity(instruction); |
| 104 } | 104 } |
| 105 // Do nothing. | 105 // Do nothing. |
| 106 } | 106 } |
| 107 | 107 |
| 108 void visitTypeConversion(HTypeConversion instruction) { | 108 void visitTypeConversion(HTypeConversion instruction) { |
| 109 if (!instruction.isChecked) { | 109 if (!instruction.isChecked) { |
| 110 markAsGenerateAtUseSite(instruction); | 110 markAsGenerateAtUseSite(instruction); |
| 111 } else if (!instruction.isArgumentTypeCheck) { | 111 } else if (!instruction.isArgumentTypeCheck |
| 112 && !instruction.isReceiverTypeCheck) { |
| 112 assert(instruction.isCheckedModeCheck || instruction.isCastTypeCheck); | 113 assert(instruction.isCheckedModeCheck || instruction.isCastTypeCheck); |
| 113 // Checked mode checks and cast checks compile to code that | 114 // Checked mode checks and cast checks compile to code that |
| 114 // only use their input once, so we can safely visit them | 115 // only use their input once, so we can safely visit them |
| 115 // and try to merge the input. | 116 // and try to merge the input. |
| 116 visitInstruction(instruction); | 117 visitInstruction(instruction); |
| 117 } | 118 } |
| 118 } | 119 } |
| 119 | 120 |
| 120 void tryGenerateAtUseSite(HInstruction instruction) { | 121 void tryGenerateAtUseSite(HInstruction instruction) { |
| 121 if (instruction.isControlFlow()) return; | 122 if (instruction.isControlFlow()) return; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 } | 368 } |
| 368 | 369 |
| 369 // If [thenInput] is defined in the first predecessor, then it is only used | 370 // If [thenInput] is defined in the first predecessor, then it is only used |
| 370 // by [phi] and can be generated at use site. | 371 // by [phi] and can be generated at use site. |
| 371 if (identical(thenInput.block, end.predecessors[0])) { | 372 if (identical(thenInput.block, end.predecessors[0])) { |
| 372 assert(thenInput.usedBy.length == 1); | 373 assert(thenInput.usedBy.length == 1); |
| 373 markAsGenerateAtUseSite(thenInput); | 374 markAsGenerateAtUseSite(thenInput); |
| 374 } | 375 } |
| 375 } | 376 } |
| 376 } | 377 } |
| OLD | NEW |