Commit 2ea82355 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] Add flag to crash when evacuation aborts

Add a flag that crashes the process instead of gracefully handling the
abortion of evacuation. The goal of this CL is to check whether we could
get away with simply reporting OOM instead of handling this case.

Change-Id: I6a561ed007c76a111cfb85c454f7f025f07ab9cf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2724272Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73097}
parent 21f09a75
......@@ -1201,6 +1201,9 @@ DEFINE_BOOL(fast_promotion_new_space, false,
DEFINE_BOOL(clear_free_memory, false, "initialize free memory with 0")
DEFINE_BOOL(crash_on_aborted_evacuation, false,
"crash when evacuation of page fails")
DEFINE_BOOL_READONLY(
young_generation_large_objects, true,
"allocates large objects by default in the young generation large "
......
......@@ -3108,9 +3108,13 @@ void FullEvacuator::RawEvacuatePage(MemoryChunk* chunk, intptr_t* live_bytes) {
chunk, marking_state, &old_space_visitor_,
LiveObjectVisitor::kClearMarkbits, &failed_object);
if (!success) {
// Aborted compaction page. Actual processing happens on the main
// thread for simplicity reasons.
collector_->ReportAbortedEvacuationCandidate(failed_object, chunk);
if (FLAG_crash_on_aborted_evacuation) {
heap_->FatalProcessOutOfMemory("FullEvacuator::RawEvacuatePage");
} else {
// Aborted compaction page. Actual processing happens on the main
// thread for simplicity reasons.
collector_->ReportAbortedEvacuationCandidate(failed_object, chunk);
}
}
break;
}
......@@ -3967,6 +3971,9 @@ void MarkCompactCollector::ReportAbortedEvacuationCandidate(
}
void MarkCompactCollector::PostProcessEvacuationCandidates() {
CHECK_IMPLIES(FLAG_crash_on_aborted_evacuation,
aborted_evacuation_candidates_.empty());
for (auto object_and_page : aborted_evacuation_candidates_) {
HeapObject failed_object = object_and_page.first;
Page* page = object_and_page.second;
......
......@@ -43,7 +43,7 @@ void CheckAllObjectsOnPage(const std::vector<Handle<FixedArray>>& handles,
} // namespace
HEAP_TEST(CompactionFullAbortedPage) {
if (FLAG_never_compact) return;
if (FLAG_never_compact || FLAG_crash_on_aborted_evacuation) return;
// Test the scenario where we reach OOM during compaction and the whole page
// is aborted.
......@@ -106,7 +106,7 @@ int GetObjectSize(int objects_per_page) {
} // namespace
HEAP_TEST(CompactionPartiallyAbortedPage) {
if (FLAG_never_compact) return;
if (FLAG_never_compact || FLAG_crash_on_aborted_evacuation) return;
// Test the scenario where we reach OOM during compaction and parts of the
// page have already been migrated to a new one.
......@@ -186,7 +186,7 @@ HEAP_TEST(CompactionPartiallyAbortedPage) {
}
HEAP_TEST(CompactionPartiallyAbortedPageWithInvalidatedSlots) {
if (FLAG_never_compact) return;
if (FLAG_never_compact || FLAG_crash_on_aborted_evacuation) return;
// Test evacuating a page partially when it contains recorded
// slots and invalidated objects.
......@@ -269,7 +269,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithInvalidatedSlots) {
}
HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) {
if (FLAG_never_compact) return;
if (FLAG_never_compact || FLAG_crash_on_aborted_evacuation) return;
// Test the scenario where we reach OOM during compaction and parts of the
// page have already been migrated to a new one. Objects on the aborted page
// are linked together. This test makes sure that intra-aborted page pointers
......
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