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

Side by Side Diff: src/heap/marking.h

Issue 2912773002: Rename "NoBarrier" memory operations to "Relaxed". (Closed)
Patch Set: comment Created 3 years, 6 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 | « src/heap/mark-compact.cc ('k') | src/heap/objects-visiting.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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_MARKING_H 5 #ifndef V8_MARKING_H
6 #define V8_MARKING_H 6 #define V8_MARKING_H
7 7
8 #include "src/base/atomic-utils.h" 8 #include "src/base/atomic-utils.h"
9 #include "src/utils.h" 9 #include "src/utils.h"
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 base::Atomic32 old_value = *cell_; 64 base::Atomic32 old_value = *cell_;
65 *cell_ = old_value | mask_; 65 *cell_ = old_value | mask_;
66 return (old_value & mask_) == 0; 66 return (old_value & mask_) == 0;
67 } 67 }
68 68
69 template <> 69 template <>
70 inline bool MarkBit::Set<MarkBit::ATOMIC>() { 70 inline bool MarkBit::Set<MarkBit::ATOMIC>() {
71 base::Atomic32 old_value; 71 base::Atomic32 old_value;
72 base::Atomic32 new_value; 72 base::Atomic32 new_value;
73 do { 73 do {
74 old_value = base::NoBarrier_Load(cell_); 74 old_value = base::Relaxed_Load(cell_);
75 if (old_value & mask_) return false; 75 if (old_value & mask_) return false;
76 new_value = old_value | mask_; 76 new_value = old_value | mask_;
77 } while (base::Release_CompareAndSwap(cell_, old_value, new_value) != 77 } while (base::Release_CompareAndSwap(cell_, old_value, new_value) !=
78 old_value); 78 old_value);
79 return true; 79 return true;
80 } 80 }
81 81
82 template <> 82 template <>
83 inline bool MarkBit::Get<MarkBit::NON_ATOMIC>() { 83 inline bool MarkBit::Get<MarkBit::NON_ATOMIC>() {
84 return (base::NoBarrier_Load(cell_) & mask_) != 0; 84 return (base::Relaxed_Load(cell_) & mask_) != 0;
85 } 85 }
86 86
87 template <> 87 template <>
88 inline bool MarkBit::Get<MarkBit::ATOMIC>() { 88 inline bool MarkBit::Get<MarkBit::ATOMIC>() {
89 return (base::Acquire_Load(cell_) & mask_) != 0; 89 return (base::Acquire_Load(cell_) & mask_) != 0;
90 } 90 }
91 91
92 template <> 92 template <>
93 inline bool MarkBit::Clear<MarkBit::NON_ATOMIC>() { 93 inline bool MarkBit::Clear<MarkBit::NON_ATOMIC>() {
94 base::Atomic32 old_value = *cell_; 94 base::Atomic32 old_value = *cell_;
95 *cell_ = old_value & ~mask_; 95 *cell_ = old_value & ~mask_;
96 return (old_value & mask_) == mask_; 96 return (old_value & mask_) == mask_;
97 } 97 }
98 98
99 template <> 99 template <>
100 inline bool MarkBit::Clear<MarkBit::ATOMIC>() { 100 inline bool MarkBit::Clear<MarkBit::ATOMIC>() {
101 base::Atomic32 old_value; 101 base::Atomic32 old_value;
102 base::Atomic32 new_value; 102 base::Atomic32 new_value;
103 do { 103 do {
104 old_value = base::NoBarrier_Load(cell_); 104 old_value = base::Relaxed_Load(cell_);
105 if (!(old_value & mask_)) return false; 105 if (!(old_value & mask_)) return false;
106 new_value = old_value & ~mask_; 106 new_value = old_value & ~mask_;
107 } while (base::Release_CompareAndSwap(cell_, old_value, new_value) != 107 } while (base::Release_CompareAndSwap(cell_, old_value, new_value) !=
108 old_value); 108 old_value);
109 return true; 109 return true;
110 } 110 }
111 111
112 // Bitmap is a sequence of cells each containing fixed number of bits. 112 // Bitmap is a sequence of cells each containing fixed number of bits.
113 class Bitmap { 113 class Bitmap {
114 public: 114 public:
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 461
462 private: 462 private:
463 DISALLOW_IMPLICIT_CONSTRUCTORS(Marking); 463 DISALLOW_IMPLICIT_CONSTRUCTORS(Marking);
464 }; 464 };
465 465
466 } // namespace internal 466 } // namespace internal
467 } // namespace v8 467 } // namespace v8
468 468
469 #endif // V8_MARKING_H_ 469 #endif // V8_MARKING_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698