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

Side by Side Diff: runtime/vm/atomic_win.h

Issue 2344263002: Fix bad commit of stale patch set of original CL "Make NoReloadScope thread safe" (Closed)
Patch Set: Created 4 years, 3 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 | « runtime/vm/atomic_macos.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 InterlockedIncrement64(reinterpret_cast<LONGLONG*>(p))) - 1; 21 InterlockedIncrement64(reinterpret_cast<LONGLONG*>(p))) - 1;
22 #elif defined(HOST_ARCH_IA32) 22 #elif defined(HOST_ARCH_IA32)
23 return static_cast<uintptr_t>( 23 return static_cast<uintptr_t>(
24 InterlockedIncrement(reinterpret_cast<LONG*>(p))) - 1; 24 InterlockedIncrement(reinterpret_cast<LONG*>(p))) - 1;
25 #else 25 #else
26 #error Unsupported host architecture. 26 #error Unsupported host architecture.
27 #endif 27 #endif
28 } 28 }
29 29
30 30
31 inline intptr_t AtomicOperations::FetchAndIncrement(intptr_t* p) {
32 #if defined(HOST_ARCH_X64)
33 return static_cast<intptr_t>(
34 InterlockedIncrement64(reinterpret_cast<LONGLONG*>(p))) - 1;
35 #elif defined(HOST_ARCH_IA32)
36 return static_cast<intptr_t>(
37 InterlockedIncrement(reinterpret_cast<LONG*>(p))) - 1;
38 #else
39 #error Unsupported host architecture.
40 #endif
41 }
42
43
31 inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) { 44 inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) {
32 #if defined(HOST_ARCH_X64) 45 #if defined(HOST_ARCH_X64)
33 InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p), 46 InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
34 static_cast<LONGLONG>(value)); 47 static_cast<LONGLONG>(value));
35 #elif defined(HOST_ARCH_IA32) 48 #elif defined(HOST_ARCH_IA32)
36 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p), 49 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
37 static_cast<LONG>(value)); 50 static_cast<LONG>(value));
38 #else 51 #else
39 #error Unsupported host architecture. 52 #error Unsupported host architecture.
40 #endif 53 #endif
(...skipping 16 matching lines...) Expand all
57 InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) + 1; 70 InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) + 1;
58 #elif defined(HOST_ARCH_IA32) 71 #elif defined(HOST_ARCH_IA32)
59 return static_cast<uintptr_t>( 72 return static_cast<uintptr_t>(
60 InterlockedDecrement(reinterpret_cast<LONG*>(p))) + 1; 73 InterlockedDecrement(reinterpret_cast<LONG*>(p))) + 1;
61 #else 74 #else
62 #error Unsupported host architecture. 75 #error Unsupported host architecture.
63 #endif 76 #endif
64 } 77 }
65 78
66 79
80 inline intptr_t AtomicOperations::FetchAndDecrement(intptr_t* p) {
81 #if defined(HOST_ARCH_X64)
82 return static_cast<intptr_t>(
83 InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) + 1;
84 #elif defined(HOST_ARCH_IA32)
85 return static_cast<intptr_t>(
86 InterlockedDecrement(reinterpret_cast<LONG*>(p))) + 1;
87 #else
88 #error Unsupported host architecture.
89 #endif
90 }
91
92
67 inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) { 93 inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) {
68 #if defined(HOST_ARCH_X64) 94 #if defined(HOST_ARCH_X64)
69 InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p), 95 InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
70 static_cast<LONGLONG>(-value)); 96 static_cast<LONGLONG>(-value));
71 #elif defined(HOST_ARCH_IA32) 97 #elif defined(HOST_ARCH_IA32)
72 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p), 98 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
73 static_cast<LONG>(-value)); 99 static_cast<LONG>(-value));
74 #else 100 #else
75 #error Unsupported host architecture. 101 #error Unsupported host architecture.
76 #endif 102 #endif
(...skipping 28 matching lines...) Expand all
105 static_cast<LONG>(old_value))); 131 static_cast<LONG>(old_value)));
106 #else 132 #else
107 #error Unsupported host architecture. 133 #error Unsupported host architecture.
108 #endif 134 #endif
109 } 135 }
110 #endif // !defined(USING_SIMULATOR) 136 #endif // !defined(USING_SIMULATOR)
111 137
112 } // namespace dart 138 } // namespace dart
113 139
114 #endif // VM_ATOMIC_WIN_H_ 140 #endif // VM_ATOMIC_WIN_H_
OLDNEW
« no previous file with comments | « runtime/vm/atomic_macos.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698