Chromium Code Reviews| 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 !speculatedType.isMalformed && |
| 117 !sourceType.isMalformed && | |
|
ngeoffray
2012/11/30 12:00:40
I wouldn't bother here. Let it have type guards. T
Johnni Winther
2012/12/04 10:07:17
Done.
| |
| 118 !compiler.types.isAssignable(speculatedType, sourceType)) { | |
| 117 return false; | 119 return false; |
| 118 } | 120 } |
| 119 } | 121 } |
| 120 | 122 |
| 121 // Insert type guards for recursive methods. | 123 // Insert type guards for recursive methods. |
| 122 if (isRecursiveMethod) return true; | 124 if (isRecursiveMethod) return true; |
| 123 | 125 |
| 124 // Insert type guards if there are uses in loops. | 126 // Insert type guards if there are uses in loops. |
| 125 bool isNested(HBasicBlock inner, HBasicBlock outer) { | 127 bool isNested(HBasicBlock inner, HBasicBlock outer) { |
| 126 if (identical(inner, outer)) return false; | 128 if (identical(inner, outer)) return false; |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 hasComplexBailoutTargets = true; | 541 hasComplexBailoutTargets = true; |
| 540 } | 542 } |
| 541 } else { | 543 } else { |
| 542 hasComplexBailoutTargets = true; | 544 hasComplexBailoutTargets = true; |
| 543 blocks.forEach((HBasicBlock block) { | 545 blocks.forEach((HBasicBlock block) { |
| 544 block.bailoutTargets.add(target); | 546 block.bailoutTargets.add(target); |
| 545 }); | 547 }); |
| 546 } | 548 } |
| 547 } | 549 } |
| 548 } | 550 } |
| OLD | NEW |