Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 13912013: Fix issue 9939 by making the body of a try block have two successors: the join block after the try/… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/issue9939_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4599 matching lines...) Expand 10 before | Expand all | Expand 10 after
4610 HBasicBlock startTryBlock; 4610 HBasicBlock startTryBlock;
4611 HBasicBlock endTryBlock; 4611 HBasicBlock endTryBlock;
4612 HBasicBlock startCatchBlock; 4612 HBasicBlock startCatchBlock;
4613 HBasicBlock endCatchBlock; 4613 HBasicBlock endCatchBlock;
4614 HBasicBlock startFinallyBlock; 4614 HBasicBlock startFinallyBlock;
4615 HBasicBlock endFinallyBlock; 4615 HBasicBlock endFinallyBlock;
4616 4616
4617 startTryBlock = graph.addNewBlock(); 4617 startTryBlock = graph.addNewBlock();
4618 open(startTryBlock); 4618 open(startTryBlock);
4619 visit(node.tryBlock); 4619 visit(node.tryBlock);
4620 if (!isAborted()) endTryBlock = close(new HGoto()); 4620 // We use a [HExitTry] instead of a [HGoto] for the try block
4621 // because it will have multiple successors: the join block, and
4622 // the catch or finally block.
4623 if (!isAborted()) endTryBlock = close(new HExitTry());
4621 SubGraph bodyGraph = new SubGraph(startTryBlock, lastOpenedBlock); 4624 SubGraph bodyGraph = new SubGraph(startTryBlock, lastOpenedBlock);
4622 SubGraph catchGraph = null; 4625 SubGraph catchGraph = null;
4623 HLocalValue exception = null; 4626 HLocalValue exception = null;
4624 4627
4625 if (!node.catchBlocks.isEmpty) { 4628 if (!node.catchBlocks.isEmpty) {
4626 localsHandler = new LocalsHandler.from(savedLocals); 4629 localsHandler = new LocalsHandler.from(savedLocals);
4627 startCatchBlock = graph.addNewBlock(); 4630 startCatchBlock = graph.addNewBlock();
4628 open(startCatchBlock); 4631 open(startCatchBlock);
4629 // TODO(kasperl): Bad smell. We shouldn't be constructing elements here. 4632 // TODO(kasperl): Bad smell. We shouldn't be constructing elements here.
4630 // Note that the name of this element is irrelevant. 4633 // Note that the name of this element is irrelevant.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
4769 enterBlock.addSuccessor(startTryBlock); 4772 enterBlock.addSuccessor(startTryBlock);
4770 addOptionalSuccessor(enterBlock, startCatchBlock); 4773 addOptionalSuccessor(enterBlock, startCatchBlock);
4771 addOptionalSuccessor(enterBlock, startFinallyBlock); 4774 addOptionalSuccessor(enterBlock, startFinallyBlock);
4772 enterBlock.addSuccessor(exitBlock); 4775 enterBlock.addSuccessor(exitBlock);
4773 4776
4774 // The body has either the catch or the finally block as successor. 4777 // The body has either the catch or the finally block as successor.
4775 if (endTryBlock != null) { 4778 if (endTryBlock != null) {
4776 assert(startCatchBlock != null || startFinallyBlock != null); 4779 assert(startCatchBlock != null || startFinallyBlock != null);
4777 endTryBlock.addSuccessor( 4780 endTryBlock.addSuccessor(
4778 startCatchBlock != null ? startCatchBlock : startFinallyBlock); 4781 startCatchBlock != null ? startCatchBlock : startFinallyBlock);
4782 endTryBlock.addSuccessor(exitBlock);
4779 } 4783 }
4780 4784
4781 // The catch block has either the finally or the exit block as 4785 // The catch block has either the finally or the exit block as
4782 // successor. 4786 // successor.
4783 if (endCatchBlock != null) { 4787 if (endCatchBlock != null) {
4784 endCatchBlock.addSuccessor( 4788 endCatchBlock.addSuccessor(
4785 startFinallyBlock != null ? startFinallyBlock : exitBlock); 4789 startFinallyBlock != null ? startFinallyBlock : exitBlock);
4786 } 4790 }
4787 4791
4788 // The finally block has the exit block as successor. 4792 // The finally block has the exit block as successor.
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
5231 new HSubGraphBlockInformation(elseBranch.graph)); 5235 new HSubGraphBlockInformation(elseBranch.graph));
5232 5236
5233 HBasicBlock conditionStartBlock = conditionBranch.block; 5237 HBasicBlock conditionStartBlock = conditionBranch.block;
5234 conditionStartBlock.setBlockFlow(info, joinBlock); 5238 conditionStartBlock.setBlockFlow(info, joinBlock);
5235 SubGraph conditionGraph = conditionBranch.graph; 5239 SubGraph conditionGraph = conditionBranch.graph;
5236 HIf branch = conditionGraph.end.last; 5240 HIf branch = conditionGraph.end.last;
5237 assert(branch is HIf); 5241 assert(branch is HIf);
5238 branch.blockInformation = conditionStartBlock.blockFlow; 5242 branch.blockInformation = conditionStartBlock.blockFlow;
5239 } 5243 }
5240 } 5244 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/issue9939_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698