Commit 1d54a600 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Enable --huge_max_old_generation_size by default and add tests

Now ResourceConstraints::ConfigureDefaults sets the heap limit to 4GB
if the physical memory size is greater or equal to 16GB on 64-bit
platforms.

This CL also adds tests for configuring heap limits from the physical
memory size.

Bug: chromium:1045034
Change-Id: If0d5a237b2db31309a9a2a6456d950ef70dc71af
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2043833
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66174}
parent 63228e26
......@@ -810,7 +810,7 @@ DEFINE_SIZE_T(
"both max_semi_space_size and max_old_space_size take precedence. "
"All three flags cannot be specified at the same time.")
DEFINE_SIZE_T(initial_heap_size, 0, "initial size of the heap (in Mbytes)")
DEFINE_BOOL(huge_max_old_generation_size, false,
DEFINE_BOOL(huge_max_old_generation_size, true,
"Increase max size of the old space to 4 GB for x64 systems with"
"the physical memory bigger than 16 GB")
DEFINE_SIZE_T(initial_old_space_size, 0, "initial old space size (in Mbytes)")
......
......@@ -6891,6 +6891,41 @@ TEST(Regress9701) {
CHECK_EQ(mark_sweep_count_before, mark_sweep_count_after);
}
#if defined(V8_TARGET_ARCH_64_BIT) && !defined(V8_OS_ANDROID)
UNINITIALIZED_TEST(HugeHeapLimit) {
uint64_t kMemoryGB = 16;
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
create_params.constraints.ConfigureDefaults(kMemoryGB * GB, kMemoryGB * GB);
v8::Isolate* isolate = v8::Isolate::New(create_params);
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
#ifdef V8_COMPRESS_POINTERS
// Fix this once the fix for crbug.com/1049816 lands.
size_t kExpectedHeapLimit = size_t{2} * GB;
#else
size_t kExpectedHeapLimit = size_t{4} * GB;
#endif
CHECK_EQ(kExpectedHeapLimit, i_isolate->heap()->MaxOldGenerationSize());
isolate->Dispose();
}
#endif
UNINITIALIZED_TEST(HeapLimit) {
uint64_t kMemoryGB = 15;
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
create_params.constraints.ConfigureDefaults(kMemoryGB * GB, kMemoryGB * GB);
v8::Isolate* isolate = v8::Isolate::New(create_params);
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
#if defined(V8_TARGET_ARCH_64_BIT) && !defined(V8_OS_ANDROID)
size_t kExpectedHeapLimit = size_t{2} * GB;
#else
size_t kExpectedHeapLimit = size_t{1} * GB;
#endif
CHECK_EQ(kExpectedHeapLimit, i_isolate->heap()->MaxOldGenerationSize());
isolate->Dispose();
}
} // namespace heap
} // namespace internal
} // namespace v8
......
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