| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_ATOMIC_H_ | 5 #ifndef VM_ATOMIC_H_ |
| 6 #define VM_ATOMIC_H_ | 6 #define VM_ATOMIC_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" |
| 9 |
| 8 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| 9 | 11 |
| 10 namespace dart { | 12 namespace dart { |
| 11 | 13 |
| 12 class AtomicOperations : public AllStatic { | 14 class AtomicOperations : public AllStatic { |
| 13 public: | 15 public: |
| 14 // Atomically fetch the value at p and increment the value at p. | 16 // Atomically fetch the value at p and increment the value at p. |
| 15 // Returns the original value at p. | 17 // Returns the original value at p. |
| 16 static uintptr_t FetchAndIncrement(uintptr_t* p); | 18 static uintptr_t FetchAndIncrement(uintptr_t* p); |
| 19 |
| 20 static uword CompareAndSwapWord(uword* ptr, uword old_value, uword new_value); |
| 17 }; | 21 }; |
| 18 | 22 |
| 19 | 23 |
| 20 } // namespace dart | 24 } // namespace dart |
| 21 | 25 |
| 26 #if defined(TARGET_OS_ANDROID) |
| 27 #include "vm/atomic_android.h" |
| 28 #elif defined(TARGET_OS_LINUX) |
| 29 #include "vm/atomic_linux.h" |
| 30 #elif defined(TARGET_OS_MACOS) |
| 31 #include "vm/atomic_macos.h" |
| 32 #elif defined(TARGET_OS_WINDOWS) |
| 33 #include "vm/atomic_win.h" |
| 34 #else |
| 35 #error Unknown target os. |
| 36 #endif |
| 37 |
| 22 #endif // VM_ATOMIC_H_ | 38 #endif // VM_ATOMIC_H_ |
| OLD | NEW |