Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: src/api.cc

Issue 2895473003: [heap] Simplify and scale ResourceConstraints::ConfigureDefaults. (Closed)
Patch Set: rename Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 330174e79a2f6c4fd73aa1d22e6b2194b244bd2e..8c0da7ccbe161ea8dc76859e1b8bd874fb9dcb62 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -874,38 +874,11 @@ ResourceConstraints::ResourceConstraints()
void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
uint64_t virtual_memory_limit) {
-#if V8_OS_ANDROID
- // Android has higher physical memory requirements before raising the maximum
- // heap size limits since it has no swap space.
- const uint64_t low_limit = 512ul * i::MB;
- const uint64_t medium_limit = 1ul * i::GB;
- const uint64_t high_limit = 2ul * i::GB;
-#else
- const uint64_t low_limit = 512ul * i::MB;
- const uint64_t medium_limit = 768ul * i::MB;
- const uint64_t high_limit = 1ul * i::GB;
-#endif
-
- if (physical_memory <= low_limit) {
- set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeLowMemoryDevice);
- set_max_old_space_size(i::Heap::kMaxOldSpaceSizeLowMemoryDevice);
- set_max_zone_pool_size(i::AccountingAllocator::kMaxPoolSizeLowMemoryDevice);
- } else if (physical_memory <= medium_limit) {
- set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeMediumMemoryDevice);
- set_max_old_space_size(i::Heap::kMaxOldSpaceSizeMediumMemoryDevice);
- set_max_zone_pool_size(
- i::AccountingAllocator::kMaxPoolSizeMediumMemoryDevice);
- } else if (physical_memory <= high_limit) {
- set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHighMemoryDevice);
- set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHighMemoryDevice);
- set_max_zone_pool_size(
- i::AccountingAllocator::kMaxPoolSizeHighMemoryDevice);
- } else {
- set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHugeMemoryDevice);
- set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHugeMemoryDevice);
- set_max_zone_pool_size(
- i::AccountingAllocator::kMaxPoolSizeHugeMemoryDevice);
- }
+ 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);
if (virtual_memory_limit > 0 && i::kRequiresCodeRange) {
// Reserve no more than 1/8 of the memory for the code range, but at most
@@ -916,7 +889,6 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
}
}
-
void SetResourceConstraints(i::Isolate* isolate,
const ResourceConstraints& constraints) {
int semi_space_size = constraints.max_semi_space_size();
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698