| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 bool typeGuardWouldBeValuable(HInstruction instruction, | 108 bool typeGuardWouldBeValuable(HInstruction instruction, |
| 109 HType speculativeType) { | 109 HType speculativeType) { |
| 110 | 110 |
| 111 Element source = instruction.sourceElement; | 111 Element source = instruction.sourceElement; |
| 112 // Do not insert a type guard if the instruction has a type | 112 // Do not insert a type guard if the instruction has a type |
| 113 // annotation that disagrees with the speculated type. | 113 // annotation that disagrees with the speculated type. |
| 114 if (source !== null) { | 114 if (source !== null) { |
| 115 Type sourceType = source.computeType(compiler); | 115 Type sourceType = source.computeType(compiler); |
| 116 Type speculatedType = speculativeType.computeType(compiler); | 116 Type speculatedType = speculativeType.computeType(compiler); |
| 117 if (speculatedType !== null | 117 if (speculatedType !== null |
| 118 && !compiler.types.isSubtype(speculatedType, sourceType)) { | 118 && !compiler.types.isAssignable(speculatedType, sourceType)) { |
| 119 return false; | 119 return false; |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool isNested(HBasicBlock inner, HBasicBlock outer) { | 123 bool isNested(HBasicBlock inner, HBasicBlock outer) { |
| 124 if (inner === outer) return false; | 124 if (inner === outer) return false; |
| 125 if (outer === null) return true; | 125 if (outer === null) return true; |
| 126 while (inner !== null) { | 126 while (inner !== null) { |
| 127 if (inner === outer) return true; | 127 if (inner === outer) return true; |
| 128 inner = inner.parentLoopHeader; | 128 inner = inner.parentLoopHeader; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 | 428 |
| 429 visitTypeGuard(HTypeGuard guard) { | 429 visitTypeGuard(HTypeGuard guard) { |
| 430 blocks.forEach((HBasicBlock block) { | 430 blocks.forEach((HBasicBlock block) { |
| 431 block.guards.add(guard); | 431 block.guards.add(guard); |
| 432 }); | 432 }); |
| 433 } | 433 } |
| 434 } | 434 } |
| OLD | NEW |