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

Unified Diff: src/heap/spaces.h

Issue 2836583002: [heap] Allow concurrently transferring colors (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
//
« no previous file with comments | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698