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 } | 1768 } |
1769 | 1769 |
1770 return VisitCompare(selector, opcode, left, right, cont, | 1770 return VisitCompare(selector, opcode, left, right, cont, |
1771 node->op()->HasProperty(Operator::kCommutative)); | 1771 node->op()->HasProperty(Operator::kCommutative)); |
1772 } | 1772 } |
1773 | 1773 |
1774 // Shared routine for 64-bit word comparison operations. | 1774 // Shared routine for 64-bit word comparison operations. |
1775 void VisitWord64Compare(InstructionSelector* selector, Node* node, | 1775 void VisitWord64Compare(InstructionSelector* selector, Node* node, |
1776 FlagsContinuation* cont) { | 1776 FlagsContinuation* cont) { |
1777 X64OperandGenerator g(selector); | 1777 X64OperandGenerator g(selector); |
| 1778 if (selector->CanUseRootsRegister()) { |
| 1779 Heap* const heap = selector->isolate()->heap(); |
| 1780 Heap::RootListIndex root_index; |
| 1781 HeapObjectBinopMatcher m(node); |
| 1782 if (m.right().HasValue() && |
| 1783 heap->IsRootHandle(m.right().Value(), &root_index)) { |
| 1784 if (!node->op()->HasProperty(Operator::kCommutative)) cont->Commute(); |
| 1785 InstructionCode opcode = |
| 1786 kX64Cmp | AddressingModeField::encode(kMode_Root); |
| 1787 return VisitCompare( |
| 1788 selector, opcode, |
| 1789 g.TempImmediate((root_index * kPointerSize) - kRootRegisterBias), |
| 1790 g.UseRegister(m.left().node()), cont); |
| 1791 } else if (m.left().HasValue() && |
| 1792 heap->IsRootHandle(m.left().Value(), &root_index)) { |
| 1793 InstructionCode opcode = |
| 1794 kX64Cmp | AddressingModeField::encode(kMode_Root); |
| 1795 return VisitCompare( |
| 1796 selector, opcode, |
| 1797 g.TempImmediate((root_index * kPointerSize) - kRootRegisterBias), |
| 1798 g.UseRegister(m.right().node()), cont); |
| 1799 } |
| 1800 } |
1778 Int64BinopMatcher m(node); | 1801 Int64BinopMatcher m(node); |
1779 if (m.left().IsLoad() && m.right().IsLoadStackPointer()) { | 1802 if (m.left().IsLoad() && m.right().IsLoadStackPointer()) { |
1780 LoadMatcher<ExternalReferenceMatcher> mleft(m.left().node()); | 1803 LoadMatcher<ExternalReferenceMatcher> mleft(m.left().node()); |
1781 ExternalReference js_stack_limit = | 1804 ExternalReference js_stack_limit = |
1782 ExternalReference::address_of_stack_limit(selector->isolate()); | 1805 ExternalReference::address_of_stack_limit(selector->isolate()); |
1783 if (mleft.object().Is(js_stack_limit) && mleft.index().Is(0)) { | 1806 if (mleft.object().Is(js_stack_limit) && mleft.index().Is(0)) { |
1784 // Compare(Load(js_stack_limit), LoadStackPointer) | 1807 // Compare(Load(js_stack_limit), LoadStackPointer) |
1785 if (!node->op()->HasProperty(Operator::kCommutative)) cont->Commute(); | 1808 if (!node->op()->HasProperty(Operator::kCommutative)) cont->Commute(); |
1786 InstructionCode opcode = cont->Encode(kX64StackCheck); | 1809 InstructionCode opcode = cont->Encode(kX64StackCheck); |
1787 if (cont->IsBranch()) { | 1810 if (cont->IsBranch()) { |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 // static | 2333 // static |
2311 MachineOperatorBuilder::AlignmentRequirements | 2334 MachineOperatorBuilder::AlignmentRequirements |
2312 InstructionSelector::AlignmentRequirements() { | 2335 InstructionSelector::AlignmentRequirements() { |
2313 return MachineOperatorBuilder::AlignmentRequirements:: | 2336 return MachineOperatorBuilder::AlignmentRequirements:: |
2314 FullUnalignedAccessSupport(); | 2337 FullUnalignedAccessSupport(); |
2315 } | 2338 } |
2316 | 2339 |
2317 } // namespace compiler | 2340 } // namespace compiler |
2318 } // namespace internal | 2341 } // namespace internal |
2319 } // namespace v8 | 2342 } // namespace v8 |
OLD | NEW |