| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 // in the remaining optimizations. | 432 // in the remaining optimizations. |
| 433 return super.visitRelational(node); | 433 return super.visitRelational(node); |
| 434 } | 434 } |
| 435 | 435 |
| 436 HInstruction handleIdentityCheck(HRelational node) { | 436 HInstruction handleIdentityCheck(HRelational node) { |
| 437 HInstruction left = node.left; | 437 HInstruction left = node.left; |
| 438 HInstruction right = node.right; | 438 HInstruction right = node.right; |
| 439 HType leftType = left.instructionType; | 439 HType leftType = left.instructionType; |
| 440 HType rightType = right.instructionType; | 440 HType rightType = right.instructionType; |
| 441 | 441 |
| 442 // We don't optimize on numbers to preserve the runtime semantics. | 442 // Intersection of int and double return conflicting, so |
| 443 // we don't optimize on numbers to preserve the runtime semantics. |
| 443 if (!(left.isNumberOrNull() && right.isNumberOrNull()) && | 444 if (!(left.isNumberOrNull() && right.isNumberOrNull()) && |
| 444 leftType.intersection(rightType, compiler).isConflicting()) { | 445 leftType.intersection(rightType, compiler).isConflicting()) { |
| 445 return graph.addConstantBool(false, constantSystem); | 446 return graph.addConstantBool(false, constantSystem); |
| 446 } | 447 } |
| 447 | 448 |
| 448 if (left.isConstantBoolean() && right.isBoolean()) { | 449 if (left.isConstantBoolean() && right.isBoolean()) { |
| 449 HConstant constant = left; | 450 HConstant constant = left; |
| 450 if (constant.constant.isTrue()) { | 451 if (constant.constant.isTrue()) { |
| 451 return right; | 452 return right; |
| 452 } else { | 453 } else { |
| (...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 HBasicBlock block = user.block; | 1543 HBasicBlock block = user.block; |
| 1543 block.addAfter(user, interceptor); | 1544 block.addAfter(user, interceptor); |
| 1544 block.rewrite(user, interceptor); | 1545 block.rewrite(user, interceptor); |
| 1545 block.remove(user); | 1546 block.remove(user); |
| 1546 | 1547 |
| 1547 // The interceptor will be removed in the dead code elimination | 1548 // The interceptor will be removed in the dead code elimination |
| 1548 // phase. Note that removing it here would not work because of how | 1549 // phase. Note that removing it here would not work because of how |
| 1549 // the [visitBasicBlock] is implemented. | 1550 // the [visitBasicBlock] is implemented. |
| 1550 } | 1551 } |
| 1551 } | 1552 } |
| OLD | NEW |