OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/control-reducer.h" | 6 #include "src/compiler/control-reducer.h" |
7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/node-marker.h" | 9 #include "src/compiler/node-marker.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 540 } |
541 | 541 |
542 DCHECK_EQ(live, node->InputCount()); | 542 DCHECK_EQ(live, node->InputCount()); |
543 | 543 |
544 // Check if it's an unused diamond. | 544 // Check if it's an unused diamond. |
545 if (live == 2 && phis.empty()) { | 545 if (live == 2 && phis.empty()) { |
546 Node* node0 = node->InputAt(0); | 546 Node* node0 = node->InputAt(0); |
547 Node* node1 = node->InputAt(1); | 547 Node* node1 = node->InputAt(1); |
548 if (((node0->opcode() == IrOpcode::kIfTrue && | 548 if (((node0->opcode() == IrOpcode::kIfTrue && |
549 node1->opcode() == IrOpcode::kIfFalse) || | 549 node1->opcode() == IrOpcode::kIfFalse) || |
550 (node0->opcode() == IrOpcode::kIfTrue && | 550 (node1->opcode() == IrOpcode::kIfTrue && |
551 node1->opcode() == IrOpcode::kIfFalse)) && | 551 node0->opcode() == IrOpcode::kIfFalse)) && |
552 node0->OwnedBy(node) && node1->OwnedBy(node)) { | 552 node0->OwnedBy(node) && node1->OwnedBy(node)) { |
553 Node* branch0 = NodeProperties::GetControlInput(node0); | 553 Node* branch0 = NodeProperties::GetControlInput(node0); |
554 Node* branch1 = NodeProperties::GetControlInput(node1); | 554 Node* branch1 = NodeProperties::GetControlInput(node1); |
555 if (branch0 == branch1) { | 555 if (branch0 == branch1) { |
556 // It's a dead diamond, i.e. neither the IfTrue nor the IfFalse nodes | 556 // It's a dead diamond, i.e. neither the IfTrue nor the IfFalse nodes |
557 // have users except for the Merge and the Merge has no Phi or | 557 // have users except for the Merge and the Merge has no Phi or |
558 // EffectPhi uses, so replace the Merge with the control input of the | 558 // EffectPhi uses, so replace the Merge with the control input of the |
559 // diamond. | 559 // diamond. |
560 TRACE((" DeadDiamond: #%d:%s #%d:%s #%d:%s\n", node0->id(), | 560 TRACE((" DeadDiamond: #%d:%s #%d:%s #%d:%s\n", node0->id(), |
561 node0->op()->mnemonic(), node1->id(), node1->op()->mnemonic(), | 561 node0->op()->mnemonic(), node1->id(), node1->op()->mnemonic(), |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 return impl.ReduceIfTrue(node); | 677 return impl.ReduceIfTrue(node); |
678 case IrOpcode::kIfFalse: | 678 case IrOpcode::kIfFalse: |
679 return impl.ReduceIfFalse(node); | 679 return impl.ReduceIfFalse(node); |
680 default: | 680 default: |
681 return node; | 681 return node; |
682 } | 682 } |
683 } | 683 } |
684 } | 684 } |
685 } | 685 } |
686 } // namespace v8::internal::compiler | 686 } // namespace v8::internal::compiler |
OLD | NEW |