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

Side by Side Diff: src/runtime/runtime-atomics.cc

Issue 1287543004: [Atomics] Fix compile failure in clang/win build in runtime-atomics.cc (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: . Created 5 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/base/macros.h" 8 #include "src/base/macros.h"
9 #include "src/base/platform/mutex.h" 9 #include "src/base/platform/mutex.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #define InterlockedCompareExchange32 _InterlockedCompareExchange 106 #define InterlockedCompareExchange32 _InterlockedCompareExchange
107 #define InterlockedExchange32 _InterlockedExchange 107 #define InterlockedExchange32 _InterlockedExchange
108 #define InterlockedExchangeAdd32 _InterlockedExchangeAdd 108 #define InterlockedExchangeAdd32 _InterlockedExchangeAdd
109 #define InterlockedAnd32 _InterlockedAnd 109 #define InterlockedAnd32 _InterlockedAnd
110 #define InterlockedOr32 _InterlockedOr 110 #define InterlockedOr32 _InterlockedOr
111 #define InterlockedXor32 _InterlockedXor 111 #define InterlockedXor32 _InterlockedXor
112 #define InterlockedExchangeAdd16 _InterlockedExchangeAdd16 112 #define InterlockedExchangeAdd16 _InterlockedExchangeAdd16
113 #define InterlockedCompareExchange8 _InterlockedCompareExchange8 113 #define InterlockedCompareExchange8 _InterlockedCompareExchange8
114 #define InterlockedExchangeAdd8 _InterlockedExchangeAdd8 114 #define InterlockedExchangeAdd8 _InterlockedExchangeAdd8
115 115
116 #define INTEGER_TYPES(V) \ 116 #define ATOMIC_OPS_INTEGER(type, suffix, vctype) \
117 V(int8_t, 8, char) \ 117 inline type AddSeqCst(type* p, type value) { \
118 V(uint8_t, 8, char) \ 118 return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \
119 V(int16_t, 16, short) /* NOLINT(runtime/int) */ \ 119 bit_cast<vctype>(value)); \
120 V(uint16_t, 16, short) /* NOLINT(runtime/int) */ \ 120 } \
121 V(int32_t, 32, long) /* NOLINT(runtime/int) */ \ 121 inline type SubSeqCst(type* p, type value) { \
122 V(uint32_t, 32, long) /* NOLINT(runtime/int) */ \ 122 return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \
123 V(int64_t, 64, LONGLONG) \ 123 -bit_cast<vctype>(value)); \
124 V(uint64_t, 64, LONGLONG) 124 } \
125 inline type AndSeqCst(type* p, type value) { \
126 return InterlockedAnd##suffix(reinterpret_cast<vctype*>(p), \
127 bit_cast<vctype>(value)); \
128 } \
129 inline type OrSeqCst(type* p, type value) { \
130 return InterlockedOr##suffix(reinterpret_cast<vctype*>(p), \
131 bit_cast<vctype>(value)); \
132 } \
133 inline type XorSeqCst(type* p, type value) { \
134 return InterlockedXor##suffix(reinterpret_cast<vctype*>(p), \
135 bit_cast<vctype>(value)); \
136 } \
137 inline type ExchangeSeqCst(type* p, type value) { \
138 return InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
139 bit_cast<vctype>(value)); \
140 }
125 141
126 #define ATOMIC_OPS(type, suffix, vctype) \ 142 #define ATOMIC_OPS_FLOAT(type, suffix, vctype) \
127 inline type CompareExchangeSeqCst(type* p, type oldval, type newval) { \ 143 inline type CompareExchangeSeqCst(type* p, type oldval, type newval) { \
128 return InterlockedCompareExchange##suffix(reinterpret_cast<vctype*>(p), \ 144 return InterlockedCompareExchange##suffix(reinterpret_cast<vctype*>(p), \
129 bit_cast<vctype>(newval), \ 145 bit_cast<vctype>(newval), \
130 bit_cast<vctype>(oldval)); \ 146 bit_cast<vctype>(oldval)); \
131 } \ 147 } \
132 inline type LoadSeqCst(type* p) { return *p; } \ 148 inline type LoadSeqCst(type* p) { return *p; } \
133 inline void StoreSeqCst(type* p, type value) { \ 149 inline void StoreSeqCst(type* p, type value) { \
134 InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \ 150 InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
135 bit_cast<vctype>(value)); \ 151 bit_cast<vctype>(value)); \
136 } \
137 inline type AddSeqCst(type* p, type value) { \
138 return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \
139 bit_cast<vctype>(value)); \
140 } \
141 inline type SubSeqCst(type* p, type value) { \
142 return InterlockedExchangeAdd##suffix(reinterpret_cast<vctype*>(p), \
143 -bit_cast<vctype>(value)); \
144 } \
145 inline type AndSeqCst(type* p, type value) { \
146 return InterlockedAnd##suffix(reinterpret_cast<vctype*>(p), \
147 bit_cast<vctype>(value)); \
148 } \
149 inline type OrSeqCst(type* p, type value) { \
150 return InterlockedOr##suffix(reinterpret_cast<vctype*>(p), \
151 bit_cast<vctype>(value)); \
152 } \
153 inline type XorSeqCst(type* p, type value) { \
154 return InterlockedXor##suffix(reinterpret_cast<vctype*>(p), \
155 bit_cast<vctype>(value)); \
156 } \
157 inline type ExchangeSeqCst(type* p, type value) { \
158 return InterlockedExchange##suffix(reinterpret_cast<vctype*>(p), \
159 bit_cast<vctype>(value)); \
160 } 152 }
161 INTEGER_TYPES(ATOMIC_OPS) 153
154 #define ATOMIC_OPS(type, suffix, vctype) \
155 ATOMIC_OPS_INTEGER(type, suffix, vctype) \
156 ATOMIC_OPS_FLOAT(type, suffix, vctype)
157
158 ATOMIC_OPS(int8_t, 8, char)
159 ATOMIC_OPS(uint8_t, 8, char)
160 ATOMIC_OPS(int16_t, 16, short) /* NOLINT(runtime/int) */
161 ATOMIC_OPS(uint16_t, 16, short) /* NOLINT(runtime/int) */
162 ATOMIC_OPS(int32_t, 32, long) /* NOLINT(runtime/int) */
163 ATOMIC_OPS(uint32_t, 32, long) /* NOLINT(runtime/int) */
164 ATOMIC_OPS_FLOAT(uint64_t, 64, LONGLONG)
165
166 #undef ATOMIC_OPS_INTEGER
167 #undef ATOMIC_OPS_FLOAT
162 #undef ATOMIC_OPS 168 #undef ATOMIC_OPS
163 169
164 #undef INTEGER_TYPES
165 #undef InterlockedCompareExchange32 170 #undef InterlockedCompareExchange32
166 #undef InterlockedExchange32 171 #undef InterlockedExchange32
167 #undef InterlockedExchangeAdd32 172 #undef InterlockedExchangeAdd32
168 #undef InterlockedAnd32 173 #undef InterlockedAnd32
169 #undef InterlockedOr32 174 #undef InterlockedOr32
170 #undef InterlockedXor32 175 #undef InterlockedXor32
171 #undef InterlockedExchangeAdd16 176 #undef InterlockedExchangeAdd16
172 #undef InterlockedCompareExchange8 177 #undef InterlockedCompareExchange8
173 #undef InterlockedExchangeAdd8 178 #undef InterlockedExchangeAdd8
174 179
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 HandleScope scope(isolate); 825 HandleScope scope(isolate);
821 DCHECK(args.length() == 1); 826 DCHECK(args.length() == 1);
822 CONVERT_NUMBER_ARG_HANDLE_CHECKED(size, 0); 827 CONVERT_NUMBER_ARG_HANDLE_CHECKED(size, 0);
823 uint32_t usize = NumberToUint32(*size); 828 uint32_t usize = NumberToUint32(*size);
824 829
825 return Runtime::AtomicIsLockFree(usize) ? isolate->heap()->true_value() 830 return Runtime::AtomicIsLockFree(usize) ? isolate->heap()->true_value()
826 : isolate->heap()->false_value(); 831 : isolate->heap()->false_value();
827 } 832 }
828 } 833 }
829 } // namespace v8::internal 834 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698