| 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/generic-node-inl.h" | 5 #include "src/compiler/generic-node-inl.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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 | 892 |
| 893 | 893 |
| 894 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 894 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
| 895 BasicBlock* fbranch) { | 895 BasicBlock* fbranch) { |
| 896 X64OperandGenerator g(this); | 896 X64OperandGenerator g(this); |
| 897 Node* user = branch; | 897 Node* user = branch; |
| 898 Node* value = branch->InputAt(0); | 898 Node* value = branch->InputAt(0); |
| 899 | 899 |
| 900 FlagsContinuation cont(kNotEqual, tbranch, fbranch); | 900 FlagsContinuation cont(kNotEqual, tbranch, fbranch); |
| 901 | 901 |
| 902 // If we can fall through to the true block, invert the branch. | |
| 903 if (IsNextInAssemblyOrder(tbranch)) { | |
| 904 cont.Negate(); | |
| 905 cont.SwapBlocks(); | |
| 906 } | |
| 907 | |
| 908 // Try to combine with comparisons against 0 by simply inverting the branch. | 902 // Try to combine with comparisons against 0 by simply inverting the branch. |
| 909 while (CanCover(user, value)) { | 903 while (CanCover(user, value)) { |
| 910 if (value->opcode() == IrOpcode::kWord32Equal) { | 904 if (value->opcode() == IrOpcode::kWord32Equal) { |
| 911 Int32BinopMatcher m(value); | 905 Int32BinopMatcher m(value); |
| 912 if (m.right().Is(0)) { | 906 if (m.right().Is(0)) { |
| 913 user = value; | 907 user = value; |
| 914 value = m.left().node(); | 908 value = m.left().node(); |
| 915 cont.Negate(); | 909 cont.Negate(); |
| 916 } else { | 910 } else { |
| 917 break; | 911 break; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 return MachineOperatorBuilder::kFloat64Floor | | 1165 return MachineOperatorBuilder::kFloat64Floor | |
| 1172 MachineOperatorBuilder::kFloat64Ceil | | 1166 MachineOperatorBuilder::kFloat64Ceil | |
| 1173 MachineOperatorBuilder::kFloat64RoundTruncate; | 1167 MachineOperatorBuilder::kFloat64RoundTruncate; |
| 1174 } | 1168 } |
| 1175 return MachineOperatorBuilder::kNoFlags; | 1169 return MachineOperatorBuilder::kNoFlags; |
| 1176 } | 1170 } |
| 1177 | 1171 |
| 1178 } // namespace compiler | 1172 } // namespace compiler |
| 1179 } // namespace internal | 1173 } // namespace internal |
| 1180 } // namespace v8 | 1174 } // namespace v8 |
| OLD | NEW |