Changeset 99374 in webkit for trunk/Source/JavaScriptCore/wtf/Atomics.h
- Timestamp:
- Nov 6, 2011, 3:39:12 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/wtf/Atomics.h
r98937 r99374 127 127 "lock; cmpxchgl %3, %2\n\t" 128 128 "sete %1" 129 : "+a"(expected), "= r"(result), "+m"(*location)129 : "+a"(expected), "=q"(result), "+m"(*location) 130 130 : "r"(newValue) 131 131 : "memory" … … 141 141 } 142 142 143 inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* newValue) 144 { 145 // FIXME: Implement COMPARE_AND_SWAP on other architectures and compilers. Currently 146 // it only works on X86 or X86_64 with a GCC-style compiler. 147 #if ENABLE(COMPARE_AND_SWAP) 148 bool result; 149 asm volatile( 150 #if CPU(X86_64) 151 "lock; cmpxchgq %3, %2\n\t" 152 #else 153 "lock; cmpxchgl %3, %2\n\t" 154 #endif 155 "sete %1" 156 : "+a"(expected), "=q"(result), "+m"(*location) 157 : "r"(newValue) 158 : "memory" 159 ); 160 return result; 161 #else // ENABLE(COMPARE_AND_SWAP) 162 UNUSED_PARAM(location); 163 UNUSED_PARAM(expected); 164 UNUSED_PARAM(newValue); 165 CRASH(); 166 return 0; 167 #endif // ENABLE(COMPARE_AND_SWAP) 168 } 169 170 inline bool weakCompareAndSwap(volatile uintptr_t* location, uintptr_t expected, uintptr_t newValue) 171 { 172 return weakCompareAndSwap(reinterpret_cast<void*volatile*>(location), reinterpret_cast<void*>(expected), reinterpret_cast<void*>(newValue)); 173 } 174 143 175 } // namespace WTF 144 176
Note:
See TracChangeset
for help on using the changeset viewer.