| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 DartType sourceType = source.computeType(compiler); | 125 DartType sourceType = source.computeType(compiler); |
| 126 DartType speculatedType = speculativeType.computeType(compiler); | 126 DartType speculatedType = speculativeType.computeType(compiler); |
| 127 JavaScriptBackend backend = compiler.backend; | 127 JavaScriptBackend backend = compiler.backend; |
| 128 if (speculatedType != null) { | 128 if (speculatedType != null) { |
| 129 // Use the num type instead of JSNumber because JSNumber | 129 // Use the num type instead of JSNumber because JSNumber |
| 130 // is not assignment compatible with int and double, but we | 130 // is not assignment compatible with int and double, but we |
| 131 // still want to generate a type guard. | 131 // still want to generate a type guard. |
| 132 if (speculatedType.element == backend.jsNumberClass) { | 132 if (speculatedType.element == backend.jsNumberClass) { |
| 133 speculatedType = compiler.numClass.computeType(compiler); | 133 speculatedType = compiler.numClass.computeType(compiler); |
| 134 } | 134 } |
| 135 // Use the JSString type instead of String because String is |
| 136 // not assignment compatible with JSIndexable, but we still |
| 137 // want to generate a type guard. |
| 138 if (sourceType.element == compiler.stringClass) { |
| 139 sourceType = backend.jsStringClass.computeType(compiler); |
| 140 } |
| 135 if (!compiler.types.isAssignable(speculatedType, sourceType)) { | 141 if (!compiler.types.isAssignable(speculatedType, sourceType)) { |
| 136 return false; | 142 return false; |
| 137 } | 143 } |
| 138 } | 144 } |
| 139 } | 145 } |
| 140 | 146 |
| 141 // Insert type guards for recursive methods. | 147 // Insert type guards for recursive methods. |
| 142 if (isRecursiveMethod) return true; | 148 if (isRecursiveMethod) return true; |
| 143 | 149 |
| 144 // Insert type guards if there are uses in loops. | 150 // Insert type guards if there are uses in loops. |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 hasComplexBailoutTargets = true; | 631 hasComplexBailoutTargets = true; |
| 626 } | 632 } |
| 627 } else { | 633 } else { |
| 628 hasComplexBailoutTargets = true; | 634 hasComplexBailoutTargets = true; |
| 629 blocks.forEach((HBasicBlock block) { | 635 blocks.forEach((HBasicBlock block) { |
| 630 block.bailoutTargets.add(target); | 636 block.bailoutTargets.add(target); |
| 631 }); | 637 }); |
| 632 } | 638 } |
| 633 } | 639 } |
| 634 } | 640 } |
| OLD | NEW |