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

Unified Diff: runtime/vm/heap.h

Issue 1562853003: 1. Add code to grow the heap instead of collecting garbage in Heap::AllocateOld when allocation is … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-code-review-comments Created 4 years, 11 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 | « runtime/vm/compiler.cc ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698