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/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 | 1113 |
1114 | 1114 |
1115 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 1115 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
1116 BasicBlock* fbranch) { | 1116 BasicBlock* fbranch) { |
1117 OperandGenerator g(this); | 1117 OperandGenerator g(this); |
1118 Node* user = branch; | 1118 Node* user = branch; |
1119 Node* value = branch->InputAt(0); | 1119 Node* value = branch->InputAt(0); |
1120 | 1120 |
1121 FlagsContinuation cont(kNotEqual, tbranch, fbranch); | 1121 FlagsContinuation cont(kNotEqual, tbranch, fbranch); |
1122 | 1122 |
1123 // If we can fall through to the true block, invert the branch. | |
1124 if (IsNextInAssemblyOrder(tbranch)) { | |
1125 cont.Negate(); | |
1126 cont.SwapBlocks(); | |
1127 } | |
1128 | |
1129 // Try to combine with comparisons against 0 by simply inverting the branch. | 1123 // Try to combine with comparisons against 0 by simply inverting the branch. |
1130 while (CanCover(user, value)) { | 1124 while (CanCover(user, value)) { |
1131 if (value->opcode() == IrOpcode::kWord32Equal) { | 1125 if (value->opcode() == IrOpcode::kWord32Equal) { |
1132 Int32BinopMatcher m(value); | 1126 Int32BinopMatcher m(value); |
1133 if (m.right().Is(0)) { | 1127 if (m.right().Is(0)) { |
1134 user = value; | 1128 user = value; |
1135 value = m.left().node(); | 1129 value = m.left().node(); |
1136 cont.Negate(); | 1130 cont.Negate(); |
1137 } else { | 1131 } else { |
1138 break; | 1132 break; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 MachineOperatorBuilder::Flags | 1406 MachineOperatorBuilder::Flags |
1413 InstructionSelector::SupportedMachineOperatorFlags() { | 1407 InstructionSelector::SupportedMachineOperatorFlags() { |
1414 return MachineOperatorBuilder::kFloat64Floor | | 1408 return MachineOperatorBuilder::kFloat64Floor | |
1415 MachineOperatorBuilder::kFloat64Ceil | | 1409 MachineOperatorBuilder::kFloat64Ceil | |
1416 MachineOperatorBuilder::kFloat64RoundTruncate | | 1410 MachineOperatorBuilder::kFloat64RoundTruncate | |
1417 MachineOperatorBuilder::kFloat64RoundTiesAway; | 1411 MachineOperatorBuilder::kFloat64RoundTiesAway; |
1418 } | 1412 } |
1419 } // namespace compiler | 1413 } // namespace compiler |
1420 } // namespace internal | 1414 } // namespace internal |
1421 } // namespace v8 | 1415 } // namespace v8 |
OLD | NEW |