| 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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 // If [node] was loop hoisted, we keep the interceptor. | 1522 // If [node] was loop hoisted, we keep the interceptor. |
| 1523 if (!user.hasSameLoopHeaderAs(node)) return; | 1523 if (!user.hasSameLoopHeaderAs(node)) return; |
| 1524 | 1524 |
| 1525 // Replace the user with a [HOneShotInterceptor]. | 1525 // Replace the user with a [HOneShotInterceptor]. |
| 1526 HConstant nullConstant = graph.addConstantNull(constantSystem); | 1526 HConstant nullConstant = graph.addConstantNull(constantSystem); |
| 1527 List<HInstruction> inputs = new List<HInstruction>.from(user.inputs); | 1527 List<HInstruction> inputs = new List<HInstruction>.from(user.inputs); |
| 1528 inputs[0] = nullConstant; | 1528 inputs[0] = nullConstant; |
| 1529 HOneShotInterceptor interceptor = new HOneShotInterceptor( | 1529 HOneShotInterceptor interceptor = new HOneShotInterceptor( |
| 1530 user.selector, inputs, node.interceptedClasses); | 1530 user.selector, inputs, node.interceptedClasses); |
| 1531 interceptor.sourcePosition = user.sourcePosition; | 1531 interceptor.sourcePosition = user.sourcePosition; |
| 1532 interceptor.sourceElement = user.sourceElement; |
| 1532 | 1533 |
| 1533 HBasicBlock block = user.block; | 1534 HBasicBlock block = user.block; |
| 1534 block.addAfter(user, interceptor); | 1535 block.addAfter(user, interceptor); |
| 1535 block.rewrite(user, interceptor); | 1536 block.rewrite(user, interceptor); |
| 1536 block.remove(user); | 1537 block.remove(user); |
| 1537 | 1538 |
| 1538 // The interceptor will be removed in the dead code elimination | 1539 // The interceptor will be removed in the dead code elimination |
| 1539 // phase. Note that removing it here would not work because of how | 1540 // phase. Note that removing it here would not work because of how |
| 1540 // the [visitBasicBlock] is implemented. | 1541 // the [visitBasicBlock] is implemented. |
| 1541 } | 1542 } |
| 1542 } | 1543 } |
| OLD | NEW |