| 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 '../compiler.dart'; | 5 import '../compiler.dart'; |
| 6 import '../elements/elements.dart'; | 6 import '../elements/elements.dart'; |
| 7 import '../io/source_information.dart'; |
| 7 import '../js_backend/js_backend.dart'; | 8 import '../js_backend/js_backend.dart'; |
| 8 import '../resolution/tree_elements.dart'; | 9 import '../resolution/tree_elements.dart'; |
| 10 import '../tree/tree.dart' as ast; |
| 9 import '../types/types.dart'; | 11 import '../types/types.dart'; |
| 10 import 'jump_handler.dart'; | 12 import 'jump_handler.dart'; |
| 11 import 'locals_handler.dart'; | 13 import 'locals_handler.dart'; |
| 12 import 'nodes.dart'; | 14 import 'nodes.dart'; |
| 15 import 'ssa_branch_builder.dart'; |
| 13 | 16 |
| 14 /// Base class for objects that build up an SSA graph. | 17 /// Base class for objects that build up an SSA graph. |
| 15 /// | 18 /// |
| 16 /// This contains helpers for building the graph and tracking information about | 19 /// This contains helpers for building the graph and tracking information about |
| 17 /// the current state of the graph being built. | 20 /// the current state of the graph being built. |
| 18 abstract class GraphBuilder { | 21 abstract class GraphBuilder { |
| 19 /// Holds the resulting SSA graph. | 22 /// Holds the resulting SSA graph. |
| 20 final HGraph graph = new HGraph(); | 23 final HGraph graph = new HGraph(); |
| 21 | 24 |
| 22 // TODO(het): remove this | 25 // TODO(het): remove this |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 HParameterValue result = new HParameterValue(parameter, type); | 155 HParameterValue result = new HParameterValue(parameter, type); |
| 153 if (lastAddedParameter == null) { | 156 if (lastAddedParameter == null) { |
| 154 graph.entry.addBefore(graph.entry.first, result); | 157 graph.entry.addBefore(graph.entry.first, result); |
| 155 } else { | 158 } else { |
| 156 graph.entry.addAfter(lastAddedParameter, result); | 159 graph.entry.addAfter(lastAddedParameter, result); |
| 157 } | 160 } |
| 158 lastAddedParameter = result; | 161 lastAddedParameter = result; |
| 159 return result; | 162 return result; |
| 160 } | 163 } |
| 161 | 164 |
| 165 void handleIf( |
| 166 {ast.Node node, |
| 167 void visitCondition(), |
| 168 void visitThen(), |
| 169 void visitElse(), |
| 170 SourceInformation sourceInformation}) { |
| 171 SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this, compiler, node); |
| 172 branchBuilder.handleIf(visitCondition, visitThen, visitElse, |
| 173 sourceInformation: sourceInformation); |
| 174 } |
| 175 |
| 162 HSubGraphBlockInformation wrapStatementGraph(SubGraph statements) { | 176 HSubGraphBlockInformation wrapStatementGraph(SubGraph statements) { |
| 163 if (statements == null) return null; | 177 if (statements == null) return null; |
| 164 return new HSubGraphBlockInformation(statements); | 178 return new HSubGraphBlockInformation(statements); |
| 165 } | 179 } |
| 166 | 180 |
| 167 HSubExpressionBlockInformation wrapExpressionGraph(SubExpression expression) { | 181 HSubExpressionBlockInformation wrapExpressionGraph(SubExpression expression) { |
| 168 if (expression == null) return null; | 182 if (expression == null) return null; |
| 169 return new HSubExpressionBlockInformation(expression); | 183 return new HSubExpressionBlockInformation(expression); |
| 170 } | 184 } |
| 171 } | 185 } |
| OLD | NEW |