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

Unified Diff: src/heap/heap.cc

Issue 831893003: Try to reduce memory footprint when we run out of memory in Deserializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 0b817e4d6d0c9222539d448ae138529da57d9d9d..a49806fd90ee089f68ee6681f222a389e26a7667 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -922,15 +922,6 @@ static void VerifyStringTable(Heap* heap) {
#endif // VERIFY_HEAP
-static bool AbortIncrementalMarkingAndCollectGarbage(
- Heap* heap, AllocationSpace space, const char* gc_reason = NULL) {
- heap->mark_compact_collector()->SetFlags(Heap::kAbortIncrementalMarkingMask);
- bool result = heap->CollectGarbage(space, gc_reason);
- heap->mark_compact_collector()->SetFlags(Heap::kNoGCFlags);
- return result;
-}
-
-
bool Heap::ReserveSpace(Reservation* reservations) {
bool gc_performed = true;
int counter = 0;
@@ -972,12 +963,18 @@ bool Heap::ReserveSpace(Reservation* reservations) {
}
if (perform_gc) {
if (space == NEW_SPACE) {
- Heap::CollectGarbage(NEW_SPACE,
- "failed to reserve space in the new space");
+ CollectGarbage(NEW_SPACE, "failed to reserve space in the new space");
} else {
- AbortIncrementalMarkingAndCollectGarbage(
- this, static_cast<AllocationSpace>(space),
- "failed to reserve space in paged or large object space");
+ if (counter > 1) {
+ CollectAllGarbage(
+ kReduceMemoryFootprintMask,
+ "failed to reserve space in paged or large "
+ "object space, trying to reduce memory footprint");
+ } else {
+ CollectAllGarbage(
+ kAbortIncrementalMarkingMask,
+ "failed to reserve space in paged or large object space");
+ }
}
gc_performed = true;
break; // Abort for-loop over spaces and retry.
« 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