Revert "[heap] Allow a minimum semi-space size of 512K."
This reverts commit 0d2ed6c328
.
The CL introduced perf regressions: crbug.com/735649.
We are going to reland the CL in an isolated V8 roll to ensure
that perf regressions are attributed correctly.
Original commit message:
> [heap] Allow a minimum semi-space size of 512K.
> This CL also reduces the minimum semi-space size to 512K.
> BUG=chromium:716032
BUG=chromium:735649
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I1f1b08ca6853347c00070f000c309d839ff8a4bb
Reviewed-on: https://chromium-review.googlesource.com/552541
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46349}
This commit is contained in:
parent
ca93156294
commit
f341bb0f62
31
include/v8.h
31
include/v8.h
@ -5985,8 +5985,6 @@ V8_INLINE Local<Boolean> False(Isolate* isolate);
|
||||
*
|
||||
* The arguments for set_max_semi_space_size, set_max_old_space_size,
|
||||
* set_max_executable_size, set_code_range_size specify limits in MB.
|
||||
*
|
||||
* The argument for set_max_semi_space_size_in_kb is in KB.
|
||||
*/
|
||||
class V8_EXPORT ResourceConstraints {
|
||||
public:
|
||||
@ -6004,28 +6002,10 @@ class V8_EXPORT ResourceConstraints {
|
||||
void ConfigureDefaults(uint64_t physical_memory,
|
||||
uint64_t virtual_memory_limit);
|
||||
|
||||
// Returns the max semi-space size in MB.
|
||||
V8_DEPRECATE_SOON("Use max_semi_space_size_in_kb()",
|
||||
int max_semi_space_size()) {
|
||||
return static_cast<int>(max_semi_space_size_in_kb_ / 1024);
|
||||
int max_semi_space_size() const { return max_semi_space_size_; }
|
||||
void set_max_semi_space_size(int limit_in_mb) {
|
||||
max_semi_space_size_ = limit_in_mb;
|
||||
}
|
||||
|
||||
// Sets the max semi-space size in MB.
|
||||
V8_DEPRECATE_SOON("Use set_max_semi_space_size_in_kb(size_t limit_in_kb)",
|
||||
void set_max_semi_space_size(int limit_in_mb)) {
|
||||
max_semi_space_size_in_kb_ = limit_in_mb * 1024;
|
||||
}
|
||||
|
||||
// Returns the max semi-space size in KB.
|
||||
size_t max_semi_space_size_in_kb() const {
|
||||
return max_semi_space_size_in_kb_;
|
||||
}
|
||||
|
||||
// Sets the max semi-space size in KB.
|
||||
void set_max_semi_space_size_in_kb(size_t limit_in_kb) {
|
||||
max_semi_space_size_in_kb_ = limit_in_kb;
|
||||
}
|
||||
|
||||
int max_old_space_size() const { return max_old_space_size_; }
|
||||
void set_max_old_space_size(int limit_in_mb) {
|
||||
max_old_space_size_ = limit_in_mb;
|
||||
@ -6051,10 +6031,7 @@ class V8_EXPORT ResourceConstraints {
|
||||
}
|
||||
|
||||
private:
|
||||
// max_semi_space_size_ is in KB
|
||||
size_t max_semi_space_size_in_kb_;
|
||||
|
||||
// The remaining limits are in MB
|
||||
int max_semi_space_size_;
|
||||
int max_old_space_size_;
|
||||
int max_executable_size_;
|
||||
uint32_t* stack_limit_;
|
||||
|
@ -871,7 +871,7 @@ Extension::Extension(const char* name,
|
||||
}
|
||||
|
||||
ResourceConstraints::ResourceConstraints()
|
||||
: max_semi_space_size_in_kb_(0),
|
||||
: max_semi_space_size_(0),
|
||||
max_old_space_size_(0),
|
||||
stack_limit_(NULL),
|
||||
code_range_size_(0),
|
||||
@ -879,8 +879,8 @@ ResourceConstraints::ResourceConstraints()
|
||||
|
||||
void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
|
||||
uint64_t virtual_memory_limit) {
|
||||
set_max_semi_space_size_in_kb(
|
||||
i::Heap::ComputeMaxSemiSpaceSize(physical_memory));
|
||||
set_max_semi_space_size(
|
||||
static_cast<int>(i::Heap::ComputeMaxSemiSpaceSize(physical_memory)));
|
||||
set_max_old_space_size(
|
||||
static_cast<int>(i::Heap::ComputeMaxOldGenerationSize(physical_memory)));
|
||||
set_max_zone_pool_size(i::AccountingAllocator::kMaxPoolSize);
|
||||
@ -896,7 +896,7 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
|
||||
|
||||
void SetResourceConstraints(i::Isolate* isolate,
|
||||
const ResourceConstraints& constraints) {
|
||||
size_t semi_space_size = constraints.max_semi_space_size_in_kb();
|
||||
int semi_space_size = constraints.max_semi_space_size();
|
||||
int old_space_size = constraints.max_old_space_size();
|
||||
size_t code_range_size = constraints.code_range_size();
|
||||
size_t max_pool_size = constraints.max_zone_pool_size();
|
||||
|
@ -85,7 +85,7 @@ Heap::Heap()
|
||||
// semispace_size_ should be a power of 2 and old_generation_size_ should
|
||||
// be a multiple of Page::kPageSize.
|
||||
max_semi_space_size_(8 * (kPointerSize / 4) * MB),
|
||||
initial_semispace_size_(Page::kPageSize),
|
||||
initial_semispace_size_(MB),
|
||||
max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
|
||||
initial_max_old_generation_size_(max_old_generation_size_),
|
||||
initial_old_generation_size_(max_old_generation_size_ /
|
||||
@ -5299,18 +5299,16 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) {
|
||||
// TODO(1236194): Since the heap size is configurable on the command line
|
||||
// and through the API, we should gracefully handle the case that the heap
|
||||
// size is not big enough to fit all the initial objects.
|
||||
bool Heap::ConfigureHeap(size_t max_semi_space_size_in_kb,
|
||||
size_t max_old_generation_size_in_mb,
|
||||
size_t code_range_size_in_mb) {
|
||||
bool Heap::ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size,
|
||||
size_t code_range_size) {
|
||||
if (HasBeenSetUp()) return false;
|
||||
|
||||
// Overwrite default configuration.
|
||||
if (max_semi_space_size_in_kb != 0) {
|
||||
max_semi_space_size_ =
|
||||
ROUND_UP(max_semi_space_size_in_kb * KB, Page::kPageSize);
|
||||
if (max_semi_space_size != 0) {
|
||||
max_semi_space_size_ = max_semi_space_size * MB;
|
||||
}
|
||||
if (max_old_generation_size_in_mb != 0) {
|
||||
max_old_generation_size_ = max_old_generation_size_in_mb * MB;
|
||||
if (max_old_space_size != 0) {
|
||||
max_old_generation_size_ = max_old_space_size * MB;
|
||||
}
|
||||
|
||||
// If max space size flags are specified overwrite the configuration.
|
||||
@ -5381,7 +5379,7 @@ bool Heap::ConfigureHeap(size_t max_semi_space_size_in_kb,
|
||||
FixedArray::SizeFor(JSArray::kInitialMaxFastElementArray) +
|
||||
AllocationMemento::kSize));
|
||||
|
||||
code_range_size_ = code_range_size_in_mb * MB;
|
||||
code_range_size_ = code_range_size * MB;
|
||||
|
||||
configured_ = true;
|
||||
return true;
|
||||
|
@ -620,11 +620,9 @@ class Heap {
|
||||
static const int kPointerMultiplier = i::kPointerSize / 4;
|
||||
#endif
|
||||
|
||||
// Semi-space size needs to be a multiple of page size.
|
||||
static const int kMinSemiSpaceSizeInKB =
|
||||
1 * kPointerMultiplier * ((1 << kPageSizeBits) / KB);
|
||||
static const int kMaxSemiSpaceSizeInKB =
|
||||
16 * kPointerMultiplier * ((1 << kPageSizeBits) / KB);
|
||||
// The new space size has to be a power of 2. Sizes are in MB.
|
||||
static const int kMinSemiSpaceSize = 1 * kPointerMultiplier;
|
||||
static const int kMaxSemiSpaceSize = 8 * kPointerMultiplier;
|
||||
|
||||
// The old space size has to be a multiple of Page::kPageSize.
|
||||
// Sizes are in MB.
|
||||
@ -978,14 +976,10 @@ class Heap {
|
||||
// Initialization. ===========================================================
|
||||
// ===========================================================================
|
||||
|
||||
// Configure heap sizes
|
||||
// max_semi_space_size_in_kb: maximum semi-space size in KB
|
||||
// max_old_generation_size_in_mb: maximum old generation size in MB
|
||||
// code_range_size_in_mb: code range size in MB
|
||||
// Return false if the heap has been set up already.
|
||||
bool ConfigureHeap(size_t max_semi_space_size_in_kb,
|
||||
size_t max_old_generation_size_in_mb,
|
||||
size_t code_range_size_in_mb);
|
||||
// Configure heap size in MB before setup. Return false if the heap has been
|
||||
// set up already.
|
||||
bool ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size,
|
||||
size_t code_range_size);
|
||||
bool ConfigureHeapDefault();
|
||||
|
||||
// Prepares the heap, setting up memory areas that are needed in the isolate
|
||||
@ -1361,12 +1355,10 @@ class Heap {
|
||||
uint64_t capped_physical_memory =
|
||||
Max(Min(physical_memory, max_physical_memory), min_physical_memory);
|
||||
// linearly scale max semi-space size: (X-A)/(B-A)*(D-C)+C
|
||||
int semi_space_size_in_kb =
|
||||
static_cast<int>(((capped_physical_memory - min_physical_memory) *
|
||||
(kMaxSemiSpaceSizeInKB - kMinSemiSpaceSizeInKB)) /
|
||||
(max_physical_memory - min_physical_memory) +
|
||||
kMinSemiSpaceSizeInKB);
|
||||
return RoundUp(semi_space_size_in_kb, (1 << kPageSizeBits) / KB);
|
||||
return static_cast<int>(((capped_physical_memory - min_physical_memory) *
|
||||
(kMaxSemiSpaceSize - kMinSemiSpaceSize)) /
|
||||
(max_physical_memory - min_physical_memory) +
|
||||
kMinSemiSpaceSize);
|
||||
}
|
||||
|
||||
// Returns the capacity of the heap in bytes w/o growing. Heap grows when
|
||||
|
@ -4807,7 +4807,7 @@ HEAP_TEST(Regress538257) {
|
||||
FLAG_manual_evacuation_candidates_selection = true;
|
||||
v8::Isolate::CreateParams create_params;
|
||||
// Set heap limits.
|
||||
create_params.constraints.set_max_semi_space_size_in_kb(1024);
|
||||
create_params.constraints.set_max_semi_space_size(1);
|
||||
create_params.constraints.set_max_old_space_size(6);
|
||||
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
|
||||
v8::Isolate* isolate = v8::Isolate::New(create_params);
|
||||
|
@ -20317,7 +20317,7 @@ class InitDefaultIsolateThread : public v8::base::Thread {
|
||||
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
|
||||
switch (testCase_) {
|
||||
case SetResourceConstraints: {
|
||||
create_params.constraints.set_max_semi_space_size_in_kb(1024);
|
||||
create_params.constraints.set_max_semi_space_size(1);
|
||||
create_params.constraints.set_max_old_space_size(6);
|
||||
break;
|
||||
}
|
||||
|
@ -1301,7 +1301,7 @@ TEST(SliceFromSlice) {
|
||||
UNINITIALIZED_TEST(OneByteArrayJoin) {
|
||||
v8::Isolate::CreateParams create_params;
|
||||
// Set heap limits.
|
||||
create_params.constraints.set_max_semi_space_size_in_kb(1024);
|
||||
create_params.constraints.set_max_semi_space_size(1);
|
||||
create_params.constraints.set_max_old_space_size(7);
|
||||
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
|
||||
v8::Isolate* isolate = v8::Isolate::New(create_params);
|
||||
|
@ -61,12 +61,12 @@ TEST(Heap, MaxHeapGrowingFactor) {
|
||||
|
||||
TEST(Heap, SemiSpaceSize) {
|
||||
uint64_t configurations[][2] = {
|
||||
{0, i::Heap::kPointerMultiplier * (Page::kPageSize / KB)},
|
||||
{512 * i::MB, i::Heap::kPointerMultiplier * (Page::kPageSize / KB)},
|
||||
{1 * i::GB, i::Heap::kPointerMultiplier * (6 * Page::kPageSize / KB)},
|
||||
{2 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSizeInKB},
|
||||
{4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSizeInKB},
|
||||
{8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSizeInKB}};
|
||||
{0, 1 * i::Heap::kPointerMultiplier},
|
||||
{512 * i::MB, 1 * i::Heap::kPointerMultiplier},
|
||||
{1 * i::GB, 3 * i::Heap::kPointerMultiplier},
|
||||
{2 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSize},
|
||||
{4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSize},
|
||||
{8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSize}};
|
||||
|
||||
for (auto configuration : configurations) {
|
||||
ASSERT_EQ(configuration[1],
|
||||
|
Loading…
Reference in New Issue
Block a user