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