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

Unified Diff: runtime/vm/heap.cc

Issue 1919363003: Address problem of back to back old gen GC that happens when new gen GC promotions triggers old gen… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/heap.cc
diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc
index 6fd3c3aa0cb60b3fe22d23c5ec0e1938a2840aca..ef4e14cbe5d21520d732074f25da7c7a9fa3b4de 100644
--- a/runtime/vm/heap.cc
+++ b/runtime/vm/heap.cc
@@ -369,6 +369,7 @@ void Heap::UpdateClassHeapStatsBeforeGC(Heap::Space space) {
void Heap::CollectNewSpaceGarbage(Thread* thread,
ApiCallbacks api_callbacks,
GCReason reason) {
+ ASSERT((reason == kNewSpace) || (reason == kFull));
if (BeginNewSpaceGC(thread)) {
bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks);
RecordBeforeGC(kNew, reason);
@@ -381,7 +382,7 @@ void Heap::CollectNewSpaceGarbage(Thread* thread,
RecordAfterGC(kNew);
PrintStats();
EndNewSpaceGC();
- if (old_space_.NeedsGarbageCollection()) {
+ if ((reason == kNewSpace) && old_space_.NeedsGarbageCollection()) {
// Old collections should call the API callbacks.
CollectOldSpaceGarbage(thread, kInvokeApiCallbacks, kPromotion);
}
@@ -392,6 +393,7 @@ void Heap::CollectNewSpaceGarbage(Thread* thread,
void Heap::CollectOldSpaceGarbage(Thread* thread,
ApiCallbacks api_callbacks,
GCReason reason) {
+ ASSERT((reason != kNewSpace));
if (BeginOldSpaceGC(thread)) {
bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks);
RecordBeforeGC(kOld, reason);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698