| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
| 8 String get name; | 8 String get name; |
| 9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
| 10 } | 10 } |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 Operation operation = node.specializer.operation(constantSystem); | 261 Operation operation = node.specializer.operation(constantSystem); |
| 262 if (operation != null) { | 262 if (operation != null) { |
| 263 HInstruction instruction = node.inputs.length == 2 | 263 HInstruction instruction = node.inputs.length == 2 |
| 264 ? foldUnary(operation, node.inputs[1]) | 264 ? foldUnary(operation, node.inputs[1]) |
| 265 : foldBinary(operation, node.inputs[1], node.inputs[2]); | 265 : foldBinary(operation, node.inputs[1], node.inputs[2]); |
| 266 if (instruction != null) return instruction; | 266 if (instruction != null) return instruction; |
| 267 } | 267 } |
| 268 | 268 |
| 269 // Try converting the instruction to a builtin instruction. | 269 // Try converting the instruction to a builtin instruction. |
| 270 HInstruction instruction = | 270 HInstruction instruction = |
| 271 node.specializer.tryConvertToBuiltin(node); | 271 node.specializer.tryConvertToBuiltin(node, compiler); |
| 272 if (instruction != null) return instruction; | 272 if (instruction != null) return instruction; |
| 273 | 273 |
| 274 Selector selector = node.selector; | 274 Selector selector = node.selector; |
| 275 HInstruction input = node.inputs[1]; | 275 HInstruction input = node.inputs[1]; |
| 276 | 276 |
| 277 if (selector.isCall()) { | 277 if (selector.isCall()) { |
| 278 Element target; | 278 Element target; |
| 279 if (input.isExtendableArray()) { | 279 if (input.isExtendableArray()) { |
| 280 if (selector.applies(backend.jsArrayRemoveLast, compiler)) { | 280 if (selector.applies(backend.jsArrayRemoveLast, compiler)) { |
| 281 target = backend.jsArrayRemoveLast; | 281 target = backend.jsArrayRemoveLast; |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 HBasicBlock block = user.block; | 1582 HBasicBlock block = user.block; |
| 1583 block.addAfter(user, interceptor); | 1583 block.addAfter(user, interceptor); |
| 1584 block.rewrite(user, interceptor); | 1584 block.rewrite(user, interceptor); |
| 1585 block.remove(user); | 1585 block.remove(user); |
| 1586 | 1586 |
| 1587 // The interceptor will be removed in the dead code elimination | 1587 // The interceptor will be removed in the dead code elimination |
| 1588 // phase. Note that removing it here would not work because of how | 1588 // phase. Note that removing it here would not work because of how |
| 1589 // the [visitBasicBlock] is implemented. | 1589 // the [visitBasicBlock] is implemented. |
| 1590 } | 1590 } |
| 1591 } | 1591 } |
| OLD | NEW |