Try to reduce memory footprint when we run out of memory in Deserializer.

BUG=403113
LOG=n

Review URL: https://codereview.chromium.org/831893003

Cr-Commit-Position: refs/heads/master@{#26010}
This commit is contained in:
hpayer 2015-01-09 04:54:07 -08:00 committed by Commit bot
parent 7e98658e31
commit b1bcf6667d

View File

@ -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,13 +963,19 @@ 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),
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.
}