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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "src/base/adapters.h" | 7 #include "src/base/adapters.h" |
8 #include "src/compiler/instruction-selector-impl.h" | 8 #include "src/compiler/instruction-selector-impl.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 return VisitCompare(selector, opcode, g.Use(left), g.UseImmediate(right), | 1768 return VisitCompare(selector, opcode, g.Use(left), g.UseImmediate(right), |
1769 cont); | 1769 cont); |
1770 } | 1770 } |
1771 | 1771 |
1772 // Match memory operands on left side of comparison. | 1772 // Match memory operands on left side of comparison. |
1773 if (g.CanBeMemoryOperand(opcode, node, left, effect_level)) { | 1773 if (g.CanBeMemoryOperand(opcode, node, left, effect_level)) { |
1774 return VisitCompareWithMemoryOperand(selector, opcode, left, | 1774 return VisitCompareWithMemoryOperand(selector, opcode, left, |
1775 g.UseRegister(right), cont); | 1775 g.UseRegister(right), cont); |
1776 } | 1776 } |
1777 | 1777 |
1778 if (g.CanBeBetterLeftOperand(right)) { | |
1779 if (!node->op()->HasProperty(Operator::kCommutative)) cont->Commute(); | |
1780 std::swap(left, right); | |
1781 } | |
1782 | |
1783 return VisitCompare(selector, opcode, left, right, cont, | 1778 return VisitCompare(selector, opcode, left, right, cont, |
1784 node->op()->HasProperty(Operator::kCommutative)); | 1779 node->op()->HasProperty(Operator::kCommutative)); |
1785 } | 1780 } |
1786 | 1781 |
1787 // Shared routine for 64-bit word comparison operations. | 1782 // Shared routine for 64-bit word comparison operations. |
1788 void VisitWord64Compare(InstructionSelector* selector, Node* node, | 1783 void VisitWord64Compare(InstructionSelector* selector, Node* node, |
1789 FlagsContinuation* cont) { | 1784 FlagsContinuation* cont) { |
1790 X64OperandGenerator g(selector); | 1785 X64OperandGenerator g(selector); |
1791 if (selector->CanUseRootsRegister()) { | 1786 if (selector->CanUseRootsRegister()) { |
1792 Heap* const heap = selector->isolate()->heap(); | 1787 Heap* const heap = selector->isolate()->heap(); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 // static | 2372 // static |
2378 MachineOperatorBuilder::AlignmentRequirements | 2373 MachineOperatorBuilder::AlignmentRequirements |
2379 InstructionSelector::AlignmentRequirements() { | 2374 InstructionSelector::AlignmentRequirements() { |
2380 return MachineOperatorBuilder::AlignmentRequirements:: | 2375 return MachineOperatorBuilder::AlignmentRequirements:: |
2381 FullUnalignedAccessSupport(); | 2376 FullUnalignedAccessSupport(); |
2382 } | 2377 } |
2383 | 2378 |
2384 } // namespace compiler | 2379 } // namespace compiler |
2385 } // namespace internal | 2380 } // namespace internal |
2386 } // namespace v8 | 2381 } // namespace v8 |
OLD | NEW |