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

Unified Diff: src/heap/spaces.h

Issue 1382003002: [heap] Divide available memory upon compaction tasks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@counters
Patch Set: Rework tests 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
Index: src/heap/spaces.h
diff --git a/src/heap/spaces.h b/src/heap/spaces.h
index 69a8d89fccba5c5aa06f91d2a1995870b70ef033..12d47961c6b3efc04bb724e311716a5861be6707 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -19,6 +19,7 @@
namespace v8 {
namespace internal {
+class CompactionSpaceCollection;
class Isolate;
// -----------------------------------------------------------------------------
@@ -1726,6 +1727,11 @@ class FreeList {
// The size should be a non-zero multiple of the word size.
MUST_USE_RESULT HeapObject* Allocate(int size_in_bytes);
+ // The method tries to find a block of at least {size_in_bytes} size.
+ //
+ // Can be used concurrently.
+ MUST_USE_RESULT FreeSpace* TryRemoveMemory(intptr_t size_in_bytes);
+
bool IsEmpty() {
return small_list_.IsEmpty() && medium_list_.IsEmpty() &&
large_list_.IsEmpty() && huge_list_.IsEmpty();
@@ -1780,7 +1786,6 @@ class FreeList {
return nullptr;
}
-
PagedSpace* owner_;
Heap* heap_;
base::Mutex mutex_;
@@ -2040,15 +2045,22 @@ 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);
-
- virtual bool is_local() { return false; }
+ void DivideUponCompactionSpaces(CompactionSpaceCollection** other, int num,
+ intptr_t limit);
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; }
@@ -2109,6 +2121,9 @@ class PagedSpace : public Space {
friend class MarkCompactCollector;
friend class PageIterator;
+
+ // Used in cctest.
+ friend class HeapTester;
};

Powered by Google App Engine
This is Rietveld 408576698