| Index: lib/compiler/implementation/ssa/optimize.dart
|
| ===================================================================
|
| --- lib/compiler/implementation/ssa/optimize.dart (revision 13038)
|
| +++ lib/compiler/implementation/ssa/optimize.dart (working copy)
|
| @@ -203,12 +203,8 @@
|
| // Try to recognize the length interceptor with input [:new List(int):].
|
| if (node.isLengthGetter() && node.inputs[1] is HInvokeStatic) {
|
| HInvokeStatic call = node.inputs[1];
|
| - Element element = call.inputs[0].element;
|
| - if (element.isConstructor() &&
|
| - element.enclosingElement == compiler.listClass.defaultClass.element) {
|
| - if (call.inputs.length == 2 && call.inputs[1].isInteger(types)) {
|
| - return call.inputs[1];
|
| - }
|
| + if (isFixedSizeListConstructor(call)) {
|
| + return call.inputs[1];
|
| }
|
| }
|
| HInstruction input = node.inputs[1];
|
| @@ -250,6 +246,21 @@
|
| return node;
|
| }
|
|
|
| + bool isFixedSizeListConstructor(HInvokeStatic node) {
|
| + Element element = node.inputs[0].element;
|
| + return element.isConstructor()
|
| + && element.enclosingElement == compiler.listClass.defaultClass.element
|
| + && node.inputs.length == 2
|
| + && node.inputs[1].isInteger(types);
|
| + }
|
| +
|
| + HInstruction visitInvokeStatic(HInvokeStatic node) {
|
| + if (isFixedSizeListConstructor(node)) {
|
| + node.guaranteedType = HType.FIXED_ARRAY;
|
| + }
|
| + return node;
|
| + }
|
| +
|
| HInstruction visitInvokeDynamic(HInvokeDynamic node) {
|
| HType receiverType = types[node.receiver];
|
| if (receiverType.isExact()) {
|
|
|