| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 HType speculativeType) { | 105 HType speculativeType) { |
| 106 // If the type itself is not valuable, do not generate a guard for it. | 106 // If the type itself is not valuable, do not generate a guard for it. |
| 107 if (!typeValuable(speculativeType)) return false; | 107 if (!typeValuable(speculativeType)) return false; |
| 108 | 108 |
| 109 // Do not insert a type guard if the instruction has a type | 109 // Do not insert a type guard if the instruction has a type |
| 110 // annotation that disagrees with the speculated type. | 110 // annotation that disagrees with the speculated type. |
| 111 Element source = instruction.sourceElement; | 111 Element source = instruction.sourceElement; |
| 112 if (source != null) { | 112 if (source != null) { |
| 113 DartType sourceType = source.computeType(compiler); | 113 DartType sourceType = source.computeType(compiler); |
| 114 DartType speculatedType = speculativeType.computeType(compiler); | 114 DartType speculatedType = speculativeType.computeType(compiler); |
| 115 if (speculatedType != null | 115 if (speculatedType != null && |
| 116 && !compiler.types.isAssignable(speculatedType, sourceType)) { | 116 !compiler.types.isAssignable(speculatedType, sourceType)) { |
| 117 return false; | 117 return false; |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Insert type guards for recursive methods. | 121 // Insert type guards for recursive methods. |
| 122 if (isRecursiveMethod) return true; | 122 if (isRecursiveMethod) return true; |
| 123 | 123 |
| 124 // Insert type guards if there are uses in loops. | 124 // Insert type guards if there are uses in loops. |
| 125 bool isNested(HBasicBlock inner, HBasicBlock outer) { | 125 bool isNested(HBasicBlock inner, HBasicBlock outer) { |
| 126 if (identical(inner, outer)) return false; | 126 if (identical(inner, outer)) return false; |
| (...skipping 412 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 |