| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 Constant folded = operation.fold(receiver.constant); | 196 Constant folded = operation.fold(receiver.constant); |
| 197 if (folded !== null) return graph.addConstant(folded); | 197 if (folded !== null) return graph.addConstant(folded); |
| 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.target.element; |
| 207 if (element.isConstructor() && | 207 if (element.isConstructor() && |
| 208 element.enclosingElement.declaration == | 208 element.enclosingElement.declaration == |
| 209 compiler.listClass.defaultClass.element) { | 209 compiler.listClass.defaultClass.element) { |
| 210 if (call.inputs.length == 2 && call.inputs[1].isInteger(types)) { | 210 if (call.inputs.length == 2 && call.inputs[1].isInteger(types)) { |
| 211 return call.inputs[1]; | 211 return call.inputs[1]; |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 HInstruction input = node.inputs[1]; | 215 HInstruction input = node.inputs[1]; |
| 216 if (node.isLengthGetter()) { | 216 if (node.isLengthGetter()) { |
| (...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 // For other fields having setters in the generative constructor body, set | 1325 // For other fields having setters in the generative constructor body, set |
| 1326 // 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 |
| 1327 // list. | 1327 // list. |
| 1328 allSetters.forEach((Element element) { | 1328 allSetters.forEach((Element element) { |
| 1329 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1329 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1330 }); | 1330 }); |
| 1331 } | 1331 } |
| 1332 } | 1332 } |
| OLD | NEW |