| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import '../common.dart'; | 5 import '../common.dart'; |
| 6 import '../io/source_information.dart'; | 6 import '../io/source_information.dart'; |
| 7 | 7 |
| 8 import 'graph_builder.dart'; | 8 import 'graph_builder.dart'; |
| 9 import 'locals_handler.dart'; | 9 import 'locals_handler.dart'; |
| 10 import 'nodes.dart'; | 10 import 'nodes.dart'; |
| 11 | 11 |
| 12 class SsaBranch { | 12 class SsaBranch { |
| 13 final SsaBranchBuilder branchBuilder; | 13 final SsaBranchBuilder branchBuilder; |
| 14 final HBasicBlock block; | 14 final HBasicBlock block; |
| 15 LocalsHandler startLocals; | 15 LocalsHandler startLocals; |
| 16 LocalsHandler exitLocals; | 16 LocalsHandler exitLocals; |
| 17 SubGraph graph; | 17 SubGraph graph; |
| 18 | 18 |
| 19 SsaBranch(this.branchBuilder) : block = new HBasicBlock(); | 19 SsaBranch(this.branchBuilder) : block = new HBasicBlock(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 class SsaBranchBuilder { | 22 class SsaBranchBuilder { |
| 23 final GraphBuilder builder; | 23 final GraphBuilder builder; |
| 24 final Spannable diagnosticNode; | 24 final Spannable diagnosticNode; |
| 25 | 25 |
| 26 SsaBranchBuilder(this.builder, [this.diagnosticNode]); | 26 SsaBranchBuilder(this.builder, [this.diagnosticNode]); |
| 27 | 27 |
| 28 void checkNotAborted() { | 28 void checkNotAborted() { |
| 29 if (builder.isAborted()) { | 29 if (builder.isAborted()) { |
| 30 throw new SpannableAssertionFailure( | 30 failedAt(diagnosticNode, "aborted control flow"); |
| 31 diagnosticNode, "aborted control flow"); | |
| 32 } | 31 } |
| 33 } | 32 } |
| 34 | 33 |
| 35 void buildCondition( | 34 void buildCondition( |
| 36 void visitCondition(), | 35 void visitCondition(), |
| 37 SsaBranch conditionBranch, | 36 SsaBranch conditionBranch, |
| 38 SsaBranch thenBranch, | 37 SsaBranch thenBranch, |
| 39 SsaBranch elseBranch, | 38 SsaBranch elseBranch, |
| 40 SourceInformation sourceInformation) { | 39 SourceInformation sourceInformation) { |
| 41 startBranch(conditionBranch); | 40 startBranch(conditionBranch); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 new HSubGraphBlockInformation(elseBranch.graph)); | 217 new HSubGraphBlockInformation(elseBranch.graph)); |
| 219 | 218 |
| 220 HBasicBlock conditionStartBlock = conditionBranch.block; | 219 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 221 conditionStartBlock.setBlockFlow(info, joinBlock); | 220 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 222 SubGraph conditionGraph = conditionBranch.graph; | 221 SubGraph conditionGraph = conditionBranch.graph; |
| 223 HIf branch = conditionGraph.end.last; | 222 HIf branch = conditionGraph.end.last; |
| 224 assert(branch is HIf); | 223 assert(branch is HIf); |
| 225 branch.blockInformation = conditionStartBlock.blockFlow; | 224 branch.blockInformation = conditionStartBlock.blockFlow; |
| 226 } | 225 } |
| 227 } | 226 } |
| OLD | NEW |