Chromium Code Reviews| Index: pkg/compiler/lib/src/ssa/codegen.dart |
| diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart |
| index 56740243115ac3700f782ec851a3090814d57a4c..27e2c4f506351c6bf1c440ad1e8a6c7b1569d3aa 100644 |
| --- a/pkg/compiler/lib/src/ssa/codegen.dart |
| +++ b/pkg/compiler/lib/src/ssa/codegen.dart |
| @@ -2807,15 +2807,17 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| negative: negative); |
| } |
| - js.Expression generateReceiverOrArgumentTypeTest( |
| - HInstruction input, TypeMask checkedType) { |
| - TypeMask inputType = input.instructionType; |
| + js.Expression generateReceiverOrArgumentTypeTest(HTypeConversion node) { |
| + HInstruction input = node.checkedInput; |
| + TypeMask inputType = node.inputType ?? input.instructionType; |
| + TypeMask checkedType = node.checkedType; |
| // Figure out if it is beneficial to turn this into a null check. |
| // V8 generally prefers 'typeof' checks, but for integers and |
| // indexable primitives we cannot compile this test into a single |
| // typeof check so the null check is cheaper. |
| bool isIntCheck = checkedType.containsOnlyInt(closedWorld); |
| - bool turnIntoNumCheck = isIntCheck && input.isIntegerOrNull(closedWorld); |
| + bool turnIntoNumCheck = |
| + isIntCheck && inputType.nonNullable().containsOnlyInt(closedWorld); |
|
Siggi Cherem (dart-lang)
2017/02/03 21:48:16
I think it's fine to keep it nullable here (the an
|
| bool turnIntoNullCheck = !turnIntoNumCheck && |
| (checkedType.nullable() == inputType) && |
| (isIntCheck || |
| @@ -2848,8 +2850,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| void visitTypeConversion(HTypeConversion node) { |
| if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) { |
| - js.Expression test = generateReceiverOrArgumentTypeTest( |
| - node.checkedInput, node.checkedType); |
| + js.Expression test = generateReceiverOrArgumentTypeTest(node); |
| js.Block oldContainer = currentContainer; |
| js.Statement body = new js.Block.empty(); |
| currentContainer = body; |