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

Unified Diff: third_party/WebKit/Source/platform/heap/Heap.h

Issue 2531973002: Simple BlinkGC heap compaction. (Closed)
Patch Set: tidy up comment Created 4 years, 1 month 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: third_party/WebKit/Source/platform/heap/Heap.h
diff --git a/third_party/WebKit/Source/platform/heap/Heap.h b/third_party/WebKit/Source/platform/heap/Heap.h
index b02aa40e4b2e6110da6cbba0741dca57fb291d54..69fe2e4d4d62d4b6551702f0217d26a52fe54541 100644
--- a/third_party/WebKit/Source/platform/heap/Heap.h
+++ b/third_party/WebKit/Source/platform/heap/Heap.h
@@ -81,6 +81,7 @@ class PLATFORM_EXPORT HeapAllocHooks {
};
class CrossThreadPersistentRegion;
+class HeapCompact;
template <typename T>
class Member;
template <typename T>
@@ -381,6 +382,31 @@ class PLATFORM_EXPORT ThreadHeap {
bool weakTableRegistered(const void*);
#endif
+ // Heap compaction registration methods:
+
+ // Register |slot| as containing a reference to a movable heap object.
+ //
+ // When compaction moves the object pointed to by |*slot| to |newAddress|,
+ // |*slot| must be updated to hold |newAddress| instead.
+ void registerMovingObjectReference(MovableReference*);
+
+ // Register a callback to be invoked upon moving the object starting at
+ // |reference|; see |MovingObjectCallback| documentation for details.
+ //
+ // This callback mechanism is needed to account for backing store objects
+ // containing intra-object pointers, all of which must be relocated/rebased
+ // to be done wrt the moved-to location.
+ //
+ // For Blink, |LinkedHashSet<>| is currently the only abstraction which
+ // relies on this feature.
+ void registerMovingObjectCallback(MovableReference,
+ MovingObjectCallback,
+ void* callbackData);
+
+ // Register a relocation; when |*slot| is compacted and moved,
+ // |slot| must be updated to point to |*slot|'s new location.
+ void registerRelocation(MovableReference* slot);
haraken 2016/11/30 06:29:52 What's a difference between registerMovingObjectRe
sof 2016/11/30 06:52:43 Have a look at the documentation of HeapCompact::r
+
BlinkGC::GCReason lastGCReason() { return m_lastGCReason; }
RegionTree* getRegionTree() { return m_regionTree.get(); }
@@ -438,6 +464,8 @@ class PLATFORM_EXPORT ThreadHeap {
static void reportMemoryUsageHistogram();
static void reportMemoryUsageForTracing();
+ HeapCompact* compaction();
+
private:
// Reset counters that track live and allocated-since-last-GC sizes.
void resetHeapCounters();
@@ -463,6 +491,8 @@ class PLATFORM_EXPORT ThreadHeap {
BlinkGC::GCReason m_lastGCReason;
StackFrameDepth m_stackFrameDepth;
+ std::unique_ptr<HeapCompact> m_compaction;
+
static ThreadHeap* s_mainThreadHeap;
friend class ThreadState;

Powered by Google App Engine
This is Rietveld 408576698