| Index: runtime/vm/heap.h
|
| diff --git a/runtime/vm/heap.h b/runtime/vm/heap.h
|
| index 2ef3e3cd5d422ddd3f5bcae781cd496032435a07..4a8ae93afaacae64b41fc6437de10ee313139bac 100644
|
| --- a/runtime/vm/heap.h
|
| +++ b/runtime/vm/heap.h
|
| @@ -125,6 +125,9 @@ class Heap {
|
| void CollectGarbage(Space space);
|
| void CollectGarbage(Space space, ApiCallbacks api_callbacks, GCReason reason);
|
| void CollectAllGarbage();
|
| + bool NeedsGarbageCollection() const {
|
| + return old_space_.NeedsGarbageCollection();
|
| + }
|
|
|
| // Enables growth control on the page space heaps. This should be
|
| // called before any user code is executed.
|
| @@ -231,8 +234,6 @@ class Heap {
|
| stats_.data_[id] = value;
|
| }
|
|
|
| - bool gc_in_progress();
|
| -
|
| void UpdateGlobalMaxUsed();
|
|
|
| static bool IsAllocatableInNewSpace(intptr_t size) {
|
| @@ -308,16 +309,24 @@ class Heap {
|
| // ensure thread-safety.
|
| bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const;
|
|
|
| + // Helper functions for garbage collection.
|
| + void CollectNewSpaceGarbage(
|
| + Thread* thread, ApiCallbacks api_callbacks, GCReason reason);
|
| + void CollectOldSpaceGarbage(
|
| + Thread* thread, ApiCallbacks api_callbacks, GCReason reason);
|
| +
|
| // GC stats collection.
|
| void RecordBeforeGC(Space space, GCReason reason);
|
| - void RecordAfterGC();
|
| + void RecordAfterGC(Space space);
|
| void PrintStats();
|
| void UpdateClassHeapStatsBeforeGC(Heap::Space space);
|
| void UpdatePretenurePolicy();
|
|
|
| - // Updates gc_in_progress.
|
| - void BeginGC();
|
| - void EndGC();
|
| + // Updates gc in progress flags.
|
| + bool BeginNewSpaceGC();
|
| + void EndNewSpaceGC();
|
| + bool BeginOldSpaceGC();
|
| + void EndOldSpaceGC();
|
|
|
| // If this heap is non-empty, updates start and end to the smallest range that
|
| // contains both the original [start, end) and the [lowest, highest) addresses
|
| @@ -340,8 +349,9 @@ class Heap {
|
| bool read_only_;
|
|
|
| // GC on the heap is in progress.
|
| - Mutex gc_in_progress_mutex_;
|
| - bool gc_in_progress_;
|
| + Monitor gc_in_progress_monitor_;
|
| + bool gc_new_space_in_progress_;
|
| + bool gc_old_space_in_progress_;
|
|
|
| int pretenure_policy_;
|
|
|
|
|