Commit 0544466c authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Small fixes for young large objects near OOM

Bug: chromium:852420
Change-Id: I659e8d2d047387d7b73f11406b29696d74d84ff7
Reviewed-on: https://chromium-review.googlesource.com/c/1462965Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59503}
parent 54d63aca
......@@ -155,7 +155,9 @@ Heap::Heap()
}
size_t Heap::MaxReserved() {
const size_t kMaxNewLargeObjectSpaceSize = max_semi_space_size_;
return static_cast<size_t>(2 * max_semi_space_size_ +
kMaxNewLargeObjectSpaceSize +
max_old_generation_size_);
}
......@@ -268,7 +270,7 @@ bool Heap::HasBeenSetUp() {
GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space,
const char** reason) {
// Is global GC requested?
if (space != NEW_SPACE) {
if (space != NEW_SPACE && space != NEW_LO_SPACE) {
isolate_->counters()->gc_compactor_caused_by_request()->Increment();
*reason = "GC in old space requested";
return MARK_COMPACTOR;
......
......@@ -277,6 +277,9 @@ RUNTIME_FUNCTION(Runtime_AllocateInTargetSpace) {
bool double_align = AllocateDoubleAlignFlag::decode(flags);
AllocationSpace space = AllocateTargetSpace::decode(flags);
CHECK(size <= kMaxRegularHeapObjectSize || space == LO_SPACE);
if (FLAG_young_generation_large_objects && space == LO_SPACE) {
space = NEW_LO_SPACE;
}
return *isolate->factory()->NewFillerObject(size, double_align, space);
}
......
......@@ -6388,6 +6388,7 @@ struct OutOfMemoryState {
size_t old_generation_capacity_at_oom;
size_t memory_allocator_size_at_oom;
size_t new_space_capacity_at_oom;
size_t new_lo_space_size_at_oom;
size_t current_heap_limit;
size_t initial_heap_limit;
};
......@@ -6400,6 +6401,7 @@ size_t NearHeapLimitCallback(void* raw_state, size_t current_heap_limit,
state->old_generation_capacity_at_oom = heap->OldGenerationCapacity();
state->memory_allocator_size_at_oom = heap->memory_allocator()->Size();
state->new_space_capacity_at_oom = heap->new_space()->Capacity();
state->new_lo_space_size_at_oom = heap->new_lo_space()->Size();
state->current_heap_limit = current_heap_limit;
state->initial_heap_limit = initial_heap_limit;
return initial_heap_limit + 100 * MB;
......@@ -6475,11 +6477,14 @@ UNINITIALIZED_TEST(OutOfMemoryLargeObjects) {
}
CHECK_LE(state.old_generation_capacity_at_oom, kOldGenerationLimit);
CHECK_LE(kOldGenerationLimit, state.old_generation_capacity_at_oom +
state.new_space_capacity_at_oom +
state.new_lo_space_size_at_oom +
FixedArray::SizeFor(kFixedArrayLength));
CHECK_LE(
state.memory_allocator_size_at_oom,
MemoryAllocatorSizeFromHeapCapacity(state.old_generation_capacity_at_oom +
2 * state.new_space_capacity_at_oom));
2 * state.new_space_capacity_at_oom +
state.new_lo_space_size_at_oom));
reinterpret_cast<v8::Isolate*>(isolate)->Dispose();
}
......
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