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 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Shift operations only observe the bottom 5 or 6 bits of the value. | 116 // Shift operations only observe the bottom 5 or 6 bits of the value. |
117 // All possible shifts can be encoded by discarding bits which have no | 117 // All possible shifts can be encoded by discarding bits which have no |
118 // effect. | 118 // effect. |
119 return true; | 119 return true; |
120 } | 120 } |
121 return false; | 121 return false; |
122 } | 122 } |
123 | 123 |
124 bool CanBeLoadStoreShiftImmediate(Node* node, MachineRepresentation rep) { | 124 bool CanBeLoadStoreShiftImmediate(Node* node, MachineRepresentation rep) { |
125 // TODO(arm64): Load and Store on 128 bit Q registers is not supported yet. | 125 // TODO(arm64): Load and Store on 128 bit Q registers is not supported yet. |
126 DCHECK_NE(MachineRepresentation::kSimd128, rep); | 126 DCHECK_GT(MachineRepresentation::kSimd128, rep); |
127 return IsIntegerConstant(node) && | 127 return IsIntegerConstant(node) && |
128 (GetIntegerConstantValue(node) == ElementSizeLog2Of(rep)); | 128 (GetIntegerConstantValue(node) == ElementSizeLog2Of(rep)); |
129 } | 129 } |
130 | 130 |
131 private: | 131 private: |
132 bool IsLoadStoreImmediate(int64_t value, LSDataSize size) { | 132 bool IsLoadStoreImmediate(int64_t value, LSDataSize size) { |
133 return Assembler::IsImmLSScaled(value, size) || | 133 return Assembler::IsImmLSScaled(value, size) || |
134 Assembler::IsImmLSUnscaled(value); | 134 Assembler::IsImmLSUnscaled(value); |
135 } | 135 } |
136 }; | 136 }; |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 immediate_mode = kLoadStoreImm32; | 586 immediate_mode = kLoadStoreImm32; |
587 break; | 587 break; |
588 case MachineRepresentation::kTaggedSigned: // Fall through. | 588 case MachineRepresentation::kTaggedSigned: // Fall through. |
589 case MachineRepresentation::kTaggedPointer: // Fall through. | 589 case MachineRepresentation::kTaggedPointer: // Fall through. |
590 case MachineRepresentation::kTagged: // Fall through. | 590 case MachineRepresentation::kTagged: // Fall through. |
591 case MachineRepresentation::kWord64: | 591 case MachineRepresentation::kWord64: |
592 opcode = kArm64Ldr; | 592 opcode = kArm64Ldr; |
593 immediate_mode = kLoadStoreImm64; | 593 immediate_mode = kLoadStoreImm64; |
594 break; | 594 break; |
595 case MachineRepresentation::kSimd128: // Fall through. | 595 case MachineRepresentation::kSimd128: // Fall through. |
| 596 case MachineRepresentation::kSimd1x4: // Fall through. |
| 597 case MachineRepresentation::kSimd1x8: // Fall through. |
| 598 case MachineRepresentation::kSimd1x16: // Fall through. |
596 case MachineRepresentation::kNone: | 599 case MachineRepresentation::kNone: |
597 UNREACHABLE(); | 600 UNREACHABLE(); |
598 return; | 601 return; |
599 } | 602 } |
600 EmitLoad(this, node, opcode, immediate_mode, rep); | 603 EmitLoad(this, node, opcode, immediate_mode, rep); |
601 } | 604 } |
602 | 605 |
603 void InstructionSelector::VisitProtectedLoad(Node* node) { | 606 void InstructionSelector::VisitProtectedLoad(Node* node) { |
604 // TODO(eholk) | 607 // TODO(eholk) |
605 UNIMPLEMENTED(); | 608 UNIMPLEMENTED(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 immediate_mode = kLoadStoreImm32; | 685 immediate_mode = kLoadStoreImm32; |
683 break; | 686 break; |
684 case MachineRepresentation::kTaggedSigned: // Fall through. | 687 case MachineRepresentation::kTaggedSigned: // Fall through. |
685 case MachineRepresentation::kTaggedPointer: // Fall through. | 688 case MachineRepresentation::kTaggedPointer: // Fall through. |
686 case MachineRepresentation::kTagged: // Fall through. | 689 case MachineRepresentation::kTagged: // Fall through. |
687 case MachineRepresentation::kWord64: | 690 case MachineRepresentation::kWord64: |
688 opcode = kArm64Str; | 691 opcode = kArm64Str; |
689 immediate_mode = kLoadStoreImm64; | 692 immediate_mode = kLoadStoreImm64; |
690 break; | 693 break; |
691 case MachineRepresentation::kSimd128: // Fall through. | 694 case MachineRepresentation::kSimd128: // Fall through. |
| 695 case MachineRepresentation::kSimd1x4: // Fall through. |
| 696 case MachineRepresentation::kSimd1x8: // Fall through. |
| 697 case MachineRepresentation::kSimd1x16: // Fall through. |
692 case MachineRepresentation::kNone: | 698 case MachineRepresentation::kNone: |
693 UNREACHABLE(); | 699 UNREACHABLE(); |
694 return; | 700 return; |
695 } | 701 } |
696 | 702 |
697 inputs[0] = g.UseRegisterOrImmediateZero(value); | 703 inputs[0] = g.UseRegisterOrImmediateZero(value); |
698 inputs[1] = g.UseRegister(base); | 704 inputs[1] = g.UseRegister(base); |
699 | 705 |
700 if (g.CanBeImmediate(index, immediate_mode)) { | 706 if (g.CanBeImmediate(index, immediate_mode)) { |
701 input_count = 3; | 707 input_count = 3; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 opcode = kCheckedLoadFloat32; | 756 opcode = kCheckedLoadFloat32; |
751 break; | 757 break; |
752 case MachineRepresentation::kFloat64: | 758 case MachineRepresentation::kFloat64: |
753 opcode = kCheckedLoadFloat64; | 759 opcode = kCheckedLoadFloat64; |
754 break; | 760 break; |
755 case MachineRepresentation::kBit: // Fall through. | 761 case MachineRepresentation::kBit: // Fall through. |
756 case MachineRepresentation::kTaggedSigned: // Fall through. | 762 case MachineRepresentation::kTaggedSigned: // Fall through. |
757 case MachineRepresentation::kTaggedPointer: // Fall through. | 763 case MachineRepresentation::kTaggedPointer: // Fall through. |
758 case MachineRepresentation::kTagged: // Fall through. | 764 case MachineRepresentation::kTagged: // Fall through. |
759 case MachineRepresentation::kSimd128: // Fall through. | 765 case MachineRepresentation::kSimd128: // Fall through. |
| 766 case MachineRepresentation::kSimd1x4: // Fall through. |
| 767 case MachineRepresentation::kSimd1x8: // Fall through. |
| 768 case MachineRepresentation::kSimd1x16: // Fall through. |
760 case MachineRepresentation::kNone: | 769 case MachineRepresentation::kNone: |
761 UNREACHABLE(); | 770 UNREACHABLE(); |
762 return; | 771 return; |
763 } | 772 } |
764 // If the length is a constant power of two, allow the code generator to | 773 // If the length is a constant power of two, allow the code generator to |
765 // pick a more efficient bounds check sequence by passing the length as an | 774 // pick a more efficient bounds check sequence by passing the length as an |
766 // immediate. | 775 // immediate. |
767 if (length->opcode() == IrOpcode::kInt32Constant) { | 776 if (length->opcode() == IrOpcode::kInt32Constant) { |
768 Int32Matcher m(length); | 777 Int32Matcher m(length); |
769 if (m.IsPowerOf2()) { | 778 if (m.IsPowerOf2()) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 opcode = kCheckedStoreFloat32; | 811 opcode = kCheckedStoreFloat32; |
803 break; | 812 break; |
804 case MachineRepresentation::kFloat64: | 813 case MachineRepresentation::kFloat64: |
805 opcode = kCheckedStoreFloat64; | 814 opcode = kCheckedStoreFloat64; |
806 break; | 815 break; |
807 case MachineRepresentation::kBit: // Fall through. | 816 case MachineRepresentation::kBit: // Fall through. |
808 case MachineRepresentation::kTaggedSigned: // Fall through. | 817 case MachineRepresentation::kTaggedSigned: // Fall through. |
809 case MachineRepresentation::kTaggedPointer: // Fall through. | 818 case MachineRepresentation::kTaggedPointer: // Fall through. |
810 case MachineRepresentation::kTagged: // Fall through. | 819 case MachineRepresentation::kTagged: // Fall through. |
811 case MachineRepresentation::kSimd128: // Fall through. | 820 case MachineRepresentation::kSimd128: // Fall through. |
| 821 case MachineRepresentation::kSimd1x4: // Fall through. |
| 822 case MachineRepresentation::kSimd1x8: // Fall through. |
| 823 case MachineRepresentation::kSimd1x16: // Fall through. |
812 case MachineRepresentation::kNone: | 824 case MachineRepresentation::kNone: |
813 UNREACHABLE(); | 825 UNREACHABLE(); |
814 return; | 826 return; |
815 } | 827 } |
816 // If the length is a constant power of two, allow the code generator to | 828 // If the length is a constant power of two, allow the code generator to |
817 // pick a more efficient bounds check sequence by passing the length as an | 829 // pick a more efficient bounds check sequence by passing the length as an |
818 // immediate. | 830 // immediate. |
819 if (length->opcode() == IrOpcode::kInt32Constant) { | 831 if (length->opcode() == IrOpcode::kInt32Constant) { |
820 Int32Matcher m(length); | 832 Int32Matcher m(length); |
821 if (m.IsPowerOf2()) { | 833 if (m.IsPowerOf2()) { |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 // static | 2723 // static |
2712 MachineOperatorBuilder::AlignmentRequirements | 2724 MachineOperatorBuilder::AlignmentRequirements |
2713 InstructionSelector::AlignmentRequirements() { | 2725 InstructionSelector::AlignmentRequirements() { |
2714 return MachineOperatorBuilder::AlignmentRequirements:: | 2726 return MachineOperatorBuilder::AlignmentRequirements:: |
2715 FullUnalignedAccessSupport(); | 2727 FullUnalignedAccessSupport(); |
2716 } | 2728 } |
2717 | 2729 |
2718 } // namespace compiler | 2730 } // namespace compiler |
2719 } // namespace internal | 2731 } // namespace internal |
2720 } // namespace v8 | 2732 } // namespace v8 |
OLD | NEW |