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 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 signature.orderedForEachParameter((Element parameterElement) { | 1600 signature.orderedForEachParameter((Element parameterElement) { |
1601 if (elements.isParameterChecked(parameterElement)) { | 1601 if (elements.isParameterChecked(parameterElement)) { |
1602 addParameterCheckInstruction(parameterElement); | 1602 addParameterCheckInstruction(parameterElement); |
1603 } | 1603 } |
1604 }); | 1604 }); |
1605 | 1605 |
1606 // Put the type checks in the first successor of the entry, | 1606 // Put the type checks in the first successor of the entry, |
1607 // because that is where the type guards will also be inserted. | 1607 // because that is where the type guards will also be inserted. |
1608 // This way we ensure that a type guard will dominate the type | 1608 // This way we ensure that a type guard will dominate the type |
1609 // check. | 1609 // check. |
1610 signature.orderedForEachParameter((Element element) { | 1610 signature.orderedForEachParameter((Element parameterElement) { |
| 1611 if (element.isGenerativeConstructorBody()) { |
| 1612 ClosureScope scopeData = |
| 1613 localsHandler.closureData.capturingScopes[node]; |
| 1614 if (scopeData != null |
| 1615 && scopeData.capturedVariableMapping.containsKey( |
| 1616 parameterElement)) { |
| 1617 // The parameter will be a field in the box passed as the |
| 1618 // last parameter. So no need to have it. |
| 1619 return; |
| 1620 } |
| 1621 } |
1611 HInstruction newParameter = potentiallyCheckType( | 1622 HInstruction newParameter = potentiallyCheckType( |
1612 localsHandler.directLocals[element], | 1623 localsHandler.directLocals[parameterElement], |
1613 element.computeType(compiler)); | 1624 parameterElement.computeType(compiler)); |
1614 localsHandler.directLocals[element] = newParameter; | 1625 localsHandler.directLocals[parameterElement] = newParameter; |
1615 }); | 1626 }); |
1616 | 1627 |
1617 returnType = signature.returnType; | 1628 returnType = signature.returnType; |
1618 } else { | 1629 } else { |
1619 // Otherwise it is a lazy initializer which does not have parameters. | 1630 // Otherwise it is a lazy initializer which does not have parameters. |
1620 assert(element is VariableElement); | 1631 assert(element is VariableElement); |
1621 } | 1632 } |
1622 | 1633 |
1623 // Add the type parameters of the class as parameters of this | 1634 // Add the type parameters of the class as parameters of this |
1624 // method. | 1635 // method. |
(...skipping 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4971 new HSubGraphBlockInformation(elseBranch.graph)); | 4982 new HSubGraphBlockInformation(elseBranch.graph)); |
4972 | 4983 |
4973 HBasicBlock conditionStartBlock = conditionBranch.block; | 4984 HBasicBlock conditionStartBlock = conditionBranch.block; |
4974 conditionStartBlock.setBlockFlow(info, joinBlock); | 4985 conditionStartBlock.setBlockFlow(info, joinBlock); |
4975 SubGraph conditionGraph = conditionBranch.graph; | 4986 SubGraph conditionGraph = conditionBranch.graph; |
4976 HIf branch = conditionGraph.end.last; | 4987 HIf branch = conditionGraph.end.last; |
4977 assert(branch is HIf); | 4988 assert(branch is HIf); |
4978 branch.blockInformation = conditionStartBlock.blockFlow; | 4989 branch.blockInformation = conditionStartBlock.blockFlow; |
4979 } | 4990 } |
4980 } | 4991 } |
OLD | NEW |