| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 tree_ir.optimization; | 5 part of tree_ir.optimization; |
| 6 | 6 |
| 7 /// Eliminates moving assignments, such as w := v, by assigning directly to w | 7 /// Eliminates moving assignments, such as w := v, by assigning directly to w |
| 8 /// at the definition of v. | 8 /// at the definition of v. |
| 9 /// | 9 /// |
| 10 /// This compensates for suboptimal register allocation, and merges closure | 10 /// This compensates for suboptimal register allocation, and merges closure |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 Statement visitWhileTrue(WhileTrue node) { | 204 Statement visitWhileTrue(WhileTrue node) { |
| 205 node.body = visitBasicBlock(node.body); | 205 node.body = visitBasicBlock(node.body); |
| 206 return node; | 206 return node; |
| 207 } | 207 } |
| 208 | 208 |
| 209 Statement visitWhileCondition(WhileCondition node) { | 209 Statement visitWhileCondition(WhileCondition node) { |
| 210 throw "WhileCondition before LoopRewriter"; | 210 throw "WhileCondition before LoopRewriter"; |
| 211 } | 211 } |
| 212 | 212 |
| 213 Statement visitTry(Try node) { |
| 214 node.tryBody = visitBasicBlock(node.tryBody); |
| 215 node.catchBody = visitBasicBlock(node.catchBody); |
| 216 return node; |
| 217 } |
| 218 |
| 213 Statement visitFunctionDeclaration(FunctionDeclaration node) { | 219 Statement visitFunctionDeclaration(FunctionDeclaration node) { |
| 214 // Unlike var declarations, function declarations are not hoisted, so we | 220 // Unlike var declarations, function declarations are not hoisted, so we |
| 215 // can't do copy propagation of the variable. | 221 // can't do copy propagation of the variable. |
| 216 new CopyPropagator().rewrite(node.definition); | 222 new CopyPropagator().rewrite(node.definition); |
| 217 node.next = visitStatement(node.next); | 223 node.next = visitStatement(node.next); |
| 218 return node; | 224 return node; |
| 219 } | 225 } |
| 220 | 226 |
| 221 Statement visitExpressionStatement(ExpressionStatement node) { | 227 Statement visitExpressionStatement(ExpressionStatement node) { |
| 222 node.next = visitStatement(node.next); | 228 node.next = visitStatement(node.next); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 233 | 239 |
| 234 void visitFunctionExpression(FunctionExpression node) { | 240 void visitFunctionExpression(FunctionExpression node) { |
| 235 new CopyPropagator().rewrite(node.definition); | 241 new CopyPropagator().rewrite(node.definition); |
| 236 } | 242 } |
| 237 | 243 |
| 238 void visitFieldInitializer(FieldInitializer node) { | 244 void visitFieldInitializer(FieldInitializer node) { |
| 239 visitStatement(node.body); | 245 visitStatement(node.body); |
| 240 } | 246 } |
| 241 | 247 |
| 242 } | 248 } |
| OLD | NEW |