| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 abstract class OptimizationPhase { | 5 abstract class OptimizationPhase { |
| 6 String get name; | 6 String get name; |
| 7 void visitGraph(HGraph graph); | 7 void visitGraph(HGraph graph); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class SsaOptimizerTask extends CompilerTask { | 10 class SsaOptimizerTask extends CompilerTask { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 return node; | 199 return node; |
| 200 } | 200 } |
| 201 | 201 |
| 202 HInstruction visitInvokeInterceptor(HInvokeInterceptor node) { | 202 HInstruction visitInvokeInterceptor(HInvokeInterceptor node) { |
| 203 // Try to recognize the length interceptor with input [:new List(int):]. | 203 // Try to recognize the length interceptor with input [:new List(int):]. |
| 204 if (node.isLengthGetter() && node.inputs[1] is HInvokeStatic) { | 204 if (node.isLengthGetter() && node.inputs[1] is HInvokeStatic) { |
| 205 HInvokeStatic call = node.inputs[1]; | 205 HInvokeStatic call = node.inputs[1]; |
| 206 Element element = call.inputs[0].element; | 206 Element element = call.inputs[0].element; |
| 207 if (element.isConstructor() && | 207 if (element.isConstructor() && |
| 208 element.enclosingElement == compiler.listClass.defaultClass.element) { | 208 element.enclosingElement.declaration == |
| 209 compiler.listClass.defaultClass.element) { |
| 209 if (call.inputs.length == 2 && call.inputs[1].isInteger(types)) { | 210 if (call.inputs.length == 2 && call.inputs[1].isInteger(types)) { |
| 210 return call.inputs[1]; | 211 return call.inputs[1]; |
| 211 } | 212 } |
| 212 } | 213 } |
| 213 } | 214 } |
| 214 HInstruction input = node.inputs[1]; | 215 HInstruction input = node.inputs[1]; |
| 215 if (node.isLengthGetter()) { | 216 if (node.isLengthGetter()) { |
| 216 if (input.isConstantString()) { | 217 if (input.isConstantString()) { |
| 217 HConstant constantInput = input; | 218 HConstant constantInput = input; |
| 218 StringConstant constant = constantInput.constant; | 219 StringConstant constant = constantInput.constant; |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 } | 1323 } |
| 1323 | 1324 |
| 1324 // For other fields having setters in the generative constructor body, set | 1325 // For other fields having setters in the generative constructor body, set |
| 1325 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1326 // the type to UNKNOWN to avoid relying on the type set in the initializer |
| 1326 // list. | 1327 // list. |
| 1327 allSetters.forEach((Element element) { | 1328 allSetters.forEach((Element element) { |
| 1328 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1329 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1329 }); | 1330 }); |
| 1330 } | 1331 } |
| 1331 } | 1332 } |
| OLD | NEW |