[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,27 +113,7 @@ 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) \
V(uint8_t, 8, char) \
V(int16_t, 16, short) /* NOLINT(runtime/int) */ \
V(uint16_t, 16, short) /* NOLINT(runtime/int) */ \
V(int32_t, 32, long) /* NOLINT(runtime/int) */ \
V(uint32_t, 32, long) /* NOLINT(runtime/int) */ \
V(int64_t, 64, LONGLONG) \
V(uint64_t, 64, LONGLONG)
#define ATOMIC_OPS(type, suffix, vctype) \
inline type CompareExchangeSeqCst(type* p, type oldval, type newval) { \
return InterlockedCompareExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(newval), \
bit_cast<vctype>(oldval)); \
} \
inline type LoadSeqCst(type* p) { return *p; } \
inline void StoreSeqCst(type* p, type value) { \
InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
} \
inline type AddSeqCst(type* p, type value) { \ inline type AddSeqCst(type* p, type value) { \
return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \ return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \ bit_cast<vctype>(value)); \
@ -158,10 +138,35 @@ inline void StoreSeqCst(uint64_t* p, uint64_t value) {
return InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \ return InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \ bit_cast<vctype>(value)); \
} }
INTEGER_TYPES(ATOMIC_OPS)
#define ATOMIC_OPS_FLOAT(type, suffix, vctype) \
inline type CompareExchangeSeqCst(type* p, type oldval, type newval) { \
return InterlockedCompareExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(newval), \
bit_cast<vctype>(oldval)); \
} \
inline type LoadSeqCst(type* p) { return *p; } \
inline void StoreSeqCst(type* p, type value) { \
InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
bit_cast<vctype>(value)); \
}
#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