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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 outputs[0] = g.DefineAsRegister(node); | 139 outputs[0] = g.DefineAsRegister(node); |
140 InstructionOperand inputs[3]; | 140 InstructionOperand inputs[3]; |
141 size_t input_count = 0; | 141 size_t input_count = 0; |
142 AddressingMode mode = | 142 AddressingMode mode = |
143 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); | 143 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); |
144 InstructionCode code = opcode | AddressingModeField::encode(mode); | 144 InstructionCode code = opcode | AddressingModeField::encode(mode); |
145 Emit(code, 1, outputs, input_count, inputs); | 145 Emit(code, 1, outputs, input_count, inputs); |
146 } | 146 } |
147 | 147 |
148 | 148 |
| 149 void InstructionSelector::VisitLoadAtomic(Node* node) { |
| 150 MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node)); |
| 151 MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node)); |
| 152 X64OperandGenerator g(this); |
| 153 |
| 154 ArchOpcode opcode; |
| 155 switch (rep) { |
| 156 case kRepFloat32: |
| 157 opcode = kX64Movss; |
| 158 break; |
| 159 case kRepFloat64: |
| 160 opcode = kX64Movsd; |
| 161 break; |
| 162 case kRepBit: // Fall through. |
| 163 case kRepWord8: |
| 164 opcode = typ == kTypeInt32 ? kX64Movsxbl : kX64Movzxbl; |
| 165 break; |
| 166 case kRepWord16: |
| 167 opcode = typ == kTypeInt32 ? kX64Movsxwl : kX64Movzxwl; |
| 168 break; |
| 169 case kRepWord32: |
| 170 opcode = kX64Movl; |
| 171 break; |
| 172 case kRepTagged: |
| 173 case kRepWord64: |
| 174 default: |
| 175 UNREACHABLE(); |
| 176 return; |
| 177 } |
| 178 |
| 179 InstructionOperand outputs[1]; |
| 180 outputs[0] = g.DefineAsRegister(node); |
| 181 InstructionOperand inputs[3]; |
| 182 size_t input_count = 0; |
| 183 AddressingMode mode = |
| 184 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); |
| 185 InstructionCode code = opcode | AddressingModeField::encode(mode); |
| 186 Emit(code, 1, outputs, input_count, inputs); |
| 187 } |
| 188 |
| 189 |
149 void InstructionSelector::VisitStore(Node* node) { | 190 void InstructionSelector::VisitStore(Node* node) { |
150 X64OperandGenerator g(this); | 191 X64OperandGenerator g(this); |
151 Node* base = node->InputAt(0); | 192 Node* base = node->InputAt(0); |
152 Node* index = node->InputAt(1); | 193 Node* index = node->InputAt(1); |
153 Node* value = node->InputAt(2); | 194 Node* value = node->InputAt(2); |
154 | 195 |
155 StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node); | 196 StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node); |
156 MachineType rep = RepresentationOf(store_rep.machine_type()); | 197 MachineType rep = RepresentationOf(store_rep.machine_type()); |
157 if (store_rep.write_barrier_kind() == kFullWriteBarrier) { | 198 if (store_rep.write_barrier_kind() == kFullWriteBarrier) { |
158 DCHECK_EQ(kRepTagged, rep); | 199 DCHECK_EQ(kRepTagged, rep); |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 if (CpuFeatures::IsSupported(SSE4_1)) { | 1668 if (CpuFeatures::IsSupported(SSE4_1)) { |
1628 flags |= MachineOperatorBuilder::kFloat64RoundDown | | 1669 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
1629 MachineOperatorBuilder::kFloat64RoundTruncate; | 1670 MachineOperatorBuilder::kFloat64RoundTruncate; |
1630 } | 1671 } |
1631 return flags; | 1672 return flags; |
1632 } | 1673 } |
1633 | 1674 |
1634 } // namespace compiler | 1675 } // namespace compiler |
1635 } // namespace internal | 1676 } // namespace internal |
1636 } // namespace v8 | 1677 } // namespace v8 |
OLD | NEW |