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_WIN_H_ | 5 #ifndef VM_ATOMIC_WIN_H_ |
6 #define VM_ATOMIC_WIN_H_ | 6 #define VM_ATOMIC_WIN_H_ |
7 | 7 |
8 #if !defined VM_ATOMIC_H_ | 8 #if !defined VM_ATOMIC_H_ |
9 #error Do not include atomic_win.h directly. Use atomic.h instead. | 9 #error Do not include atomic_win.h directly. Use atomic.h instead. |
10 #endif | 10 #endif |
(...skipping 23 matching lines...) Expand all Loading... |
34 static_cast<LONGLONG>(value)); | 34 static_cast<LONGLONG>(value)); |
35 #elif defined(HOST_ARCH_IA32) | 35 #elif defined(HOST_ARCH_IA32) |
36 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p), | 36 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p), |
37 static_cast<LONG>(value)); | 37 static_cast<LONG>(value)); |
38 #else | 38 #else |
39 #error Unsupported host architecture. | 39 #error Unsupported host architecture. |
40 #endif | 40 #endif |
41 } | 41 } |
42 | 42 |
43 | 43 |
| 44 inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) { |
| 45 #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) |
| 46 InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p), |
| 47 static_cast<LONGLONG>(value)); |
| 48 #else |
| 49 #error Unsupported host architecture. |
| 50 #endif |
| 51 } |
| 52 |
| 53 |
44 inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) { | 54 inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) { |
45 #if defined(HOST_ARCH_X64) | 55 #if defined(HOST_ARCH_X64) |
46 return static_cast<uintptr_t>( | 56 return static_cast<uintptr_t>( |
47 InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) + 1; | 57 InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) + 1; |
48 #elif defined(HOST_ARCH_IA32) | 58 #elif defined(HOST_ARCH_IA32) |
49 return static_cast<uintptr_t>( | 59 return static_cast<uintptr_t>( |
50 InterlockedDecrement(reinterpret_cast<LONG*>(p))) + 1; | 60 InterlockedDecrement(reinterpret_cast<LONG*>(p))) + 1; |
51 #else | 61 #else |
52 #error Unsupported host architecture. | 62 #error Unsupported host architecture. |
53 #endif | 63 #endif |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 static_cast<LONG>(old_value))); | 105 static_cast<LONG>(old_value))); |
96 #else | 106 #else |
97 #error Unsupported host architecture. | 107 #error Unsupported host architecture. |
98 #endif | 108 #endif |
99 } | 109 } |
100 #endif // !defined(USING_SIMULATOR) | 110 #endif // !defined(USING_SIMULATOR) |
101 | 111 |
102 } // namespace dart | 112 } // namespace dart |
103 | 113 |
104 #endif // VM_ATOMIC_WIN_H_ | 114 #endif // VM_ATOMIC_WIN_H_ |
OLD | NEW |