Commit bde89439 authored by ulan's avatar ulan Committed by Commit bot

Revert of Remove promotion backup case and report OOM instead. (patchset #2...

Revert of Remove promotion backup case and report OOM instead. (patchset #2 id:20001 of https://codereview.chromium.org/977013003/)

Reason for revert:
Spike in OOM crashes: crbug.com/403113

Original issue's description:
> Remove promotion backup case and report OOM instead.
>
> There are no test cases for this piece of code and it is really hard to test. If this rare case triggers, we are anyway in an OOM situation and would crash probably soon afterwards.
>
> BUG=
>
> Committed: https://crrev.com/e813afaf127ab80290153ab676dc07212bdc8946
> Cr-Commit-Position: refs/heads/master@{#27026}

TBR=mstarzinger@chromium.org,hpayer@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

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

Cr-Commit-Position: refs/heads/master@{#27568}
parent 30ea6268
......@@ -2220,7 +2220,11 @@ class ScavengingVisitor : public StaticVisitorBase {
object_size)) {
return;
}
V8::FatalProcessOutOfMemory("Scavenge promotion failed");
// If promotion failed, we try to copy the object to the other semi-space
if (SemiSpaceCopyObject<alignment>(map, slot, object, object_size)) return;
UNREACHABLE();
}
......
......@@ -1935,27 +1935,26 @@ int MarkCompactCollector::DiscoverAndEvacuateBlackObjectsOnPage(
current_cell >>= 1;
// TODO(hpayer): Refactor EvacuateObject and call this function instead.
if (heap()->ShouldBePromoted(object->address(), size)) {
if (!TryPromoteObject(object, size)) {
V8::FatalProcessOutOfMemory("Full GC promotion failed");
}
} else {
AllocationResult allocation = new_space->AllocateRaw(size);
if (allocation.IsRetry()) {
if (!new_space->AddFreshPage()) {
// Shouldn't happen. We are sweeping linearly, and to-space
// has the same number of pages as from-space, so there is
// always room.
UNREACHABLE();
}
allocation = new_space->AllocateRaw(size);
DCHECK(!allocation.IsRetry());
}
Object* target = allocation.ToObjectChecked();
if (heap()->ShouldBePromoted(object->address(), size) &&
TryPromoteObject(object, size)) {
continue;
}
MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE);
heap()->IncrementSemiSpaceCopiedObjectSize(size);
AllocationResult allocation = new_space->AllocateRaw(size);
if (allocation.IsRetry()) {
if (!new_space->AddFreshPage()) {
// Shouldn't happen. We are sweeping linearly, and to-space
// has the same number of pages as from-space, so there is
// always room.
UNREACHABLE();
}
allocation = new_space->AllocateRaw(size);
DCHECK(!allocation.IsRetry());
}
Object* target = allocation.ToObjectChecked();
MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE);
heap()->IncrementSemiSpaceCopiedObjectSize(size);
}
*cells = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment