| 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/base/bits.h" | 5 #include "src/base/bits.h" |
| 6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
| 7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 } else { | 627 } else { |
| 628 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, | 628 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, |
| 629 g.TempImmediate(0)); | 629 g.TempImmediate(0)); |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 | 632 |
| 633 | 633 |
| 634 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 634 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
| 635 BasicBlock* fbranch) { | 635 BasicBlock* fbranch) { |
| 636 FlagsContinuation cont(kNotEqual, tbranch, fbranch); | 636 FlagsContinuation cont(kNotEqual, tbranch, fbranch); |
| 637 // If we can fall through to the true block, invert the branch. | |
| 638 if (IsNextInAssemblyOrder(tbranch)) { | |
| 639 cont.Negate(); | |
| 640 cont.SwapBlocks(); | |
| 641 } | |
| 642 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); | 637 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); |
| 643 } | 638 } |
| 644 | 639 |
| 645 | 640 |
| 646 void InstructionSelector::VisitWord32Equal(Node* const node) { | 641 void InstructionSelector::VisitWord32Equal(Node* const node) { |
| 647 FlagsContinuation cont(kEqual, node); | 642 FlagsContinuation cont(kEqual, node); |
| 648 Int32BinopMatcher m(node); | 643 Int32BinopMatcher m(node); |
| 649 if (m.right().Is(0)) { | 644 if (m.right().Is(0)) { |
| 650 return VisitWordCompareZero(this, m.node(), m.left().node(), &cont); | 645 return VisitWordCompareZero(this, m.node(), m.left().node(), &cont); |
| 651 } | 646 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 | 712 |
| 718 // static | 713 // static |
| 719 MachineOperatorBuilder::Flags | 714 MachineOperatorBuilder::Flags |
| 720 InstructionSelector::SupportedMachineOperatorFlags() { | 715 InstructionSelector::SupportedMachineOperatorFlags() { |
| 721 return MachineOperatorBuilder::kNoFlags; | 716 return MachineOperatorBuilder::kNoFlags; |
| 722 } | 717 } |
| 723 | 718 |
| 724 } // namespace compiler | 719 } // namespace compiler |
| 725 } // namespace internal | 720 } // namespace internal |
| 726 } // namespace v8 | 721 } // namespace v8 |
| OLD | NEW |