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

Side by Side Diff: src/base/atomic-utils.h

Issue 2428493003: [heap] Reland move slot filtering logic into sweeper. (Closed)
Patch Set: comments Created 4 years, 2 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 | « no previous file | src/heap/mark-compact.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_ATOMIC_UTILS_H_ 5 #ifndef V8_ATOMIC_UTILS_H_
6 #define V8_ATOMIC_UTILS_H_ 6 #define V8_ATOMIC_UTILS_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 9
10 #include "src/base/atomicops.h" 10 #include "src/base/atomicops.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 public: 58 public:
59 NoBarrierAtomicValue() : value_(0) {} 59 NoBarrierAtomicValue() : value_(0) {}
60 60
61 explicit NoBarrierAtomicValue(T initial) 61 explicit NoBarrierAtomicValue(T initial)
62 : value_(cast_helper<T>::to_storage_type(initial)) {} 62 : value_(cast_helper<T>::to_storage_type(initial)) {}
63 63
64 static NoBarrierAtomicValue* FromAddress(void* address) { 64 static NoBarrierAtomicValue* FromAddress(void* address) {
65 return reinterpret_cast<base::NoBarrierAtomicValue<T>*>(address); 65 return reinterpret_cast<base::NoBarrierAtomicValue<T>*>(address);
66 } 66 }
67 67
68 V8_INLINE bool TrySetValue(T old_value, T new_value) {
69 return base::NoBarrier_CompareAndSwap(
70 &value_, cast_helper<T>::to_storage_type(old_value),
71 cast_helper<T>::to_storage_type(new_value)) ==
72 cast_helper<T>::to_storage_type(old_value);
73 }
74
68 V8_INLINE T Value() const { 75 V8_INLINE T Value() const {
69 return cast_helper<T>::to_return_type(base::NoBarrier_Load(&value_)); 76 return cast_helper<T>::to_return_type(base::NoBarrier_Load(&value_));
70 } 77 }
71 78
72 V8_INLINE void SetValue(T new_value) { 79 V8_INLINE void SetValue(T new_value) {
73 base::NoBarrier_Store(&value_, cast_helper<T>::to_storage_type(new_value)); 80 base::NoBarrier_Store(&value_, cast_helper<T>::to_storage_type(new_value));
74 } 81 }
75 82
76 private: 83 private:
77 STATIC_ASSERT(sizeof(T) <= sizeof(base::AtomicWord)); 84 STATIC_ASSERT(sizeof(T) <= sizeof(base::AtomicWord));
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 return static_cast<base::AtomicWord>(1) << element; 245 return static_cast<base::AtomicWord>(1) << element;
239 } 246 }
240 247
241 base::AtomicWord bits_; 248 base::AtomicWord bits_;
242 }; 249 };
243 250
244 } // namespace base 251 } // namespace base
245 } // namespace v8 252 } // namespace v8
246 253
247 #endif // #define V8_ATOMIC_UTILS_H_ 254 #endif // #define V8_ATOMIC_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698