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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 InstructionOperand outputs[1]; | 193 InstructionOperand outputs[1]; |
194 outputs[0] = g.DefineAsRegister(node); | 194 outputs[0] = g.DefineAsRegister(node); |
195 InstructionOperand inputs[3]; | 195 InstructionOperand inputs[3]; |
196 size_t input_count = 0; | 196 size_t input_count = 0; |
197 AddressingMode mode = | 197 AddressingMode mode = |
198 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); | 198 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); |
199 InstructionCode code = opcode | AddressingModeField::encode(mode); | 199 InstructionCode code = opcode | AddressingModeField::encode(mode); |
200 Emit(code, 1, outputs, input_count, inputs); | 200 Emit(code, 1, outputs, input_count, inputs); |
201 } | 201 } |
202 | 202 |
| 203 void InstructionSelector::VisitTrapableLoad(Node* node) { |
| 204 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); |
| 205 X64OperandGenerator g(this); |
| 206 |
| 207 ArchOpcode opcode = kArchNop; |
| 208 switch (load_rep.representation()) { |
| 209 case MachineRepresentation::kFloat32: |
| 210 opcode = kX64Movss; |
| 211 break; |
| 212 case MachineRepresentation::kFloat64: |
| 213 opcode = kX64Movsd; |
| 214 break; |
| 215 case MachineRepresentation::kBit: // Fall through. |
| 216 case MachineRepresentation::kWord8: |
| 217 opcode = load_rep.IsSigned() ? kX64Movsxbl : kX64Movzxbl; |
| 218 break; |
| 219 case MachineRepresentation::kWord16: |
| 220 opcode = load_rep.IsSigned() ? kX64Movsxwl : kX64Movzxwl; |
| 221 break; |
| 222 case MachineRepresentation::kWord32: |
| 223 opcode = kX64TrapMovl; |
| 224 break; |
| 225 case MachineRepresentation::kTaggedSigned: // Fall through. |
| 226 case MachineRepresentation::kTaggedPointer: // Fall through. |
| 227 case MachineRepresentation::kTagged: // Fall through. |
| 228 case MachineRepresentation::kWord64: |
| 229 opcode = kX64Movq; |
| 230 break; |
| 231 case MachineRepresentation::kSimd128: // Fall through. |
| 232 case MachineRepresentation::kNone: |
| 233 UNREACHABLE(); |
| 234 return; |
| 235 } |
| 236 |
| 237 InstructionOperand outputs[1]; |
| 238 outputs[0] = g.DefineAsRegister(node); |
| 239 InstructionOperand inputs[4]; |
| 240 size_t input_count = 0; |
| 241 AddressingMode mode = |
| 242 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); |
| 243 // Add the context parameter as an input. |
| 244 inputs[input_count++] = g.UseUniqueRegister(node->InputAt(2)); |
| 245 // Add the source position as an input |
| 246 inputs[input_count++] = g.UseImmediate(node->InputAt(3)); |
| 247 InstructionCode code = opcode | AddressingModeField::encode(mode); |
| 248 Emit(code, 1, outputs, input_count, inputs); |
| 249 } |
203 | 250 |
204 void InstructionSelector::VisitStore(Node* node) { | 251 void InstructionSelector::VisitStore(Node* node) { |
205 X64OperandGenerator g(this); | 252 X64OperandGenerator g(this); |
206 Node* base = node->InputAt(0); | 253 Node* base = node->InputAt(0); |
207 Node* index = node->InputAt(1); | 254 Node* index = node->InputAt(1); |
208 Node* value = node->InputAt(2); | 255 Node* value = node->InputAt(2); |
209 | 256 |
210 StoreRepresentation store_rep = StoreRepresentationOf(node->op()); | 257 StoreRepresentation store_rep = StoreRepresentationOf(node->op()); |
211 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind(); | 258 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind(); |
212 MachineRepresentation rep = store_rep.representation(); | 259 MachineRepresentation rep = store_rep.representation(); |
(...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 // static | 2297 // static |
2251 MachineOperatorBuilder::AlignmentRequirements | 2298 MachineOperatorBuilder::AlignmentRequirements |
2252 InstructionSelector::AlignmentRequirements() { | 2299 InstructionSelector::AlignmentRequirements() { |
2253 return MachineOperatorBuilder::AlignmentRequirements:: | 2300 return MachineOperatorBuilder::AlignmentRequirements:: |
2254 FullUnalignedAccessSupport(); | 2301 FullUnalignedAccessSupport(); |
2255 } | 2302 } |
2256 | 2303 |
2257 } // namespace compiler | 2304 } // namespace compiler |
2258 } // namespace internal | 2305 } // namespace internal |
2259 } // namespace v8 | 2306 } // namespace v8 |
OLD | NEW |