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

Unified Diff: src/api.cc

Issue 236063015: Grow old generation slower on low-memory devices. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | « include/v8.h ('k') | src/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 bdc0c4f45e388bef4d820ab52b63b231d505e2ca..3ec77ebbc1fe186ee4e9005fdaa89bd391f6192a 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -460,7 +460,7 @@ Extension::Extension(const char* name,
ResourceConstraints::ResourceConstraints()
- : max_young_space_size_(0),
+ : max_new_space_size_(0),
max_old_space_size_(0),
max_executable_size_(0),
stack_limit_(NULL),
@@ -470,7 +470,6 @@ ResourceConstraints::ResourceConstraints()
void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
uint64_t virtual_memory_limit,
uint32_t number_of_processors) {
- const int lump_of_memory = (i::kPointerSize / 4) * i::MB;
#if V8_OS_ANDROID
// Android has higher physical memory requirements before raising the maximum
// heap size limits since it has no swap space.
@@ -483,24 +482,22 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
const uint64_t high_limit = 1ul * i::GB;
#endif
- // The young_space_size should be a power of 2 and old_generation_size should
- // be a multiple of Page::kPageSize.
if (physical_memory <= low_limit) {
- set_max_young_space_size(2 * lump_of_memory);
- set_max_old_space_size(128 * lump_of_memory);
- set_max_executable_size(96 * lump_of_memory);
+ set_max_new_space_size(i::Heap::kMaxNewSpaceSizeLowMemoryDevice);
+ set_max_old_space_size(i::Heap::kMaxOldSpaceSizeLowMemoryDevice);
+ set_max_executable_size(i::Heap::kMaxExecutableSizeLowMemoryDevice);
} else if (physical_memory <= medium_limit) {
- set_max_young_space_size(8 * lump_of_memory);
- set_max_old_space_size(256 * lump_of_memory);
- set_max_executable_size(192 * lump_of_memory);
+ set_max_new_space_size(i::Heap::kMaxNewSpaceSizeMediumMemoryDevice);
+ set_max_old_space_size(i::Heap::kMaxOldSpaceSizeMediumMemoryDevice);
+ set_max_executable_size(i::Heap::kMaxExecutableSizeMediumMemoryDevice);
} else if (physical_memory <= high_limit) {
- set_max_young_space_size(16 * lump_of_memory);
- set_max_old_space_size(512 * lump_of_memory);
- set_max_executable_size(256 * lump_of_memory);
+ set_max_new_space_size(i::Heap::kMaxNewSpaceSizeHighMemoryDevice);
+ set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHighMemoryDevice);
+ set_max_executable_size(i::Heap::kMaxExecutableSizeHighMemoryDevice);
} else {
- set_max_young_space_size(16 * lump_of_memory);
- set_max_old_space_size(700 * lump_of_memory);
- set_max_executable_size(256 * lump_of_memory);
+ set_max_new_space_size(i::Heap::kMaxNewSpaceSizeHugeMemoryDevice);
+ set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHugeMemoryDevice);
+ set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice);
}
set_max_available_threads(i::Max(i::Min(number_of_processors, 4u), 1u));
@@ -517,15 +514,15 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
bool SetResourceConstraints(Isolate* v8_isolate,
ResourceConstraints* constraints) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
- int young_space_size = constraints->max_young_space_size();
+ int new_space_size = constraints->max_new_space_size();
int old_gen_size = constraints->max_old_space_size();
int max_executable_size = constraints->max_executable_size();
int code_range_size = constraints->code_range_size();
- if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0 ||
+ if (new_space_size != 0 || old_gen_size != 0 || max_executable_size != 0 ||
code_range_size != 0) {
// After initialization it's too late to change Heap constraints.
ASSERT(!isolate->IsInitialized());
- bool result = isolate->heap()->ConfigureHeap(young_space_size / 2,
+ bool result = isolate->heap()->ConfigureHeap(new_space_size / 2,
old_gen_size,
max_executable_size,
code_range_size);
« no previous file with comments | « include/v8.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698