Commit b4a97a93 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Make page local counters non-atomic.

Bug: chromium:694255
Change-Id: I8cf30b440055637f91c16df6d3672d9268a2ae83
Reviewed-on: https://chromium-review.googlesource.com/620710
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47427}
parent 59de35b2
...@@ -868,7 +868,7 @@ MemoryChunk* MemoryAllocator::AllocateChunk(size_t reserve_area_size, ...@@ -868,7 +868,7 @@ MemoryChunk* MemoryAllocator::AllocateChunk(size_t reserve_area_size,
executable, owner, &reservation); executable, owner, &reservation);
} }
void Page::ResetAllocatedBytes() { allocated_bytes_.SetValue(area_size()); } void Page::ResetAllocatedBytes() { allocated_bytes_ = area_size(); }
void Page::ResetFreeListStatistics() { void Page::ResetFreeListStatistics() {
wasted_memory_ = 0; wasted_memory_ = 0;
......
...@@ -363,14 +363,15 @@ class MemoryChunk { ...@@ -363,14 +363,15 @@ class MemoryChunk {
+ kIntptrSize // intptr_t live_byte_count_ + kIntptrSize // intptr_t live_byte_count_
+ kPointerSize * NUMBER_OF_REMEMBERED_SET_TYPES // SlotSet* array + kPointerSize * NUMBER_OF_REMEMBERED_SET_TYPES // SlotSet* array
+ kPointerSize * NUMBER_OF_REMEMBERED_SET_TYPES // TypedSlotSet* array + kPointerSize * NUMBER_OF_REMEMBERED_SET_TYPES // TypedSlotSet* array
+ kPointerSize // InvalidatedSlots* invalidated_slots_ + kPointerSize // InvalidatedSlots* invalidated_slots_
+ kPointerSize // SkipList* skip_list_ + kPointerSize // SkipList* skip_list_
+ kPointerSize // AtomicValue high_water_mark_ + kPointerSize // AtomicValue high_water_mark_
+ kPointerSize // base::RecursiveMutex* mutex_ + kPointerSize // base::RecursiveMutex* mutex_
+ kPointerSize // base::AtomicWord concurrent_sweeping_ + kPointerSize // base::AtomicWord concurrent_sweeping_
+ 2 * kSizetSize // AtomicNumber free-list statistics + kSizetSize // size_t allocated_bytes_
+ kPointerSize // AtomicValue next_chunk_ + kSizetSize // size_t wasted_memory_
+ kPointerSize // AtomicValue prev_chunk_ + kPointerSize // AtomicValue next_chunk_
+ kPointerSize // AtomicValue prev_chunk_
+ FreeListCategory::kSize * kNumberOfCategories + FreeListCategory::kSize * kNumberOfCategories
// FreeListCategory categories_[kNumberOfCategories] // FreeListCategory categories_[kNumberOfCategories]
+ kPointerSize // LocalArrayBufferTracker* local_tracker_ + kPointerSize // LocalArrayBufferTracker* local_tracker_
...@@ -679,9 +680,9 @@ class MemoryChunk { ...@@ -679,9 +680,9 @@ class MemoryChunk {
// Byte allocated on the page, which includes all objects on the page // Byte allocated on the page, which includes all objects on the page
// and the linear allocation area. // and the linear allocation area.
base::AtomicNumber<intptr_t> allocated_bytes_; size_t allocated_bytes_;
// Freed memory that was not added to the free list. // Freed memory that was not added to the free list.
base::AtomicNumber<intptr_t> wasted_memory_; size_t wasted_memory_;
// next_chunk_ holds a pointer of type MemoryChunk // next_chunk_ holds a pointer of type MemoryChunk
base::AtomicValue<MemoryChunk*> next_chunk_; base::AtomicValue<MemoryChunk*> next_chunk_;
...@@ -814,17 +815,17 @@ class Page : public MemoryChunk { ...@@ -814,17 +815,17 @@ class Page : public MemoryChunk {
bool is_anchor() { return IsFlagSet(Page::ANCHOR); } bool is_anchor() { return IsFlagSet(Page::ANCHOR); }
size_t wasted_memory() { return wasted_memory_.Value(); } size_t wasted_memory() { return wasted_memory_; }
void add_wasted_memory(size_t waste) { wasted_memory_.Increment(waste); } void add_wasted_memory(size_t waste) { wasted_memory_ += waste; }
size_t allocated_bytes() { return allocated_bytes_.Value(); } size_t allocated_bytes() { return allocated_bytes_; }
void IncreaseAllocatedBytes(size_t bytes) { void IncreaseAllocatedBytes(size_t bytes) {
DCHECK_LE(bytes, area_size()); DCHECK_LE(bytes, area_size());
allocated_bytes_.Increment(bytes); allocated_bytes_ += bytes;
} }
void DecreaseAllocatedBytes(size_t bytes) { void DecreaseAllocatedBytes(size_t bytes) {
DCHECK_LE(bytes, area_size()); DCHECK_LE(bytes, area_size());
DCHECK_GE(allocated_bytes(), bytes); DCHECK_GE(allocated_bytes(), bytes);
allocated_bytes_.Decrement(bytes); allocated_bytes_ -= bytes;
} }
void ResetAllocatedBytes(); void ResetAllocatedBytes();
......
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