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

Side by Side Diff: frog/leg/ssa/builder.dart

Issue 9363022: Support finally. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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/co19/co19-leg.status » ('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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 visitSwitchStatement(SwitchStatement node) { 1714 visitSwitchStatement(SwitchStatement node) {
1715 compiler.unimplemented('SsaBuilder.visitSwitchStatement', node: node); 1715 compiler.unimplemented('SsaBuilder.visitSwitchStatement', node: node);
1716 } 1716 }
1717 1717
1718 visitTryStatement(TryStatement node) { 1718 visitTryStatement(TryStatement node) {
1719 work.allowSpeculativeOptimization = false; 1719 work.allowSpeculativeOptimization = false;
1720 assert(!work.isBailoutVersion()); 1720 assert(!work.isBailoutVersion());
1721 HBasicBlock enterBlock = graph.addNewBlock(); 1721 HBasicBlock enterBlock = graph.addNewBlock();
1722 close(new HGoto()).addSuccessor(enterBlock); 1722 close(new HGoto()).addSuccessor(enterBlock);
1723 open(enterBlock); 1723 open(enterBlock);
1724 close(new HTry()); 1724 HTry tryInstruction = new HTry();
1725 close(tryInstruction);
1725 1726
1726 HBasicBlock tryBody = graph.addNewBlock(); 1727 HBasicBlock tryBody = graph.addNewBlock();
1727 enterBlock.addSuccessor(tryBody); 1728 enterBlock.addSuccessor(tryBody);
1728 open(tryBody); 1729 open(tryBody);
1729 visit(node.tryBlock); 1730 visit(node.tryBlock);
1730 HBasicBlock endTryBody; 1731 List<HBasicBlock> blocks = <HBasicBlock>[];
1731 if (!isAborted()) endTryBody = close(new HGoto()); 1732 if (!isAborted()) blocks.add(close(new HGoto()));
1732 1733
1733 List<HBasicBlock> catchBlocks = <HBasicBlock>[];
1734 int catchBlocksCount = 0; 1734 int catchBlocksCount = 0;
1735 for (CatchBlock catchBlock in node.catchBlocks.nodes) { 1735 for (CatchBlock catchBlock in node.catchBlocks.nodes) {
1736 if (++catchBlocksCount != 1) { 1736 if (++catchBlocksCount != 1) {
1737 compiler.unimplemented('SsaBuilder multiple catch blocks', node: node); 1737 compiler.unimplemented('SsaBuilder multiple catch blocks', node: node);
1738 } 1738 }
1739 HBasicBlock block = graph.addNewBlock(); 1739 HBasicBlock block = graph.addNewBlock();
1740 enterBlock.addSuccessor(block); 1740 enterBlock.addSuccessor(block);
1741 open(block); 1741 open(block);
1742 visit(catchBlock); 1742 visit(catchBlock);
1743 if (!isAborted()) { 1743 if (!isAborted()) blocks.add(close(new HGoto()));
1744 close(new HGoto());
1745 catchBlocks.add(block);
1746 }
1747 }
1748
1749 HBasicBlock exitBlock = graph.addNewBlock();
1750
1751 if (endTryBody != null) {
1752 endTryBody.addSuccessor(exitBlock);
1753 }
1754
1755 for (HBasicBlock block in catchBlocks) {
1756 block.addSuccessor(exitBlock);
1757 } 1744 }
1758 1745
1759 if (node.finallyBlock != null) { 1746 if (node.finallyBlock != null) {
1760 compiler.unimplemented('SsaBuilder finally block', node: node); 1747 HBasicBlock finallyBlock = graph.addNewBlock();
1748 enterBlock.addSuccessor(finallyBlock);
1749 open(finallyBlock);
1750 visit(node.finallyBlock);
1751 if (!isAborted()) blocks.add(close(new HGoto()));
1752 tryInstruction.finallyBlock = finallyBlock;
1761 } 1753 }
1762 1754
1763 open(exitBlock); 1755 // If no block is going to an exit block, the Dart code after the
1756 // try is dead code.
1757 if (!blocks.isEmpty()) {
1758 HBasicBlock exitBlock = graph.addNewBlock();
1759
1760 for (HBasicBlock block in blocks) {
1761 block.addSuccessor(exitBlock);
1762 }
1763
1764 open(exitBlock);
1765 }
1764 } 1766 }
1765 1767
1766 visitScriptTag(ScriptTag node) { 1768 visitScriptTag(ScriptTag node) {
1767 compiler.unimplemented('SsaBuilder.visitScriptTag', node: node); 1769 compiler.unimplemented('SsaBuilder.visitScriptTag', node: node);
1768 } 1770 }
1769 1771
1770 visitCatchBlock(CatchBlock node) { 1772 visitCatchBlock(CatchBlock node) {
1771 NodeList formals = node.formals; 1773 NodeList formals = node.formals;
1772 VariableDefinitions exception = formals.nodes.head; 1774 VariableDefinitions exception = formals.nodes.head;
1773 if (exception.type != null) { 1775 if (exception.type != null) {
1774 compiler.unimplemented('SsaBuilder catch with type', node: node); 1776 compiler.unimplemented('SsaBuilder catch with type', node: node);
1775 } 1777 }
1776 visit(node.block); 1778 visit(node.block);
1777 } 1779 }
1778 1780
1779 visitTypedef(Typedef node) { 1781 visitTypedef(Typedef node) {
1780 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); 1782 compiler.unimplemented('SsaBuilder.visitTypedef', node: node);
1781 } 1783 }
1782 } 1784 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698