| Index: runtime/vm/atomic_win.h
|
| diff --git a/runtime/vm/atomic_win.h b/runtime/vm/atomic_win.h
|
| index 24be3b12c8bc33573215d4fe583a94fa22482974..021f3adc3f9aead55edb0f563d135be09093eafd 100644
|
| --- a/runtime/vm/atomic_win.h
|
| +++ b/runtime/vm/atomic_win.h
|
| @@ -28,6 +28,19 @@ inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) {
|
| }
|
|
|
|
|
| +inline intptr_t AtomicOperations::FetchAndAdd(intptr_t* p, intptr_t delta) {
|
| +#if defined(TARGET_ARCH_X64)
|
| + return static_cast<intptr_t>(
|
| + InterlockedAdd64(reinterpret_cast<LONGLONG*>(p), delta)) - delta;
|
| +#elif defined(TARGET_ARCH_IA32)
|
| + return static_cast<intptr_t>(
|
| + InterlockedAdd(reinterpret_cast<LONG*>(p), delta)) - delta;
|
| +#else
|
| + UNIMPLEMENTED();
|
| +#endif
|
| +}
|
| +
|
| +
|
| #if !defined(USING_SIMULATOR)
|
| inline uword AtomicOperations::CompareAndSwapWord(uword* ptr,
|
| uword old_value,
|
| @@ -48,6 +61,13 @@ inline uword AtomicOperations::CompareAndSwapWord(uword* ptr,
|
| }
|
| #endif // !defined(USING_SIMULATOR)
|
|
|
| +
|
| +inline uword AtomicOperations::LoadRelaxed(uword* ptr) {
|
| + // TODO(koda): Consider using C++11 <atomic> to avoid the barrier on more
|
| + // compilers/platforms.
|
| + return FetchAndAdd(reinterpret_cast<intptr_t*>(ptr), 0);
|
| +}
|
| +
|
| } // namespace dart
|
|
|
| #endif // VM_ATOMIC_WIN_H_
|
|
|