| 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 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 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2002 compiler.unimplemented('SsaBuilder.visitSwitchStatement', node: node); | 2002 compiler.unimplemented('SsaBuilder.visitSwitchStatement', node: node); |
| 2003 } | 2003 } |
| 2004 | 2004 |
| 2005 visitTryStatement(TryStatement node) { | 2005 visitTryStatement(TryStatement node) { |
| 2006 work.allowSpeculativeOptimization = false; | 2006 work.allowSpeculativeOptimization = false; |
| 2007 assert(!work.isBailoutVersion()); | 2007 assert(!work.isBailoutVersion()); |
| 2008 HBasicBlock enterBlock = graph.addNewBlock(); | 2008 HBasicBlock enterBlock = graph.addNewBlock(); |
| 2009 close(new HGoto()).addSuccessor(enterBlock); | 2009 close(new HGoto()).addSuccessor(enterBlock); |
| 2010 open(enterBlock); | 2010 open(enterBlock); |
| 2011 HTry tryInstruction = new HTry(); | 2011 HTry tryInstruction = new HTry(); |
| 2012 close(tryInstruction); | 2012 List<HBasicBlock> blocks = <HBasicBlock>[]; |
| 2013 blocks.add(close(tryInstruction)); |
| 2013 | 2014 |
| 2014 HBasicBlock tryBody = graph.addNewBlock(); | 2015 HBasicBlock tryBody = graph.addNewBlock(); |
| 2015 enterBlock.addSuccessor(tryBody); | 2016 enterBlock.addSuccessor(tryBody); |
| 2016 open(tryBody); | 2017 open(tryBody); |
| 2017 visit(node.tryBlock); | 2018 visit(node.tryBlock); |
| 2018 List<HBasicBlock> blocks = <HBasicBlock>[]; | |
| 2019 if (!isAborted()) blocks.add(close(new HGoto())); | 2019 if (!isAborted()) blocks.add(close(new HGoto())); |
| 2020 | 2020 |
| 2021 if (!node.catchBlocks.isEmpty()) { | 2021 if (!node.catchBlocks.isEmpty()) { |
| 2022 HBasicBlock block = graph.addNewBlock(); | 2022 HBasicBlock block = graph.addNewBlock(); |
| 2023 enterBlock.addSuccessor(block); | 2023 enterBlock.addSuccessor(block); |
| 2024 open(block); | 2024 open(block); |
| 2025 // Note that the name of this element is irrelevant. | 2025 // Note that the name of this element is irrelevant. |
| 2026 Element element = new Element( | 2026 Element element = new Element( |
| 2027 const SourceString('exception'), ElementKind.PARAMETER, work.element); | 2027 const SourceString('exception'), ElementKind.PARAMETER, work.element); |
| 2028 HParameterValue exception = new HParameterValue(element); | 2028 HParameterValue exception = new HParameterValue(element); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 | 2072 |
| 2073 if (node.finallyBlock != null) { | 2073 if (node.finallyBlock != null) { |
| 2074 HBasicBlock finallyBlock = graph.addNewBlock(); | 2074 HBasicBlock finallyBlock = graph.addNewBlock(); |
| 2075 enterBlock.addSuccessor(finallyBlock); | 2075 enterBlock.addSuccessor(finallyBlock); |
| 2076 open(finallyBlock); | 2076 open(finallyBlock); |
| 2077 visit(node.finallyBlock); | 2077 visit(node.finallyBlock); |
| 2078 if (!isAborted()) blocks.add(close(new HGoto())); | 2078 if (!isAborted()) blocks.add(close(new HGoto())); |
| 2079 tryInstruction.finallyBlock = finallyBlock; | 2079 tryInstruction.finallyBlock = finallyBlock; |
| 2080 } | 2080 } |
| 2081 | 2081 |
| 2082 // If no block is going to an exit block, the Dart code after the | 2082 HBasicBlock exitBlock = graph.addNewBlock(); |
| 2083 // try is dead code. | |
| 2084 if (!blocks.isEmpty()) { | |
| 2085 HBasicBlock exitBlock = graph.addNewBlock(); | |
| 2086 | 2083 |
| 2087 for (HBasicBlock block in blocks) { | 2084 for (HBasicBlock block in blocks) { |
| 2088 block.addSuccessor(exitBlock); | 2085 block.addSuccessor(exitBlock); |
| 2089 } | 2086 } |
| 2090 | 2087 |
| 2091 open(exitBlock); | 2088 open(exitBlock); |
| 2092 } | |
| 2093 } | 2089 } |
| 2094 | 2090 |
| 2095 visitScriptTag(ScriptTag node) { | 2091 visitScriptTag(ScriptTag node) { |
| 2096 compiler.unimplemented('SsaBuilder.visitScriptTag', node: node); | 2092 compiler.unimplemented('SsaBuilder.visitScriptTag', node: node); |
| 2097 } | 2093 } |
| 2098 | 2094 |
| 2099 visitCatchBlock(CatchBlock node) { | 2095 visitCatchBlock(CatchBlock node) { |
| 2100 visit(node.block); | 2096 visit(node.block); |
| 2101 } | 2097 } |
| 2102 | 2098 |
| 2103 visitTypedef(Typedef node) { | 2099 visitTypedef(Typedef node) { |
| 2104 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 2100 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 2105 } | 2101 } |
| 2106 } | 2102 } |
| OLD | NEW |