Chromium Code Reviews| Index: lib/compiler/implementation/ssa/nodes.dart |
| =================================================================== |
| --- lib/compiler/implementation/ssa/nodes.dart (revision 11874) |
| +++ lib/compiler/implementation/ssa/nodes.dart (working copy) |
| @@ -1082,6 +1082,30 @@ |
| } |
| return false; |
| } |
| + |
| + |
| + HInstruction convertType(Compiler compiler, |
| + Element sourceElement, |
| + int kind) { |
| + DartType type = sourceElement.computeType(compiler); |
| + if (type === null) return this; |
| + if (type.element === compiler.dynamicClass) return this; |
| + if (type.element === compiler.objectClass) return this; |
| + |
| + // If the original can't be null, type conversion also can't produce null. |
| + bool canBeNull = this.guaranteedType.canBeNull(); |
| + HType convertedType = |
| + new HType.fromBoundedType(type, compiler, canBeNull); |
| + |
| + // No need to convert if we know the instruction has |
| + // [convertedType] as a bound. |
| + if (this.guaranteedType == convertedType) { |
| + return this; |
| + } |
| + |
| + HInstruction instruction = new HTypeConversion(convertedType, this, kind); |
|
kasperl
2012/09/06 10:20:39
Maybe just return it here with creating a new loca
ngeoffray
2012/09/06 16:12:03
Done.
|
| + return instruction; |
| + } |
| } |
| class HBoolify extends HInstruction { |