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 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2383 addressing_mode = kMode_MRI; | 2383 addressing_mode = kMode_MRI; |
2384 } else { | 2384 } else { |
2385 inputs[input_count++] = g.UseUniqueRegister(index); | 2385 inputs[input_count++] = g.UseUniqueRegister(index); |
2386 addressing_mode = kMode_MR1; | 2386 addressing_mode = kMode_MR1; |
2387 } | 2387 } |
2388 inputs[input_count++] = g.UseUniqueRegister(value); | 2388 inputs[input_count++] = g.UseUniqueRegister(value); |
2389 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); | 2389 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); |
2390 Emit(code, 0, static_cast<InstructionOperand*>(nullptr), input_count, inputs); | 2390 Emit(code, 0, static_cast<InstructionOperand*>(nullptr), input_count, inputs); |
2391 } | 2391 } |
2392 | 2392 |
2393 void InstructionSelector::VisitAtomicExchange(Node* node) { | |
2394 X64OperandGenerator g(this); | |
2395 Node* base = node->InputAt(0); | |
2396 Node* index = node->InputAt(1); | |
2397 Node* value = node->InputAt(2); | |
2398 | |
2399 MachineType type = AtomicExchangeRepresentationOf(node->op()); | |
2400 ArchOpcode opcode = kArchNop; | |
2401 if (type == MachineType::Uint8() || type == MachineType::Int8()) { | |
binji
2017/01/13 00:08:50
Looks like it is more common to do a switch on the
aseemgarg
2017/01/14 01:48:19
Changed a little. We can't use MachineRepresentati
binji
2017/01/17 21:45:50
Take a look at GetLoadOpcode/VisitCheckedLoad/Visi
| |
2402 opcode = kX64Xchgb; | |
2403 } else if (type == MachineType::Uint16() || type == MachineType::Int16()) { | |
2404 opcode = kX64Xchgw; | |
2405 } else if (type == MachineType::Uint32() || type == MachineType::Int32()) { | |
2406 opcode = kX64Xchgl; | |
2407 } else { | |
2408 UNREACHABLE(); | |
2409 return; | |
2410 } | |
2411 InstructionOperand outputs[1]; | |
2412 outputs[0] = g.DefineAsRegister(node); | |
2413 AddressingMode addressing_mode; | |
2414 InstructionOperand inputs[4]; | |
2415 size_t input_count = 0; | |
2416 inputs[input_count++] = g.UseUniqueRegister(base); | |
2417 if (g.CanBeImmediate(index)) { | |
2418 inputs[input_count++] = g.UseImmediate(index); | |
2419 addressing_mode = kMode_MRI; | |
2420 } else { | |
2421 inputs[input_count++] = g.UseUniqueRegister(index); | |
2422 addressing_mode = kMode_MR1; | |
2423 } | |
2424 inputs[input_count++] = g.UseUniqueRegister(value); | |
2425 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); | |
2426 Emit(code, 1, outputs, input_count, inputs); | |
2427 } | |
2428 | |
2393 void InstructionSelector::VisitCreateInt32x4(Node* node) { | 2429 void InstructionSelector::VisitCreateInt32x4(Node* node) { |
2394 X64OperandGenerator g(this); | 2430 X64OperandGenerator g(this); |
2395 Emit(kX64Int32x4Create, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 2431 Emit(kX64Int32x4Create, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
2396 } | 2432 } |
2397 | 2433 |
2398 void InstructionSelector::VisitInt32x4ExtractLane(Node* node) { | 2434 void InstructionSelector::VisitInt32x4ExtractLane(Node* node) { |
2399 X64OperandGenerator g(this); | 2435 X64OperandGenerator g(this); |
2400 int32_t lane = OpParameter<int32_t>(node); | 2436 int32_t lane = OpParameter<int32_t>(node); |
2401 Emit(kX64Int32x4ExtractLane, g.DefineAsRegister(node), | 2437 Emit(kX64Int32x4ExtractLane, g.DefineAsRegister(node), |
2402 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane)); | 2438 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane)); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2448 // static | 2484 // static |
2449 MachineOperatorBuilder::AlignmentRequirements | 2485 MachineOperatorBuilder::AlignmentRequirements |
2450 InstructionSelector::AlignmentRequirements() { | 2486 InstructionSelector::AlignmentRequirements() { |
2451 return MachineOperatorBuilder::AlignmentRequirements:: | 2487 return MachineOperatorBuilder::AlignmentRequirements:: |
2452 FullUnalignedAccessSupport(); | 2488 FullUnalignedAccessSupport(); |
2453 } | 2489 } |
2454 | 2490 |
2455 } // namespace compiler | 2491 } // namespace compiler |
2456 } // namespace internal | 2492 } // namespace internal |
2457 } // namespace v8 | 2493 } // namespace v8 |
OLD | NEW |