Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(933)

Side by Side Diff: src/compiler/arm64/instruction-selector-arm64.cc

Issue 2760963002: [arm64] Use acquire/release memory accesses for atomics (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/assembler-inl.h" 5 #include "src/assembler-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 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 2649 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 case MachineRepresentation::kWord16: 2660 case MachineRepresentation::kWord16:
2661 opcode = load_rep.IsSigned() ? kAtomicLoadInt16 : kAtomicLoadUint16; 2661 opcode = load_rep.IsSigned() ? kAtomicLoadInt16 : kAtomicLoadUint16;
2662 break; 2662 break;
2663 case MachineRepresentation::kWord32: 2663 case MachineRepresentation::kWord32:
2664 opcode = kAtomicLoadWord32; 2664 opcode = kAtomicLoadWord32;
2665 break; 2665 break;
2666 default: 2666 default:
2667 UNREACHABLE(); 2667 UNREACHABLE();
2668 return; 2668 return;
2669 } 2669 }
2670 Emit(opcode | AddressingModeField::encode(kMode_MRR), 2670 InstructionOperand inputs[] = {g.UseRegister(base), g.UseRegister(index)};
2671 g.DefineAsRegister(node), g.UseRegister(base), g.UseRegister(index)); 2671 InstructionOperand outputs[] = {g.DefineAsRegister(node)};
2672 InstructionOperand temps[] = {g.TempRegister()};
2673 InstructionCode code = opcode | AddressingModeField::encode(kMode_MRR);
2674 Emit(code, arraysize(outputs), outputs, arraysize(inputs), inputs,
2675 arraysize(temps), temps);
2672 } 2676 }
2673 2677
2674 void InstructionSelector::VisitAtomicStore(Node* node) { 2678 void InstructionSelector::VisitAtomicStore(Node* node) {
2675 MachineRepresentation rep = AtomicStoreRepresentationOf(node->op()); 2679 MachineRepresentation rep = AtomicStoreRepresentationOf(node->op());
2676 Arm64OperandGenerator g(this); 2680 Arm64OperandGenerator g(this);
2677 Node* base = node->InputAt(0); 2681 Node* base = node->InputAt(0);
2678 Node* index = node->InputAt(1); 2682 Node* index = node->InputAt(1);
2679 Node* value = node->InputAt(2); 2683 Node* value = node->InputAt(2);
2680 ArchOpcode opcode = kArchNop; 2684 ArchOpcode opcode = kArchNop;
2681 switch (rep) { 2685 switch (rep) {
(...skipping 11 matching lines...) Expand all
2693 return; 2697 return;
2694 } 2698 }
2695 2699
2696 AddressingMode addressing_mode = kMode_MRR; 2700 AddressingMode addressing_mode = kMode_MRR;
2697 InstructionOperand inputs[3]; 2701 InstructionOperand inputs[3];
2698 size_t input_count = 0; 2702 size_t input_count = 0;
2699 inputs[input_count++] = g.UseUniqueRegister(base); 2703 inputs[input_count++] = g.UseUniqueRegister(base);
2700 inputs[input_count++] = g.UseUniqueRegister(index); 2704 inputs[input_count++] = g.UseUniqueRegister(index);
2701 inputs[input_count++] = g.UseUniqueRegister(value); 2705 inputs[input_count++] = g.UseUniqueRegister(value);
2702 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); 2706 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
2703 Emit(code, 0, nullptr, input_count, inputs); 2707 InstructionOperand temps[] = {g.TempRegister()};
2708 Emit(code, 0, nullptr, input_count, inputs, arraysize(temps), temps);
2704 } 2709 }
2705 2710
2706 void InstructionSelector::VisitAtomicExchange(Node* node) { 2711 void InstructionSelector::VisitAtomicExchange(Node* node) {
2707 Arm64OperandGenerator g(this); 2712 Arm64OperandGenerator g(this);
2708 Node* base = node->InputAt(0); 2713 Node* base = node->InputAt(0);
2709 Node* index = node->InputAt(1); 2714 Node* index = node->InputAt(1);
2710 Node* value = node->InputAt(2); 2715 Node* value = node->InputAt(2);
2711 ArchOpcode opcode = kArchNop; 2716 ArchOpcode opcode = kArchNop;
2712 MachineType type = AtomicExchangeRepresentationOf(node->op()); 2717 MachineType type = AtomicExchangeRepresentationOf(node->op());
2713 if (type == MachineType::Int8()) { 2718 if (type == MachineType::Int8()) {
(...skipping 12 matching lines...) Expand all
2726 } 2731 }
2727 2732
2728 AddressingMode addressing_mode = kMode_MRR; 2733 AddressingMode addressing_mode = kMode_MRR;
2729 InstructionOperand inputs[3]; 2734 InstructionOperand inputs[3];
2730 size_t input_count = 0; 2735 size_t input_count = 0;
2731 inputs[input_count++] = g.UseUniqueRegister(base); 2736 inputs[input_count++] = g.UseUniqueRegister(base);
2732 inputs[input_count++] = g.UseUniqueRegister(index); 2737 inputs[input_count++] = g.UseUniqueRegister(index);
2733 inputs[input_count++] = g.UseUniqueRegister(value); 2738 inputs[input_count++] = g.UseUniqueRegister(value);
2734 InstructionOperand outputs[1]; 2739 InstructionOperand outputs[1];
2735 outputs[0] = g.UseUniqueRegister(node); 2740 outputs[0] = g.UseUniqueRegister(node);
2736 InstructionOperand temp[2]; 2741 InstructionOperand temps[] = {g.TempRegister()};
2737 temp[0] = g.TempRegister();
2738 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); 2742 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
2739 Emit(code, 1, outputs, input_count, inputs, 1, temp); 2743 Emit(code, 1, outputs, input_count, inputs, arraysize(temps), temps);
2740 } 2744 }
2741 2745
2742 void InstructionSelector::VisitAtomicCompareExchange(Node* node) { 2746 void InstructionSelector::VisitAtomicCompareExchange(Node* node) {
2743 Arm64OperandGenerator g(this); 2747 Arm64OperandGenerator g(this);
2744 Node* base = node->InputAt(0); 2748 Node* base = node->InputAt(0);
2745 Node* index = node->InputAt(1); 2749 Node* index = node->InputAt(1);
2746 Node* old_value = node->InputAt(2); 2750 Node* old_value = node->InputAt(2);
2747 Node* new_value = node->InputAt(3); 2751 Node* new_value = node->InputAt(3);
2748 ArchOpcode opcode = kArchNop; 2752 ArchOpcode opcode = kArchNop;
2749 MachineType type = AtomicCompareExchangeRepresentationOf(node->op()); 2753 MachineType type = AtomicCompareExchangeRepresentationOf(node->op());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 // static 2804 // static
2801 MachineOperatorBuilder::AlignmentRequirements 2805 MachineOperatorBuilder::AlignmentRequirements
2802 InstructionSelector::AlignmentRequirements() { 2806 InstructionSelector::AlignmentRequirements() {
2803 return MachineOperatorBuilder::AlignmentRequirements:: 2807 return MachineOperatorBuilder::AlignmentRequirements::
2804 FullUnalignedAccessSupport(); 2808 FullUnalignedAccessSupport();
2805 } 2809 }
2806 2810
2807 } // namespace compiler 2811 } // namespace compiler
2808 } // namespace internal 2812 } // namespace internal
2809 } // namespace v8 2813 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698