| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 if (transformToDynamicInvocation) { | 241 if (transformToDynamicInvocation) { |
| 242 return fromInterceptorToDynamicInvocation(node, node.selector); | 242 return fromInterceptorToDynamicInvocation(node, node.selector); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 return node; | 246 return node; |
| 247 } | 247 } |
| 248 | 248 |
| 249 bool isFixedSizeListConstructor(HInvokeStatic node) { | 249 bool isFixedSizeListConstructor(HInvokeStatic node) { |
| 250 Element element = node.inputs[0].element; | 250 Element element = node.inputs[0].element; |
| 251 DartType defaultClass = compiler.listClass.defaultClass; |
| 252 // TODO(ngeoffray): make sure that the only reason the List class is |
| 253 // not resolved is because it's not being used. |
| 251 return element.isConstructor() | 254 return element.isConstructor() |
| 252 && element.enclosingElement == compiler.listClass.defaultClass.element | 255 && defaultClass != null |
| 256 && element.enclosingElement.declaration == defaultClass.element |
| 253 && node.inputs.length == 2 | 257 && node.inputs.length == 2 |
| 254 && node.inputs[1].isInteger(types); | 258 && node.inputs[1].isInteger(types); |
| 255 } | 259 } |
| 256 | 260 |
| 257 HInstruction visitInvokeStatic(HInvokeStatic node) { | 261 HInstruction visitInvokeStatic(HInvokeStatic node) { |
| 258 if (isFixedSizeListConstructor(node)) { | 262 if (isFixedSizeListConstructor(node)) { |
| 259 node.guaranteedType = HType.FIXED_ARRAY; | 263 node.guaranteedType = HType.FIXED_ARRAY; |
| 260 } | 264 } |
| 261 return node; | 265 return node; |
| 262 } | 266 } |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 } | 1337 } |
| 1334 | 1338 |
| 1335 // For other fields having setters in the generative constructor body, set | 1339 // For other fields having setters in the generative constructor body, set |
| 1336 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1340 // the type to UNKNOWN to avoid relying on the type set in the initializer |
| 1337 // list. | 1341 // list. |
| 1338 allSetters.forEach((Element element) { | 1342 allSetters.forEach((Element element) { |
| 1339 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1343 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1340 }); | 1344 }); |
| 1341 } | 1345 } |
| 1342 } | 1346 } |
| OLD | NEW |