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

Unified Diff: src/heap/spaces.cc

Issue 1371653002: Revert of "[heap] Add more tasks for parallel compaction" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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/spaces.h ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 3d13144b0fad703880e30c365b9cb991c71f1171..b973a4ae60552bcaa707e659bc5cdbe8aadedef0 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -1014,7 +1014,7 @@
// Update and clear accounting statistics.
accounting_stats_.Merge(other->accounting_stats_);
- other->accounting_stats_.Clear();
+ other->accounting_stats_.Reset();
// Move over pages.
PageIterator it(other);
@@ -2211,44 +2211,6 @@
}
-FreeSpace* PagedSpace::TryRemoveMemory() {
- FreeSpace* space = nullptr;
- int node_size = 0;
- space = free_list()->FindNodeIn(FreeList::kHuge, &node_size);
- if (space == nullptr)
- space = free_list()->FindNodeIn(FreeList::kLarge, &node_size);
- if (space == nullptr)
- space = free_list()->FindNodeIn(FreeList::kMedium, &node_size);
- if (space == nullptr)
- space = free_list()->FindNodeIn(FreeList::kSmall, &node_size);
- if (space != nullptr) {
- accounting_stats_.AllocateBytes(node_size);
- }
- return space;
-}
-
-
-void PagedSpace::DivideMemory(CompactionSpaceCollection** other, int num,
- intptr_t limit) {
- CHECK(num > 0);
- CHECK(other != nullptr);
-
- if (limit == 0) limit = std::numeric_limits<intptr_t>::max();
-
- EmptyAllocationInfo();
-
- int index = 0;
- FreeSpace* node = nullptr;
- for (CompactionSpace* space = other[index]->Get(identity());
- ((node = TryRemoveMemory()) != nullptr) &&
- (space->free_list()->available() < limit);
- space = other[++index % num]->Get(identity())) {
- CHECK(space->identity() == identity());
- space->AddMemory(node->address(), node->size());
- }
-}
-
-
void FreeList::Reset() {
small_list_.Reset();
medium_list_.Reset();
@@ -2292,62 +2254,39 @@
}
-void FreeList::UpdateFragmentationStats(FreeListCategoryType category,
- Address address, int size) {
- Page* page = Page::FromAddress(address);
- switch (category) {
- case kSmall:
- page->add_available_in_small_free_list(size);
- break;
- case kMedium:
- page->add_available_in_medium_free_list(size);
- break;
- case kLarge:
- page->add_available_in_large_free_list(size);
- break;
- case kHuge:
- page->add_available_in_huge_free_list(size);
- break;
- default:
- UNREACHABLE();
- }
-}
-
-
-FreeSpace* FreeList::FindNodeIn(FreeListCategoryType category, int* node_size) {
- FreeSpace* node = GetFreeListCategory(category)->PickNodeFromList(node_size);
- if (node != nullptr) {
- UpdateFragmentationStats(category, node->address(), -(*node_size));
- DCHECK(IsVeryLong() || available() == SumFreeLists());
- }
- return node;
-}
-
-
FreeSpace* FreeList::FindNodeFor(int size_in_bytes, int* node_size) {
FreeSpace* node = NULL;
Page* page = NULL;
if (size_in_bytes <= kSmallAllocationMax) {
- node = FindNodeIn(kSmall, node_size);
- if (node != nullptr) {
- DCHECK(size_in_bytes <= node->size());
+ node = small_list_.PickNodeFromList(node_size);
+ if (node != NULL) {
+ DCHECK(size_in_bytes <= *node_size);
+ page = Page::FromAddress(node->address());
+ page->add_available_in_small_free_list(-(*node_size));
+ DCHECK(IsVeryLong() || available() == SumFreeLists());
return node;
}
}
if (size_in_bytes <= kMediumAllocationMax) {
- node = FindNodeIn(kMedium, node_size);
- if (node != nullptr) {
- DCHECK(size_in_bytes <= node->size());
+ node = medium_list_.PickNodeFromList(node_size);
+ if (node != NULL) {
+ DCHECK(size_in_bytes <= *node_size);
+ page = Page::FromAddress(node->address());
+ page->add_available_in_medium_free_list(-(*node_size));
+ DCHECK(IsVeryLong() || available() == SumFreeLists());
return node;
}
}
if (size_in_bytes <= kLargeAllocationMax) {
- node = FindNodeIn(kLarge, node_size);
- if (node != nullptr) {
- DCHECK(size_in_bytes <= node->size());
+ node = large_list_.PickNodeFromList(node_size);
+ if (node != NULL) {
+ DCHECK(size_in_bytes <= *node_size);
+ page = Page::FromAddress(node->address());
+ page->add_available_in_large_free_list(-(*node_size));
+ DCHECK(IsVeryLong() || available() == SumFreeLists());
return node;
}
}
@@ -2603,6 +2542,7 @@
(unswept_free_bytes_ == 0));
const intptr_t size = Size() - unswept_free_bytes_ - (limit() - top());
DCHECK_GE(size, 0);
+ USE(size);
return size;
}
« no previous file with comments | « src/heap/spaces.h ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698