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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 static const int kMaxInputCount = 3; | 115 static const int kMaxInputCount = 3; |
116 InstructionOperand* base_operand_; | 116 InstructionOperand* base_operand_; |
117 InstructionOperand* index_operand_; | 117 InstructionOperand* index_operand_; |
118 InstructionOperand* displacement_operand_; | 118 InstructionOperand* displacement_operand_; |
119 AddressingMode mode_; | 119 AddressingMode mode_; |
120 }; | 120 }; |
121 | 121 |
122 | 122 |
| 123 static void VisitRRFloat64(InstructionSelector* selector, ArchOpcode opcode, |
| 124 Node* node) { |
| 125 X64OperandGenerator g(selector); |
| 126 selector->Emit(opcode, g.DefineAsRegister(node), |
| 127 g.UseRegister(node->InputAt(0))); |
| 128 } |
| 129 |
| 130 |
123 void InstructionSelector::VisitLoad(Node* node) { | 131 void InstructionSelector::VisitLoad(Node* node) { |
124 MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node)); | 132 MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node)); |
125 MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node)); | 133 MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node)); |
126 Node* base = node->InputAt(0); | 134 Node* base = node->InputAt(0); |
127 Node* index = node->InputAt(1); | 135 Node* index = node->InputAt(1); |
128 | 136 |
129 ArchOpcode opcode; | 137 ArchOpcode opcode; |
130 // TODO(titzer): signed/unsigned small loads | 138 // TODO(titzer): signed/unsigned small loads |
131 switch (rep) { | 139 switch (rep) { |
132 case kRepFloat32: | 140 case kRepFloat32: |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 temps); | 724 temps); |
717 } | 725 } |
718 | 726 |
719 | 727 |
720 void InstructionSelector::VisitFloat64Sqrt(Node* node) { | 728 void InstructionSelector::VisitFloat64Sqrt(Node* node) { |
721 X64OperandGenerator g(this); | 729 X64OperandGenerator g(this); |
722 Emit(kSSEFloat64Sqrt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 730 Emit(kSSEFloat64Sqrt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
723 } | 731 } |
724 | 732 |
725 | 733 |
| 734 void InstructionSelector::VisitFloat64Floor(Node* node) { |
| 735 DCHECK(CpuFeatures::IsSupported(SSE4_1)); |
| 736 VisitRRFloat64(this, kSSEFloat64Floor, node); |
| 737 } |
| 738 |
| 739 |
| 740 void InstructionSelector::VisitFloat64Ceil(Node* node) { |
| 741 DCHECK(CpuFeatures::IsSupported(SSE4_1)); |
| 742 VisitRRFloat64(this, kSSEFloat64Ceil, node); |
| 743 } |
| 744 |
| 745 |
| 746 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
| 747 DCHECK(CpuFeatures::IsSupported(SSE4_1)); |
| 748 VisitRRFloat64(this, kSSEFloat64RoundTruncate, node); |
| 749 } |
| 750 |
| 751 |
| 752 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
| 753 UNREACHABLE(); |
| 754 } |
| 755 |
| 756 |
726 void InstructionSelector::VisitCall(Node* node) { | 757 void InstructionSelector::VisitCall(Node* node) { |
727 X64OperandGenerator g(this); | 758 X64OperandGenerator g(this); |
728 CallDescriptor* descriptor = OpParameter<CallDescriptor*>(node); | 759 CallDescriptor* descriptor = OpParameter<CallDescriptor*>(node); |
729 | 760 |
730 FrameStateDescriptor* frame_state_descriptor = NULL; | 761 FrameStateDescriptor* frame_state_descriptor = NULL; |
731 if (descriptor->NeedsFrameState()) { | 762 if (descriptor->NeedsFrameState()) { |
732 frame_state_descriptor = GetFrameStateDescriptor( | 763 frame_state_descriptor = GetFrameStateDescriptor( |
733 node->InputAt(static_cast<int>(descriptor->InputCount()))); | 764 node->InputAt(static_cast<int>(descriptor->InputCount()))); |
734 } | 765 } |
735 | 766 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 | 1136 |
1106 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { | 1137 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { |
1107 FlagsContinuation cont(kUnorderedLessThanOrEqual, node); | 1138 FlagsContinuation cont(kUnorderedLessThanOrEqual, node); |
1108 VisitFloat64Compare(this, node, &cont); | 1139 VisitFloat64Compare(this, node, &cont); |
1109 } | 1140 } |
1110 | 1141 |
1111 | 1142 |
1112 // static | 1143 // static |
1113 MachineOperatorBuilder::Flags | 1144 MachineOperatorBuilder::Flags |
1114 InstructionSelector::SupportedMachineOperatorFlags() { | 1145 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1146 if (CpuFeatures::IsSupported(SSE4_1)) { |
| 1147 return MachineOperatorBuilder::kFloat64Floor | |
| 1148 MachineOperatorBuilder::kFloat64Ceil | |
| 1149 MachineOperatorBuilder::kFloat64RoundTruncate; |
| 1150 } |
1115 return MachineOperatorBuilder::kNoFlags; | 1151 return MachineOperatorBuilder::kNoFlags; |
1116 } | 1152 } |
1117 | |
1118 } // namespace compiler | 1153 } // namespace compiler |
1119 } // namespace internal | 1154 } // namespace internal |
1120 } // namespace v8 | 1155 } // namespace v8 |
OLD | NEW |