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

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

Issue 2649703002: [Atomics] Make Atomics.compareExchange a builtin using TF (Closed)
Patch Set: use TF_BUILTIN macro 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/base/adapters.h" 5 #include "src/base/adapters.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 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 addressing_mode = kMode_MRI; 1751 addressing_mode = kMode_MRI;
1752 } else { 1752 } else {
1753 inputs[input_count++] = g.UseUniqueRegister(index); 1753 inputs[input_count++] = g.UseUniqueRegister(index);
1754 addressing_mode = kMode_MR1; 1754 addressing_mode = kMode_MR1;
1755 } 1755 }
1756 outputs[0] = g.DefineSameAsFirst(node); 1756 outputs[0] = g.DefineSameAsFirst(node);
1757 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); 1757 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
1758 Emit(code, 1, outputs, input_count, inputs); 1758 Emit(code, 1, outputs, input_count, inputs);
1759 } 1759 }
1760 1760
1761 void InstructionSelector::VisitAtomicCompareExchange(Node* node) {
1762 IA32OperandGenerator g(this);
1763 Node* base = node->InputAt(0);
1764 Node* index = node->InputAt(1);
1765 Node* old_value = node->InputAt(2);
1766 Node* new_value = node->InputAt(3);
1767
1768 MachineType type = AtomicCompareExchangeRepresentationOf(node->op());
1769 ArchOpcode opcode = kArchNop;
1770 if (type == MachineType::Int8()) {
1771 opcode = kAtomicCompareExchangeInt8;
1772 } else if (type == MachineType::Uint8()) {
1773 opcode = kAtomicCompareExchangeUint8;
1774 } else if (type == MachineType::Int16()) {
1775 opcode = kAtomicCompareExchangeInt16;
1776 } else if (type == MachineType::Uint16()) {
1777 opcode = kAtomicCompareExchangeUint16;
1778 } else if (type == MachineType::Int32() || type == MachineType::Uint32()) {
1779 opcode = kAtomicCompareExchangeWord32;
1780 } else {
1781 UNREACHABLE();
1782 return;
1783 }
1784 InstructionOperand outputs[1];
1785 AddressingMode addressing_mode;
1786 InstructionOperand inputs[4];
1787 size_t input_count = 0;
1788 inputs[input_count++] = g.UseFixed(old_value, eax);
1789 inputs[input_count++] = g.UseUniqueRegister(new_value);
1790 inputs[input_count++] = g.UseUniqueRegister(base);
1791 if (g.CanBeImmediate(index)) {
1792 inputs[input_count++] = g.UseImmediate(index);
1793 addressing_mode = kMode_MRI;
1794 } else {
1795 inputs[input_count++] = g.UseUniqueRegister(index);
1796 addressing_mode = kMode_MR1;
1797 }
1798 outputs[0] = g.DefineAsFixed(node, eax);
1799 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
1800 Emit(code, 1, outputs, input_count, inputs);
1801 }
1802
1761 void InstructionSelector::VisitInt32x4Splat(Node* node) { 1803 void InstructionSelector::VisitInt32x4Splat(Node* node) {
1762 VisitRO(this, node, kIA32Int32x4Splat); 1804 VisitRO(this, node, kIA32Int32x4Splat);
1763 } 1805 }
1764 1806
1765 void InstructionSelector::VisitInt32x4ExtractLane(Node* node) { 1807 void InstructionSelector::VisitInt32x4ExtractLane(Node* node) {
1766 IA32OperandGenerator g(this); 1808 IA32OperandGenerator g(this);
1767 int32_t lane = OpParameter<int32_t>(node); 1809 int32_t lane = OpParameter<int32_t>(node);
1768 Emit(kIA32Int32x4ExtractLane, g.DefineAsRegister(node), 1810 Emit(kIA32Int32x4ExtractLane, g.DefineAsRegister(node),
1769 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane)); 1811 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane));
1770 } 1812 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 // static 1844 // static
1803 MachineOperatorBuilder::AlignmentRequirements 1845 MachineOperatorBuilder::AlignmentRequirements
1804 InstructionSelector::AlignmentRequirements() { 1846 InstructionSelector::AlignmentRequirements() {
1805 return MachineOperatorBuilder::AlignmentRequirements:: 1847 return MachineOperatorBuilder::AlignmentRequirements::
1806 FullUnalignedAccessSupport(); 1848 FullUnalignedAccessSupport();
1807 } 1849 }
1808 1850
1809 } // namespace compiler 1851 } // namespace compiler
1810 } // namespace internal 1852 } // namespace internal
1811 } // namespace v8 1853 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698