Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart b/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart |
| index d861e344333bedf062fe52e82a3779b44327d777..2bc6ed0182a0da7db7c6b638b98cbba8df5233e9 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart |
| @@ -149,21 +149,21 @@ abstract class SsaTypePropagator extends HBaseVisitor |
| } |
| HType visitTypeConversion(HTypeConversion instruction) { |
| - HType oldType = instruction.instructionType; |
| - // Do not change a checked mode check. |
| - if (instruction.isCheckedModeCheck) return oldType; |
| - // We must make sure a type conversion for receiver or argument check |
| - // does not try to do an int check, because an int check is not enough. |
| - // We only do an int check if the input is integer or null. |
| - HInstruction checked = instruction.checkedInput; |
| - if (oldType.isNumber() |
| - && !oldType.isDouble() |
| - && checked.isIntegerOrNull()) { |
| - return HType.INTEGER; |
| - } else if (oldType.isInteger() && !checked.isIntegerOrNull()) { |
| - return HType.NUMBER; |
| + HType inputType = instruction.checkedInput.instructionType; |
| + HType checkedType = instruction.checkedType; |
| + if (instruction.isArgumentTypeCheck || instruction.isReceiverTypeCheck) { |
| + // We must make sure a type conversion for receiver or argument check |
| + // does not try to do an int check, because an int check is not enough. |
| + // We only do an int check if the input is integer or null. |
|
sra1
2013/10/22 22:56:16
It would be nice to make checkedType final.
What
ngeoffray
2013/10/24 06:50:55
Not enough because the check we emit is (a | 0) ==
|
| + if (checkedType.isNumber() |
| + && !checkedType.isDouble() |
| + && inputType.isIntegerOrNull()) { |
| + instruction.checkedType = HType.INTEGER; |
| + } else if (checkedType.isInteger() && !inputType.isIntegerOrNull()) { |
| + instruction.checkedType = HType.NUMBER; |
| + } |
| } |
| - return oldType; |
| + return checkedType.intersection(inputType, compiler); |
| } |
| HType visitTypeKnown(HTypeKnown instruction) { |