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 part of ssa; | 5 part of ssa; |
6 | 6 |
7 /** | 7 /** |
8 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
9 * methods. We need to override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
(...skipping 3339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3350 typeVariable = typeVariable.tail; | 3350 typeVariable = typeVariable.tail; |
3351 }); | 3351 }); |
3352 // Also add null to non-provided type variables to call the | 3352 // Also add null to non-provided type variables to call the |
3353 // constructor with the right number of arguments. | 3353 // constructor with the right number of arguments. |
3354 while (!typeVariable.isEmpty) { | 3354 while (!typeVariable.isEmpty) { |
3355 inputs.add(graph.addConstantNull(constantSystem)); | 3355 inputs.add(graph.addConstantNull(constantSystem)); |
3356 typeVariable = typeVariable.tail; | 3356 typeVariable = typeVariable.tail; |
3357 } | 3357 } |
3358 } | 3358 } |
3359 | 3359 |
| 3360 if (constructor.isFactoryConstructor() && !type.typeArguments.isEmpty) { |
| 3361 compiler.enqueuer.codegen.registerFactoryWithTypeArguments(elements); |
| 3362 } |
3360 HType elementType = computeType(constructor); | 3363 HType elementType = computeType(constructor); |
3361 HInstruction newInstance = new HInvokeStatic(inputs, elementType); | 3364 HInstruction newInstance = new HInvokeStatic(inputs, elementType); |
3362 pushWithPosition(newInstance, node); | 3365 pushWithPosition(newInstance, node); |
3363 | 3366 |
3364 // The List constructor forwards to a Dart static method that does | 3367 // The List constructor forwards to a Dart static method that does |
3365 // not know about the type argument. Therefore we special case | 3368 // not know about the type argument. Therefore we special case |
3366 // this constructor to have the setRuntimeTypeInfo called where | 3369 // this constructor to have the setRuntimeTypeInfo called where |
3367 // the 'new' is done. | 3370 // the 'new' is done. |
3368 if (isListConstructor && backend.needsRti(compiler.listClass)) { | 3371 if (isListConstructor && backend.needsRti(compiler.listClass)) { |
3369 handleListConstructor(type, node, newInstance); | 3372 handleListConstructor(type, node, newInstance); |
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5161 new HSubGraphBlockInformation(elseBranch.graph)); | 5164 new HSubGraphBlockInformation(elseBranch.graph)); |
5162 | 5165 |
5163 HBasicBlock conditionStartBlock = conditionBranch.block; | 5166 HBasicBlock conditionStartBlock = conditionBranch.block; |
5164 conditionStartBlock.setBlockFlow(info, joinBlock); | 5167 conditionStartBlock.setBlockFlow(info, joinBlock); |
5165 SubGraph conditionGraph = conditionBranch.graph; | 5168 SubGraph conditionGraph = conditionBranch.graph; |
5166 HIf branch = conditionGraph.end.last; | 5169 HIf branch = conditionGraph.end.last; |
5167 assert(branch is HIf); | 5170 assert(branch is HIf); |
5168 branch.blockInformation = conditionStartBlock.blockFlow; | 5171 branch.blockInformation = conditionStartBlock.blockFlow; |
5169 } | 5172 } |
5170 } | 5173 } |
OLD | NEW |