Commit 66e9596c authored by Hannes Payer's avatar Hannes Payer Committed by Commit Bot

[heap] Cleanup: Use std::atomic<T> instead of base::AtomicNumber<T> in mark-compact.

Bug: chromium:842083
Change-Id: Ie09b02bfe3fbc4f9ad2486843349d0f896b87b39
Reviewed-on: https://chromium-review.googlesource.com/1075532
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53401}
parent d4258eb1
......@@ -3962,10 +3962,9 @@ class YoungGenerationMarkingTask : public ItemParallelJob::Task {
class PageMarkingItem : public MarkingItem {
public:
explicit PageMarkingItem(MemoryChunk* chunk,
base::AtomicNumber<intptr_t>* global_slots)
explicit PageMarkingItem(MemoryChunk* chunk, std::atomic<int>* global_slots)
: chunk_(chunk), global_slots_(global_slots), slots_(0) {}
virtual ~PageMarkingItem() { global_slots_->Increment(slots_); }
virtual ~PageMarkingItem() { *global_slots_ = *global_slots_ + slots_; }
void Process(YoungGenerationMarkingTask* task) override {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"),
......@@ -4016,8 +4015,8 @@ class PageMarkingItem : public MarkingItem {
}
MemoryChunk* chunk_;
base::AtomicNumber<intptr_t>* global_slots_;
intptr_t slots_;
std::atomic<int>* global_slots_;
int slots_;
};
class GlobalHandlesMarkingItem : public MarkingItem {
......@@ -4067,7 +4066,7 @@ class GlobalHandlesMarkingItem : public MarkingItem {
void MinorMarkCompactCollector::MarkRootSetInParallel(
RootMarkingVisitor* root_visitor) {
base::AtomicNumber<intptr_t> slots;
std::atomic<int> slots;
{
ItemParallelJob job(isolate()->cancelable_task_manager(),
&page_parallel_job_semaphore_);
......@@ -4100,7 +4099,7 @@ void MinorMarkCompactCollector::MarkRootSetInParallel(
DCHECK(worklist()->IsGlobalEmpty());
}
}
old_to_new_slots_ = static_cast<int>(slots.Value());
old_to_new_slots_ = slots;
}
void MinorMarkCompactCollector::MarkLiveObjects() {
......
......@@ -315,21 +315,15 @@ class MinorMarkingState final
}
void IncrementLiveBytes(MemoryChunk* chunk, intptr_t by) {
reinterpret_cast<base::AtomicNumber<intptr_t>*>(
&chunk->young_generation_live_byte_count_)
->Increment(by);
chunk->young_generation_live_byte_count_ += by;
}
intptr_t live_bytes(MemoryChunk* chunk) const {
return reinterpret_cast<base::AtomicNumber<intptr_t>*>(
&chunk->young_generation_live_byte_count_)
->Value();
return chunk->young_generation_live_byte_count_;
}
void SetLiveBytes(MemoryChunk* chunk, intptr_t value) {
reinterpret_cast<base::AtomicNumber<intptr_t>*>(
&chunk->young_generation_live_byte_count_)
->SetValue(value);
chunk->young_generation_live_byte_count_ = value;
}
};
......@@ -384,19 +378,15 @@ class MajorAtomicMarkingState final
}
void IncrementLiveBytes(MemoryChunk* chunk, intptr_t by) {
reinterpret_cast<base::AtomicNumber<intptr_t>*>(&chunk->live_byte_count_)
->Increment(by);
chunk->live_byte_count_ += by;
}
intptr_t live_bytes(MemoryChunk* chunk) const {
return reinterpret_cast<base::AtomicNumber<intptr_t>*>(
&chunk->live_byte_count_)
->Value();
return chunk->live_byte_count_;
}
void SetLiveBytes(MemoryChunk* chunk, intptr_t value) {
reinterpret_cast<base::AtomicNumber<intptr_t>*>(&chunk->live_byte_count_)
->SetValue(value);
chunk->live_byte_count_ = value;
}
};
......
......@@ -357,7 +357,7 @@ class MemoryChunk {
+ kPointerSize // Address owner_
+ kPointerSize // Heap* heap_
+ kIntptrSize // intptr_t progress_bar_
+ kIntptrSize // intptr_t live_byte_count_
+ kIntptrSize // std::atomic<intptr_t> live_byte_count_
+ kPointerSize * NUMBER_OF_REMEMBERED_SET_TYPES // SlotSet* array
+ kPointerSize * NUMBER_OF_REMEMBERED_SET_TYPES // TypedSlotSet* array
+ kPointerSize // InvalidatedSlots* invalidated_slots_
......@@ -372,8 +372,8 @@ class MemoryChunk {
+ kPointerSize * 2 // base::ListNode
+ kPointerSize * kNumberOfCategories
// FreeListCategory categories_[kNumberOfCategories]
+ kPointerSize // LocalArrayBufferTracker* local_tracker_
+ kIntptrSize // intptr_t young_generation_live_byte_count_
+ kPointerSize // LocalArrayBufferTracker* local_tracker_
+ kIntptrSize // std::atomic<intptr_t> young_generation_live_byte_count_
+ kPointerSize; // Bitmap* young_generation_bitmap_
// We add some more space to the computed header size to amount for missing
......@@ -649,7 +649,7 @@ class MemoryChunk {
intptr_t progress_bar_;
// Count of bytes marked black on page.
intptr_t live_byte_count_;
std::atomic<intptr_t> live_byte_count_;
// A single slot set for small pages (of size kPageSize) or an array of slot
// set for large pages. In the latter case the number of entries in the array
......@@ -696,7 +696,7 @@ class MemoryChunk {
LocalArrayBufferTracker* local_tracker_;
intptr_t young_generation_live_byte_count_;
std::atomic<intptr_t> young_generation_live_byte_count_;
Bitmap* young_generation_bitmap_;
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment