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

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..adde01c12fb40c437278c9f913a6025e417af8f5 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),
@@ -483,24 +483,34 @@ 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 * lump_of_memory);
+ set_max_old_space_size(
+ i::Heap::kMaxOldSpaceSizeLowMemoryDevice * lump_of_memory);
+ set_max_executable_size(
+ i::Heap::kMaxExecutableSizeLowMemoryDevice * lump_of_memory);
} 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 * lump_of_memory);
+ set_max_old_space_size(
+ i::Heap::kMaxOldSpaceSizeMediumMemoryDevice * lump_of_memory);
+ set_max_executable_size(
+ i::Heap::kMaxExecutableSizeMediumMemoryDevice * lump_of_memory);
} 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 * lump_of_memory);
+ set_max_old_space_size(
+ i::Heap::kMaxOldSpaceSizeHighMemoryDevice * lump_of_memory);
+ set_max_executable_size(
+ i::Heap::kMaxExecutableSizeHighMemoryDevice * lump_of_memory);
} 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 * lump_of_memory);
+ set_max_old_space_size(
+ i::Heap::kMaxOldSpaceSizeHugeMemoryDevice * lump_of_memory);
+ set_max_executable_size(
+ i::Heap::kMaxExecutableSizeHugeMemoryDevice * lump_of_memory);
}
set_max_available_threads(i::Max(i::Min(number_of_processors, 4u), 1u));
@@ -517,15 +527,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