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

Side by Side Diff: src/compiler/ia32/code-generator-ia32.cc

Issue 2623633003: [Atomics] Make Atomics.exchange a builtin using TF (Closed)
Patch Set: fix win Created 3 years, 10 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compilation-info.h" 7 #include "src/compilation-info.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 break; 1881 break;
1882 case kIA32Poke: { 1882 case kIA32Poke: {
1883 int const slot = MiscField::decode(instr->opcode()); 1883 int const slot = MiscField::decode(instr->opcode());
1884 if (HasImmediateInput(instr, 0)) { 1884 if (HasImmediateInput(instr, 0)) {
1885 __ mov(Operand(esp, slot * kPointerSize), i.InputImmediate(0)); 1885 __ mov(Operand(esp, slot * kPointerSize), i.InputImmediate(0));
1886 } else { 1886 } else {
1887 __ mov(Operand(esp, slot * kPointerSize), i.InputRegister(0)); 1887 __ mov(Operand(esp, slot * kPointerSize), i.InputRegister(0));
1888 } 1888 }
1889 break; 1889 break;
1890 } 1890 }
1891 case kIA32Xchgb: {
1892 size_t index = 0;
1893 Operand operand = i.MemoryOperand(&index);
1894 __ xchg_b(i.InputRegister(index), operand);
1895 break;
1896 }
1897 case kIA32Xchgw: {
1898 size_t index = 0;
1899 Operand operand = i.MemoryOperand(&index);
1900 __ xchg_w(i.InputRegister(index), operand);
1901 break;
1902 }
1903 case kIA32Xchgl: {
1904 size_t index = 0;
1905 Operand operand = i.MemoryOperand(&index);
1906 __ xchg(i.InputRegister(index), operand);
1907 break;
1908 }
1909 case kCheckedLoadInt8: 1891 case kCheckedLoadInt8:
1910 ASSEMBLE_CHECKED_LOAD_INTEGER(movsx_b); 1892 ASSEMBLE_CHECKED_LOAD_INTEGER(movsx_b);
1911 break; 1893 break;
1912 case kCheckedLoadUint8: 1894 case kCheckedLoadUint8:
1913 ASSEMBLE_CHECKED_LOAD_INTEGER(movzx_b); 1895 ASSEMBLE_CHECKED_LOAD_INTEGER(movzx_b);
1914 break; 1896 break;
1915 case kCheckedLoadInt16: 1897 case kCheckedLoadInt16:
1916 ASSEMBLE_CHECKED_LOAD_INTEGER(movsx_w); 1898 ASSEMBLE_CHECKED_LOAD_INTEGER(movsx_w);
1917 break; 1899 break;
1918 case kCheckedLoadUint16: 1900 case kCheckedLoadUint16:
(...skipping 26 matching lines...) Expand all
1945 case kIA32StackCheck: { 1927 case kIA32StackCheck: {
1946 ExternalReference const stack_limit = 1928 ExternalReference const stack_limit =
1947 ExternalReference::address_of_stack_limit(isolate()); 1929 ExternalReference::address_of_stack_limit(isolate());
1948 __ cmp(esp, Operand::StaticVariable(stack_limit)); 1930 __ cmp(esp, Operand::StaticVariable(stack_limit));
1949 break; 1931 break;
1950 } 1932 }
1951 case kCheckedLoadWord64: 1933 case kCheckedLoadWord64:
1952 case kCheckedStoreWord64: 1934 case kCheckedStoreWord64:
1953 UNREACHABLE(); // currently unsupported checked int64 load/store. 1935 UNREACHABLE(); // currently unsupported checked int64 load/store.
1954 break; 1936 break;
1937 #define EXCHANGE_OPERANDS \
1938 size_t index = 0; \
1939 Register r = i.InputRegister(index++); \
1940 Operand operand = i.MemoryOperand(&index);
binji 2017/02/22 02:08:38 looks like if index is not used afterward it is si
aseemgarg 2017/02/22 03:29:02 Done.
1941 case kAtomicExchangeInt8: {
1942 EXCHANGE_OPERANDS
1943 __ xchg_b(r, operand);
1944 __ movsx_b(r, r);
1945 break;
1946 }
1947 case kAtomicExchangeUint8: {
1948 EXCHANGE_OPERANDS
1949 __ xchg_b(r, operand);
1950 __ movzx_b(r, r);
1951 break;
1952 }
1953 case kAtomicExchangeInt16: {
1954 EXCHANGE_OPERANDS
1955 __ xchg_w(r, operand);
1956 __ movsx_w(r, r);
1957 break;
1958 }
1959 case kAtomicExchangeUint16: {
1960 EXCHANGE_OPERANDS
1961 __ xchg_w(r, operand);
1962 __ movzx_w(r, r);
1963 break;
1964 }
1965 case kAtomicExchangeWord32: {
1966 EXCHANGE_OPERANDS
1967 __ xchg(r, operand);
1968 break;
1969 }
1970 #undef EXCHANGE_OPERANDS
1955 case kAtomicLoadInt8: 1971 case kAtomicLoadInt8:
1956 case kAtomicLoadUint8: 1972 case kAtomicLoadUint8:
1957 case kAtomicLoadInt16: 1973 case kAtomicLoadInt16:
1958 case kAtomicLoadUint16: 1974 case kAtomicLoadUint16:
1959 case kAtomicLoadWord32: 1975 case kAtomicLoadWord32:
1960 case kAtomicStoreWord8: 1976 case kAtomicStoreWord8:
1961 case kAtomicStoreWord16: 1977 case kAtomicStoreWord16:
1962 case kAtomicStoreWord32: 1978 case kAtomicStoreWord32:
1963 UNREACHABLE(); // Won't be generated by instruction selector. 1979 UNREACHABLE(); // Won't be generated by instruction selector.
1964 break; 1980 break;
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2682 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2667 __ Nop(padding_size); 2683 __ Nop(padding_size);
2668 } 2684 }
2669 } 2685 }
2670 2686
2671 #undef __ 2687 #undef __
2672 2688
2673 } // namespace compiler 2689 } // namespace compiler
2674 } // namespace internal 2690 } // namespace internal
2675 } // namespace v8 2691 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698