| 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 class SsaTypePropagator extends HBaseVisitor implements OptimizationPhase { | 7 class SsaTypePropagator extends HBaseVisitor implements OptimizationPhase { |
| 8 final Map<int, HInstruction> workmap = new Map<int, HInstruction>(); | 8 final Map<int, HInstruction> workmap = new Map<int, HInstruction>(); |
| 9 final List<int> worklist = new List<int>(); | 9 final List<int> worklist = new List<int>(); |
| 10 final Map<HInstruction, Function> pendingOptimizations = | 10 final Map<HInstruction, Function> pendingOptimizations = |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 TypeMask visitAdd(HAdd instruction) { | 126 TypeMask visitAdd(HAdd instruction) { |
| 127 return checkPositiveInteger(instruction); | 127 return checkPositiveInteger(instruction); |
| 128 } | 128 } |
| 129 | 129 |
| 130 TypeMask visitDivide(HDivide instruction) { | 130 TypeMask visitDivide(HDivide instruction) { |
| 131 // Always double, as initialized. | 131 // Always double, as initialized. |
| 132 return instruction.instructionType; | 132 return instruction.instructionType; |
| 133 } | 133 } |
| 134 | 134 |
| 135 TypeMask visitTruncatingDivide(HTruncatingDivide instruction) { |
| 136 // Always as initialized. |
| 137 return instruction.instructionType; |
| 138 } |
| 139 |
| 135 TypeMask visitNegate(HNegate instruction) { | 140 TypeMask visitNegate(HNegate instruction) { |
| 136 HInstruction operand = instruction.operand; | 141 HInstruction operand = instruction.operand; |
| 137 // We have integer subclasses that represent ranges, so widen any int | 142 // We have integer subclasses that represent ranges, so widen any int |
| 138 // subclass to full integer. | 143 // subclass to full integer. |
| 139 if (operand.isInteger(compiler)) return backend.intType; | 144 if (operand.isInteger(compiler)) return backend.intType; |
| 140 return instruction.operand.instructionType; | 145 return instruction.operand.instructionType; |
| 141 } | 146 } |
| 142 | 147 |
| 143 TypeMask visitInstruction(HInstruction instruction) { | 148 TypeMask visitInstruction(HInstruction instruction) { |
| 144 assert(instruction.instructionType != null); | 149 assert(instruction.instructionType != null); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 instruction.block.addBefore(instruction.next, converted); | 372 instruction.block.addBefore(instruction.next, converted); |
| 368 receiver.replaceAllUsersDominatedBy(converted.next, converted); | 373 receiver.replaceAllUsersDominatedBy(converted.next, converted); |
| 369 addDependentInstructionsToWorkList(converted); | 374 addDependentInstructionsToWorkList(converted); |
| 370 } | 375 } |
| 371 } | 376 } |
| 372 | 377 |
| 373 return instruction.specializer.computeTypeFromInputTypes( | 378 return instruction.specializer.computeTypeFromInputTypes( |
| 374 instruction, compiler); | 379 instruction, compiler); |
| 375 } | 380 } |
| 376 } | 381 } |
| OLD | NEW |