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

Unified Diff: src/heap/spaces.h

Issue 1421583002: Reland "[heap] Divide available memory upon compaction tasks" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: s/+1/+kPointerSize/ Created 5 years, 2 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/mark-compact.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.h
diff --git a/src/heap/spaces.h b/src/heap/spaces.h
index 058ac89c9609b22bfc632add20635f3ddf5b0346..6df3fe7876cf42baccbc2d7097e20ba59a6c31b4 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -19,6 +19,7 @@
namespace v8 {
namespace internal {
+class CompactionSpaceCollection;
class Isolate;
// -----------------------------------------------------------------------------
@@ -1748,6 +1749,14 @@ class FreeList {
large_list_.available() + huge_list_.available();
}
+ // The method tries to find a {FreeSpace} node of at least {size_in_bytes}
+ // size in the free list category exactly matching the size. If no suitable
+ // node could be found, the method falls back to retrieving a {FreeSpace}
+ // from the large or huge free list category.
+ //
+ // Can be used concurrently.
+ MUST_USE_RESULT FreeSpace* TryRemoveMemory(intptr_t hint_size_in_bytes);
+
bool IsEmpty() {
return small_list_.IsEmpty() && medium_list_.IsEmpty() &&
large_list_.IsEmpty() && huge_list_.IsEmpty();
@@ -1859,6 +1868,8 @@ STATIC_ASSERT(sizeof(AllocationResult) == kPointerSize);
class PagedSpace : public Space {
public:
+ static const intptr_t kCompactionMemoryWanted = 500 * KB;
+
// Creates a space with an id.
PagedSpace(Heap* heap, AllocationSpace id, Executability executable);
@@ -2060,15 +2071,26 @@ class PagedSpace : public Space {
// Return size of allocatable area on a page in this space.
inline int AreaSize() { return area_size_; }
+ virtual bool is_local() { return false; }
+
// Merges {other} into the current space. Note that this modifies {other},
// e.g., removes its bump pointer area and resets statistics.
void MergeCompactionSpace(CompactionSpace* other);
- void MoveOverFreeMemory(PagedSpace* other);
+ void DivideUponCompactionSpaces(CompactionSpaceCollection** other, int num,
+ intptr_t limit = kCompactionMemoryWanted);
- virtual bool is_local() { return false; }
+ // Refills the free list from the corresponding free list filled by the
+ // sweeper.
+ virtual void RefillFreeList();
protected:
+ void AddMemory(Address start, intptr_t size);
+
+ FreeSpace* TryRemoveMemory(intptr_t size_in_bytes);
+
+ void MoveOverFreeMemory(PagedSpace* other);
+
// PagedSpaces that should be included in snapshots have different, i.e.,
// smaller, initial pages.
virtual bool snapshotable() { return true; }
@@ -2129,6 +2151,9 @@ class PagedSpace : public Space {
friend class MarkCompactCollector;
friend class PageIterator;
+
+ // Used in cctest.
+ friend class HeapTester;
};
@@ -2806,11 +2831,13 @@ class CompactionSpace : public PagedSpace {
Free(start, size_in_bytes);
}
- virtual bool is_local() { return true; }
+ virtual bool is_local() override { return true; }
+
+ virtual void RefillFreeList() override;
protected:
// The space is temporary and not included in any snapshots.
- virtual bool snapshotable() { return false; }
+ virtual bool snapshotable() override { return false; }
};
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698