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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 bool typeGuardWouldBeValuable(HInstruction instruction, | 134 bool typeGuardWouldBeValuable(HInstruction instruction, |
135 HType speculativeType) { | 135 HType speculativeType) { |
136 // If the type itself is not valuable, do not generate a guard for it. | 136 // If the type itself is not valuable, do not generate a guard for it. |
137 if (!typeValuable(speculativeType)) return false; | 137 if (!typeValuable(speculativeType)) return false; |
138 | 138 |
139 // Do not insert a type guard if the instruction has a type | 139 // Do not insert a type guard if the instruction has a type |
140 // annotation that disagrees with the speculated type. | 140 // annotation that disagrees with the speculated type. |
141 Element source = instruction.sourceElement; | 141 Element source = instruction.sourceElement; |
142 if (source != null) { | 142 if (source != null) { |
143 DartType sourceType = source.computeType(compiler); | 143 DartType sourceType = source.computeType(compiler); |
144 if (!sourceType.isMalformed && !sourceType.isDynamic && | 144 if (!sourceType.treatAsDynamic && |
145 sourceType.kind == TypeKind.INTERFACE) { | 145 sourceType.kind == TypeKind.INTERFACE) { |
146 TypeMask sourceMask = new TypeMask.subtype(sourceType); | 146 TypeMask sourceMask = new TypeMask.subtype(sourceType); |
147 TypeMask speculatedMask = speculativeType.computeMask(compiler); | 147 TypeMask speculatedMask = speculativeType.computeMask(compiler); |
148 if (sourceMask.intersection(speculatedMask, compiler).isEmpty) { | 148 if (sourceMask.intersection(speculatedMask, compiler).isEmpty) { |
149 return false; | 149 return false; |
150 } | 150 } |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 // Do not insert a type guard if one of the calls on it will hit | 154 // Do not insert a type guard if one of the calls on it will hit |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 hasComplexBailoutTargets = true; | 700 hasComplexBailoutTargets = true; |
701 } | 701 } |
702 } else { | 702 } else { |
703 hasComplexBailoutTargets = true; | 703 hasComplexBailoutTargets = true; |
704 blocks.forEach((HBasicBlock block) { | 704 blocks.forEach((HBasicBlock block) { |
705 block.bailoutTargets.add(target); | 705 block.bailoutTargets.add(target); |
706 }); | 706 }); |
707 } | 707 } |
708 } | 708 } |
709 } | 709 } |
OLD | NEW |