[Atomics] Fix compile failure in clang/win build in runtime-atomics.cc

BUG=v8:4366
LOG=n

Review URL: https://codereview.chromium.org/1287543004

Cr-Commit-Position: refs/heads/master@{#30138}
This commit is contained in:
binji 2015-08-12 09:44:13 -07:00 committed by Commit bot
parent d746dbfed7
commit 60268ceecd

View File

@ -113,17 +113,33 @@ inline void StoreSeqCst(uint64_t* p, uint64_t value) {
#define InterlockedCompareExchange8 _InterlockedCompareExchange8 #define InterlockedCompareExchange8 _InterlockedCompareExchange8
#define InterlockedExchangeAdd8 _InterlockedExchangeAdd8 #define InterlockedExchangeAdd8 _InterlockedExchangeAdd8
#define INTEGER_TYPES(V) \ #define ATOMIC_OPS_INTEGER(type, suffix, vctype) \
V(int8_t, 8, char) \ inline type AddSeqCst(type* p, type value) { \
V(uint8_t, 8, char) \ return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \
V(int16_t, 16, short) /* NOLINT(runtime/int) */ \ bit_cast<vctype>(value)); \
V(uint16_t, 16, short) /* NOLINT(runtime/int) */ \ } \
V(int32_t, 32, long) /* NOLINT(runtime/int) */ \ inline type SubSeqCst(type* p, type value) { \
V(uint32_t, 32, long) /* NOLINT(runtime/int) */ \ return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \
V(int64_t, 64, LONGLONG) \ -bit_cast<vctype>(value)); \
V(uint64_t, 64, LONGLONG) } \
inline type AndSeqCst(type* p, type value) { \
return InterlockedAnd##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
} \
inline type OrSeqCst(type* p, type value) { \
return InterlockedOr##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
} \
inline type XorSeqCst(type* p, type value) { \
return InterlockedXor##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
} \
inline type ExchangeSeqCst(type* p, type value) { \
return InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
}
#define ATOMIC_OPS(type, suffix, vctype) \ #define ATOMIC_OPS_FLOAT(type, suffix, vctype) \
inline type CompareExchangeSeqCst(type* p, type oldval, type newval) { \ inline type CompareExchangeSeqCst(type* p, type oldval, type newval) { \
return InterlockedCompareExchange##suffix(reinterpret_cast<vctype*>(p), \ return InterlockedCompareExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(newval), \ bit_cast<vctype>(newval), \
@ -133,35 +149,24 @@ inline void StoreSeqCst(uint64_t* p, uint64_t value) {
inline void StoreSeqCst(type* p, type value) { \ inline void StoreSeqCst(type* p, type value) { \
InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \ InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \ bit_cast<vctype>(value)); \
} \
inline type AddSeqCst(type* p, type value) { \
return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
} \
inline type SubSeqCst(type* p, type value) { \
return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \
-bit_cast<vctype>(value)); \
} \
inline type AndSeqCst(type* p, type value) { \
return InterlockedAnd##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
} \
inline type OrSeqCst(type* p, type value) { \
return InterlockedOr##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
} \
inline type XorSeqCst(type* p, type value) { \
return InterlockedXor##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
} \
inline type ExchangeSeqCst(type* p, type value) { \
return InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
} }
INTEGER_TYPES(ATOMIC_OPS)
#define ATOMIC_OPS(type, suffix, vctype) \
ATOMIC_OPS_INTEGER(type, suffix, vctype) \
ATOMIC_OPS_FLOAT(type, suffix, vctype)
ATOMIC_OPS(int8_t, 8, char)
ATOMIC_OPS(uint8_t, 8, char)
ATOMIC_OPS(int16_t, 16, short) /* NOLINT(runtime/int) */
ATOMIC_OPS(uint16_t, 16, short) /* NOLINT(runtime/int) */
ATOMIC_OPS(int32_t, 32, long) /* NOLINT(runtime/int) */
ATOMIC_OPS(uint32_t, 32, long) /* NOLINT(runtime/int) */
ATOMIC_OPS_FLOAT(uint64_t, 64, LONGLONG)
#undef ATOMIC_OPS_INTEGER
#undef ATOMIC_OPS_FLOAT
#undef ATOMIC_OPS #undef ATOMIC_OPS
#undef INTEGER_TYPES
#undef InterlockedCompareExchange32 #undef InterlockedCompareExchange32
#undef InterlockedExchange32 #undef InterlockedExchange32
#undef InterlockedExchangeAdd32 #undef InterlockedExchangeAdd32