Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index aed4af089b7c5b1eeb79194fa1622feba4c0daee..d4cee6e75fc260c1331392d021bc6d355d128a39 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -697,13 +697,13 @@ Extension::Extension(const char* name, |
| CHECK(source != NULL || source_length_ == 0); |
| } |
| - |
| ResourceConstraints::ResourceConstraints() |
| : max_semi_space_size_(0), |
| max_old_space_size_(0), |
| max_executable_size_(0), |
| stack_limit_(NULL), |
| - code_range_size_(0) { } |
| + code_range_size_(0), |
| + max_pool_size_(0) {} |
| void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory, |
| uint64_t virtual_memory_limit) { |
| @@ -744,6 +744,16 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory, |
| i::Min(i::kMaximalCodeRangeSize / i::MB, |
| static_cast<size_t>((virtual_memory_limit >> 3) / i::MB))); |
| } |
| + |
| + if (physical_memory <= low_limit) { |
|
Michael Lippautz
2016/10/19 08:56:06
And by "use categories already defined above", I a
|
| + set_max_pool_size(i::AccountingAllocator::kMaxPoolSizeLowMemoryDevice); |
| + } else if (physical_memory <= medium_limit) { |
| + set_max_pool_size(i::AccountingAllocator::kMaxPoolSizeMediumMemoryDevice); |
| + } else if (physical_memory <= high_limit) { |
| + set_max_pool_size(i::AccountingAllocator::kMaxPoolSizeHighMemoryDevice); |
| + } else { |
| + set_max_pool_size(i::AccountingAllocator::kMaxPoolSizeHugeMemoryDevice); |
| + } |
| } |
| @@ -753,11 +763,14 @@ void SetResourceConstraints(i::Isolate* isolate, |
| int old_space_size = constraints.max_old_space_size(); |
| int max_executable_size = constraints.max_executable_size(); |
| size_t code_range_size = constraints.code_range_size(); |
| + size_t max_pool_size = constraints.max_pool_size(); |
| if (semi_space_size != 0 || old_space_size != 0 || |
| max_executable_size != 0 || code_range_size != 0) { |
| isolate->heap()->ConfigureHeap(semi_space_size, old_space_size, |
| max_executable_size, code_range_size); |
| } |
| + isolate->allocator()->ConfigureSegmentPool(max_pool_size); |
| + |
| if (constraints.stack_limit() != NULL) { |
| uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit()); |
| isolate->stack_guard()->SetStackLimit(limit); |