| 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 var interceptor = node.inputs[0]; | 275 var interceptor = node.inputs[0]; |
| 276 HInstruction input = node.inputs[1]; | 276 HInstruction input = node.inputs[1]; |
| 277 | 277 |
| 278 if (selector.isCall()) { | 278 if (selector.isCall()) { |
| 279 Element target; | 279 Element target; |
| 280 if (input.isExtendableArray()) { | 280 if (input.isExtendableArray()) { |
| 281 if (selector.applies(backend.jsArrayRemoveLast, compiler)) { | 281 if (selector.applies(backend.jsArrayRemoveLast, compiler)) { |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 HBasicBlock block = user.block; | 1563 HBasicBlock block = user.block; |
| 1564 block.addAfter(user, interceptor); | 1564 block.addAfter(user, interceptor); |
| 1565 block.rewrite(user, interceptor); | 1565 block.rewrite(user, interceptor); |
| 1566 block.remove(user); | 1566 block.remove(user); |
| 1567 | 1567 |
| 1568 // The interceptor will be removed in the dead code elimination | 1568 // The interceptor will be removed in the dead code elimination |
| 1569 // phase. Note that removing it here would not work because of how | 1569 // phase. Note that removing it here would not work because of how |
| 1570 // the [visitBasicBlock] is implemented. | 1570 // the [visitBasicBlock] is implemented. |
| 1571 } | 1571 } |
| 1572 } | 1572 } |
| OLD | NEW |