Index: src/heap/spaces.h |
diff --git a/src/heap/spaces.h b/src/heap/spaces.h |
index ff27d09c3aac38b2eedf1bda874fa3d3fc1ebcde..5a57a30a30dd3a7d78fd3999d5a4556005725133 100644 |
--- a/src/heap/spaces.h |
+++ b/src/heap/spaces.h |
@@ -670,9 +670,9 @@ class MarkingState { |
MarkingState(Bitmap* bitmap, intptr_t* live_bytes) |
: bitmap_(bitmap), live_bytes_(live_bytes) {} |
- void IncrementLiveBytes(intptr_t by) const { |
- *live_bytes_ += static_cast<int>(by); |
- } |
+ template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC> |
+ inline void IncrementLiveBytes(intptr_t by) const; |
+ |
void SetLiveBytes(intptr_t value) const { |
*live_bytes_ = static_cast<int>(value); |
} |
@@ -690,6 +690,18 @@ class MarkingState { |
intptr_t* live_bytes_; |
}; |
+template <> |
+inline void MarkingState::IncrementLiveBytes<MarkBit::NON_ATOMIC>( |
+ intptr_t by) const { |
+ *live_bytes_ += by; |
+} |
+ |
+template <> |
+inline void MarkingState::IncrementLiveBytes<MarkBit::ATOMIC>( |
+ intptr_t by) const { |
+ reinterpret_cast<base::AtomicNumber<intptr_t>*>(live_bytes_)->Increment(by); |
+} |
+ |
// ----------------------------------------------------------------------------- |
// A page is a memory chunk of a size 1MB. Large object pages may be larger. |
// |