| Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| index 48581f00ae8d348eb4587c46bda506febe4db747..5175406317e0c9032dbd71510739852b2deb51ce 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
|
| @@ -2482,12 +2482,21 @@ class TypePropagationVisitor implements Visitor {
|
|
|
| @override
|
| void visitGetLength(GetLength node) {
|
| - setValue(node, nonConstant(typeSystem.intType));
|
| + AbstractValue input = getValue(node.object.definition);
|
| + int length = typeSystem.getContainerLength(input.type);
|
| + if (length != null) {
|
| + // TODO(asgerf): Constant-folding the length might degrade the VM's
|
| + // own bounds-check elimination?
|
| + setValue(node, constantValue(new IntConstantValue(length)));
|
| + } else {
|
| + setValue(node, nonConstant(typeSystem.intType));
|
| + }
|
| }
|
|
|
| @override
|
| void visitGetIndex(GetIndex node) {
|
| - setValue(node, nonConstant());
|
| + AbstractValue input = getValue(node.object.definition);
|
| + setValue(node, nonConstant(typeSystem.getIndexType(input.type)));
|
| }
|
|
|
| @override
|
|
|