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

Unified Diff: src/heap/spaces.cc

Issue 1354383002: [heap] Add more tasks for parallel compaction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix accounting of memory shared among paged spaces 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
« src/heap/spaces.h ('K') | « src/heap/spaces.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.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 259ee75e0d09b978c8ac6ed93ac3e18331a346fd..c565fe75093484b49c21696a9274496ba7fd4d41 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -2218,6 +2218,46 @@ intptr_t FreeList::Concatenate(FreeList* free_list) {
}
+void FreeList::Divide(FreeList** free_lists, int num, intptr_t limit) {
+ CHECK(num > 0);
+ CHECK(free_lists != nullptr);
+ if (limit == 0) {
+ limit = std::numeric_limits<intptr_t>::max();
+ }
+ int size = 0;
+ int cnt = 0;
+ FreeSpace* space = nullptr;
+ while (((space = huge_list_.PickNodeFromList(&size)) != nullptr) &&
+ (free_lists[cnt % num]->available() < limit)) {
+ owner()->RemoveMemory(size);
+ free_lists[cnt % num]->huge_list_.owner()->owner()->AddExternalMemory(
+ space->address(), size);
+ cnt++;
+ }
+ while (((space = large_list_.PickNodeFromList(&size)) != nullptr) &&
+ (free_lists[cnt % num]->available() < limit)) {
+ owner()->RemoveMemory(size);
+ free_lists[cnt % num]->large_list_.owner()->owner()->AddExternalMemory(
+ space->address(), size);
+ cnt++;
+ }
+ while (((space = medium_list_.PickNodeFromList(&size)) != nullptr) &&
+ (free_lists[cnt % num]->available() < limit)) {
+ owner()->RemoveMemory(size);
+ free_lists[cnt % num]->medium_list_.owner()->owner()->AddExternalMemory(
+ space->address(), size);
+ cnt++;
+ }
+ while (((space = small_list_.PickNodeFromList(&size)) != nullptr) &&
+ (free_lists[cnt % num]->available() < limit)) {
+ owner()->RemoveMemory(size);
+ free_lists[cnt % num]->small_list_.owner()->owner()->AddExternalMemory(
+ space->address(), size);
+ cnt++;
+ }
+}
+
+
void FreeList::Reset() {
small_list_.Reset();
medium_list_.Reset();
« src/heap/spaces.h ('K') | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698