| 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 class BailoutInfo { | 5 class BailoutInfo { |
| 6 int instructionId; | 6 int instructionId; |
| 7 int bailoutId; | 7 int bailoutId; |
| 8 BailoutInfo(this.instructionId, this.bailoutId); | 8 BailoutInfo(this.instructionId, this.bailoutId); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 bool typeGuardWouldBeValuable(HInstruction instruction, | 111 bool typeGuardWouldBeValuable(HInstruction instruction, |
| 112 HType speculativeType) { | 112 HType speculativeType) { |
| 113 // If the type itself is not valuable, do not generate a guard for it. | 113 // If the type itself is not valuable, do not generate a guard for it. |
| 114 if (!typeValuable(speculativeType)) return false; | 114 if (!typeValuable(speculativeType)) return false; |
| 115 | 115 |
| 116 // Do not insert a type guard if the instruction has a type | 116 // Do not insert a type guard if the instruction has a type |
| 117 // annotation that disagrees with the speculated type. | 117 // annotation that disagrees with the speculated type. |
| 118 Element source = instruction.sourceElement; | 118 Element source = instruction.sourceElement; |
| 119 if (source !== null) { | 119 if (source !== null) { |
| 120 Type sourceType = source.computeType(compiler); | 120 DartType sourceType = source.computeType(compiler); |
| 121 Type speculatedType = speculativeType.computeType(compiler); | 121 DartType speculatedType = speculativeType.computeType(compiler); |
| 122 if (speculatedType !== null | 122 if (speculatedType !== null |
| 123 && !compiler.types.isAssignable(speculatedType, sourceType)) { | 123 && !compiler.types.isAssignable(speculatedType, sourceType)) { |
| 124 return false; | 124 return false; |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Insert type guards for recursive methods. | 128 // Insert type guards for recursive methods. |
| 129 if (isRecursiveMethod) return true; | 129 if (isRecursiveMethod) return true; |
| 130 | 130 |
| 131 // Insert type guards if there are uses in loops. | 131 // Insert type guards if there are uses in loops. |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 hasComplexBailoutTargets = true; | 537 hasComplexBailoutTargets = true; |
| 538 } | 538 } |
| 539 } else { | 539 } else { |
| 540 hasComplexBailoutTargets = true; | 540 hasComplexBailoutTargets = true; |
| 541 blocks.forEach((HBasicBlock block) { | 541 blocks.forEach((HBasicBlock block) { |
| 542 block.bailoutTargets.add(target); | 542 block.bailoutTargets.add(target); |
| 543 }); | 543 }); |
| 544 } | 544 } |
| 545 } | 545 } |
| 546 } | 546 } |
| OLD | NEW |