| 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 BailoutInfo { | 7 class BailoutInfo { |
| 8 int instructionId; | 8 int instructionId; |
| 9 int bailoutId; | 9 int bailoutId; |
| 10 BailoutInfo(this.instructionId, this.bailoutId); | 10 BailoutInfo(this.instructionId, this.bailoutId); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (!speculativeType.isUseful()) return false; | 185 if (!speculativeType.isUseful()) return false; |
| 186 // If the types agree we don't need to check. | 186 // If the types agree we don't need to check. |
| 187 if (speculativeType == computedType) return false; | 187 if (speculativeType == computedType) return false; |
| 188 // If a bailout check is more expensive than doing the actual operation | 188 // If a bailout check is more expensive than doing the actual operation |
| 189 // don't do it either. | 189 // don't do it either. |
| 190 return typeGuardWouldBeValuable(instruction, speculativeType); | 190 return typeGuardWouldBeValuable(instruction, speculativeType); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void visitInstruction(HInstruction instruction) { | 193 void visitInstruction(HInstruction instruction) { |
| 194 HType speculativeType = types[instruction]; | 194 HType speculativeType = types[instruction]; |
| 195 HType computedType = instruction.computeTypeFromInputTypes(types); | 195 HType computedType = instruction.computeTypeFromInputTypes(types, compiler); |
| 196 // Currently the type in [types] is the speculative type each instruction | 196 // Currently the type in [types] is the speculative type each instruction |
| 197 // would like to have. We start by recomputing the type non-speculatively. | 197 // would like to have. We start by recomputing the type non-speculatively. |
| 198 // If we add a type guard then the guard will expose the speculative type. | 198 // If we add a type guard then the guard will expose the speculative type. |
| 199 // If we don't add a type guard then this avoids that subsequent | 199 // If we don't add a type guard then this avoids that subsequent |
| 200 // instructions use the wrong (speculative) type. | 200 // instructions use the wrong (speculative) type. |
| 201 // | 201 // |
| 202 // Note that just setting the speculative type of the instruction is not | 202 // Note that just setting the speculative type of the instruction is not |
| 203 // complete since the type could lead to a phi node which in turn could | 203 // complete since the type could lead to a phi node which in turn could |
| 204 // change the speculative type. In this case we might miss some guards we | 204 // change the speculative type. In this case we might miss some guards we |
| 205 // would have liked to insert. Most of the time this should however be | 205 // would have liked to insert. Most of the time this should however be |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 hasComplexBailoutTargets = true; | 539 hasComplexBailoutTargets = true; |
| 540 } | 540 } |
| 541 } else { | 541 } else { |
| 542 hasComplexBailoutTargets = true; | 542 hasComplexBailoutTargets = true; |
| 543 blocks.forEach((HBasicBlock block) { | 543 blocks.forEach((HBasicBlock block) { |
| 544 block.bailoutTargets.add(target); | 544 block.bailoutTargets.add(target); |
| 545 }); | 545 }); |
| 546 } | 546 } |
| 547 } | 547 } |
| 548 } | 548 } |
| OLD | NEW |