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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 if (isNested(userLoopHeader, currentLoopHeader)) return true; | 139 if (isNested(userLoopHeader, currentLoopHeader)) return true; |
| 140 } | 140 } |
| 141 | 141 |
| 142 // To speed up computations on values loaded from arrays, we | 142 // To speed up computations on values loaded from arrays, we |
| 143 // insert type guards for builtin array indexing operations in | 143 // insert type guards for builtin array indexing operations in |
| 144 // nested loops. Since this can blow up code size quite | 144 // nested loops. Since this can blow up code size quite |
| 145 // significantly, we only do it if type guards have already been | 145 // significantly, we only do it if type guards have already been |
| 146 // inserted for this method. The code size price for an additional | 146 // inserted for this method. The code size price for an additional |
| 147 // type guard is much smaller than the first one that causes the | 147 // type guard is much smaller than the first one that causes the |
| 148 // generation of a bailout method. | 148 // generation of a bailout method. |
| 149 if (instruction is HIndex && | 149 var temp = instruction; |
|
kasperl
2012/11/30 09:23:04
How about factoring this condition out into a sepa
ngeoffray
2012/11/30 13:18:14
Done.
| |
| 150 (instruction as HIndex).isBuiltin(types) && | 150 if ((temp is HIndex |
| 151 hasTypeGuards) { | 151 || (temp is HInvokeDynamicMethod |
| 152 && temp.isIndexOperatorOnIndexablePrimitive(types))) | |
| 153 && hasTypeGuards) { | |
| 152 HBasicBlock loopHeader = instruction.block.enclosingLoopHeader; | 154 HBasicBlock loopHeader = instruction.block.enclosingLoopHeader; |
| 153 if (loopHeader != null && loopHeader.parentLoopHeader != null) { | 155 if (loopHeader != null && loopHeader.parentLoopHeader != null) { |
| 154 return true; | 156 return true; |
| 155 } | 157 } |
| 156 } | 158 } |
| 157 | 159 |
| 158 // If the instruction is used by a phi where a guard would be | 160 // If the instruction is used by a phi where a guard would be |
| 159 // valuable, put the guard on that instruction. | 161 // valuable, put the guard on that instruction. |
| 160 for (HInstruction user in instruction.usedBy) { | 162 for (HInstruction user in instruction.usedBy) { |
| 161 if (user is HPhi | 163 if (user is HPhi |
| (...skipping 377 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 |