[heap] Micro optimizations for almost empty heaps
Bug: chromium:651354 Change-Id: If2a67a7166e412affad7e71eb06087cc1478892c Reviewed-on: https://chromium-review.googlesource.com/512825 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#45494}
This commit is contained in:
parent
cc1aae2812
commit
611ec69d85
@ -2548,7 +2548,7 @@ class MinorMarkCompactCollector::RootMarkingVisitorSeedOnly
|
||||
// Bundling several objects together in items avoids issues with allocating
|
||||
// and deallocating items; both are operations that are performed on the main
|
||||
// thread.
|
||||
static const int kBufferSize = 32;
|
||||
static const int kBufferSize = 128;
|
||||
|
||||
void AddObject(Object* object) {
|
||||
buffered_objects_.push_back(object);
|
||||
@ -3827,6 +3827,7 @@ void MarkCompactCollector::EvacuatePagesInParallel() {
|
||||
|
||||
for (Page* page : new_space_evacuation_pages_) {
|
||||
intptr_t live_bytes_on_page = MarkingState::Internal(page).live_bytes();
|
||||
if (live_bytes_on_page == 0 && !page->contains_array_buffers()) continue;
|
||||
live_bytes += live_bytes_on_page;
|
||||
if (ShouldMovePage(page, live_bytes_on_page)) {
|
||||
if (page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK)) {
|
||||
@ -3837,7 +3838,7 @@ void MarkCompactCollector::EvacuatePagesInParallel() {
|
||||
}
|
||||
job.AddPage(page, {marking_state(page)});
|
||||
}
|
||||
DCHECK_GE(job.NumberOfPages(), 1);
|
||||
if (job.NumberOfPages() == 0) return;
|
||||
|
||||
RecordMigratedSlotVisitor record_visitor(this);
|
||||
CreateAndExecuteEvacuationTasks<FullEvacuator>(this, &job, &record_visitor,
|
||||
@ -3853,6 +3854,7 @@ void MinorMarkCompactCollector::EvacuatePagesInParallel() {
|
||||
|
||||
for (Page* page : new_space_evacuation_pages_) {
|
||||
intptr_t live_bytes_on_page = marking_state(page).live_bytes();
|
||||
if (live_bytes_on_page == 0 && !page->contains_array_buffers()) continue;
|
||||
live_bytes += live_bytes_on_page;
|
||||
if (ShouldMovePage(page, live_bytes_on_page)) {
|
||||
if (page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK)) {
|
||||
@ -3863,7 +3865,7 @@ void MinorMarkCompactCollector::EvacuatePagesInParallel() {
|
||||
}
|
||||
job.AddPage(page, {marking_state(page)});
|
||||
}
|
||||
DCHECK_GE(job.NumberOfPages(), 1);
|
||||
if (job.NumberOfPages() == 0) return;
|
||||
|
||||
YoungGenerationMigrationObserver observer(heap(),
|
||||
heap()->mark_compact_collector());
|
||||
|
@ -1111,6 +1111,10 @@ bool MemoryAllocator::CommitExecutableMemory(base::VirtualMemory* vm,
|
||||
// -----------------------------------------------------------------------------
|
||||
// MemoryChunk implementation
|
||||
|
||||
bool MemoryChunk::contains_array_buffers() {
|
||||
return local_tracker() != nullptr && !local_tracker()->IsEmpty();
|
||||
}
|
||||
|
||||
void MemoryChunk::ReleaseAllocatedMemory() {
|
||||
if (skip_list_ != nullptr) {
|
||||
delete skip_list_;
|
||||
|
@ -455,6 +455,7 @@ class MemoryChunk {
|
||||
}
|
||||
|
||||
inline LocalArrayBufferTracker* local_tracker() { return local_tracker_; }
|
||||
bool contains_array_buffers();
|
||||
|
||||
template <RememberedSetType type>
|
||||
SlotSet* AllocateSlotSet();
|
||||
|
Loading…
Reference in New Issue
Block a user