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 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 conditionExitBlock.addAtExit(new HIf(condition)); | 1989 conditionExitBlock.addAtExit(new HIf(condition)); |
1990 conditionExitBlock.addSuccessor(elseBlock); | 1990 conditionExitBlock.addSuccessor(elseBlock); |
1991 conditionExitBlock.remove(conditionExitBlock.last); | 1991 conditionExitBlock.remove(conditionExitBlock.last); |
1992 HIfBlockInformation info = | 1992 HIfBlockInformation info = |
1993 new HIfBlockInformation( | 1993 new HIfBlockInformation( |
1994 wrapExpressionGraph(conditionExpression), | 1994 wrapExpressionGraph(conditionExpression), |
1995 wrapStatementGraph(bodyGraph), | 1995 wrapStatementGraph(bodyGraph), |
1996 wrapStatementGraph(elseGraph)); | 1996 wrapStatementGraph(elseGraph)); |
1997 | 1997 |
1998 conditionBlock.setBlockFlow(info, current); | 1998 conditionBlock.setBlockFlow(info, current); |
1999 conditionBlock.last.blockInformation = conditionBlock.blockFlow; | 1999 HIf ifBlock = conditionBlock.last; |
| 2000 ifBlock.blockInformation = conditionBlock.blockFlow; |
2000 | 2001 |
2001 // If the body has any break, attach a synthesized label to the | 2002 // If the body has any break, attach a synthesized label to the |
2002 // if block. | 2003 // if block. |
2003 if (jumpHandler.hasAnyBreak()) { | 2004 if (jumpHandler.hasAnyBreak()) { |
2004 TargetElement target = elements[loop]; | 2005 TargetElement target = elements[loop]; |
2005 LabelElement label = target.addLabel(null, 'loop'); | 2006 LabelElement label = target.addLabel(null, 'loop'); |
2006 label.isBreakTarget = true; | 2007 label.isBreakTarget = true; |
2007 SubGraph labelGraph = new SubGraph(conditionBlock, current); | 2008 SubGraph labelGraph = new SubGraph(conditionBlock, current); |
2008 HLabeledBlockInformation labelInfo = new HLabeledBlockInformation( | 2009 HLabeledBlockInformation labelInfo = new HLabeledBlockInformation( |
2009 new HSubGraphBlockInformation(labelGraph), | 2010 new HSubGraphBlockInformation(labelGraph), |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3485 }); | 3486 }); |
3486 generateThrowNoSuchMethod(diagnosticNode, | 3487 generateThrowNoSuchMethod(diagnosticNode, |
3487 function.name.slowToString(), | 3488 function.name.slowToString(), |
3488 argumentNodes: argumentNodes, | 3489 argumentNodes: argumentNodes, |
3489 existingArguments: existingArguments); | 3490 existingArguments: existingArguments); |
3490 } | 3491 } |
3491 | 3492 |
3492 visitNewExpression(NewExpression node) { | 3493 visitNewExpression(NewExpression node) { |
3493 Element element = elements[node.send]; | 3494 Element element = elements[node.send]; |
3494 if (!Elements.isErroneousElement(element)) { | 3495 if (!Elements.isErroneousElement(element)) { |
3495 element = element.redirectionTarget; | 3496 FunctionElement function = element; |
| 3497 element = function.redirectionTarget; |
3496 } | 3498 } |
3497 if (Elements.isErroneousElement(element)) { | 3499 if (Elements.isErroneousElement(element)) { |
3498 ErroneousElement error = element; | 3500 ErroneousElement error = element; |
3499 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) { | 3501 if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) { |
3500 generateThrowNoSuchMethod(node.send, | 3502 generateThrowNoSuchMethod(node.send, |
3501 getTargetName(error, 'constructor'), | 3503 getTargetName(error, 'constructor'), |
3502 argumentNodes: node.send.arguments); | 3504 argumentNodes: node.send.arguments); |
3503 } else if (error.messageKind == MessageKind.CANNOT_RESOLVE) { | 3505 } else if (error.messageKind == MessageKind.CANNOT_RESOLVE) { |
3504 Message message = error.messageKind.message(error.messageArguments); | 3506 Message message = error.messageKind.message(error.messageArguments); |
3505 generateRuntimeError(node.send, message.toString()); | 3507 generateRuntimeError(node.send, message.toString()); |
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4956 new HSubGraphBlockInformation(elseBranch.graph)); | 4958 new HSubGraphBlockInformation(elseBranch.graph)); |
4957 | 4959 |
4958 HBasicBlock conditionStartBlock = conditionBranch.block; | 4960 HBasicBlock conditionStartBlock = conditionBranch.block; |
4959 conditionStartBlock.setBlockFlow(info, joinBlock); | 4961 conditionStartBlock.setBlockFlow(info, joinBlock); |
4960 SubGraph conditionGraph = conditionBranch.graph; | 4962 SubGraph conditionGraph = conditionBranch.graph; |
4961 HIf branch = conditionGraph.end.last; | 4963 HIf branch = conditionGraph.end.last; |
4962 assert(branch is HIf); | 4964 assert(branch is HIf); |
4963 branch.blockInformation = conditionStartBlock.blockFlow; | 4965 branch.blockInformation = conditionStartBlock.blockFlow; |
4964 } | 4966 } |
4965 } | 4967 } |
OLD | NEW |