| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 instruction = instruction.next; | 99 instruction = instruction.next; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 // Primitive types that are not null are valuable. These include | 103 // Primitive types that are not null are valuable. These include |
| 104 // indexable arrays. | 104 // indexable arrays. |
| 105 bool typeValuable(HType type) { | 105 bool typeValuable(HType type) { |
| 106 return type.isPrimitive() && !type.isNull(); | 106 return type.isPrimitive() && !type.isNull(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool get hasTypeGuards() => work.guards.length != 0; | 109 bool get hasTypeGuards => work.guards.length != 0; |
| 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) { |
| (...skipping 417 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 |