From a35bb7586c7ec235c2268bcb80a47d936a087c3f Mon Sep 17 00:00:00 2001 From: "hpayer@chromium.org" Date: Mon, 5 May 2014 16:33:23 +0000 Subject: [PATCH] FLAG_max_new_space_size is in MB. Plus, cleanup of the space - generation mess. More to do there... BUG= R=mvstanton@chromium.org Review URL: https://codereview.chromium.org/268073004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21148 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 6 +++--- src/flag-definitions.h | 6 ++++-- src/heap.cc | 8 ++++---- src/heap.h | 2 +- src/v8.cc | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/api.cc b/src/api.cc index 41b5a45..1fc270c 100644 --- a/src/api.cc +++ b/src/api.cc @@ -474,15 +474,15 @@ bool SetResourceConstraints(Isolate* v8_isolate, ResourceConstraints* constraints) { i::Isolate* isolate = reinterpret_cast(v8_isolate); int new_space_size = constraints->max_new_space_size(); - int old_gen_size = constraints->max_old_space_size(); + int old_space_size = constraints->max_old_space_size(); int max_executable_size = constraints->max_executable_size(); int code_range_size = constraints->code_range_size(); - if (new_space_size != 0 || old_gen_size != 0 || max_executable_size != 0 || + if (new_space_size != 0 || old_space_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(new_space_size / 2, - old_gen_size, + old_space_size, max_executable_size, code_range_size); if (!result) return false; diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 47d87ea..32bd20e 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -469,8 +469,10 @@ DEFINE_bool(always_inline_smi_code, false, "always inline smi code in non-opt code") // heap.cc -DEFINE_int(max_new_space_size, 0, "max size of the new generation (in kBytes)") -DEFINE_int(max_old_space_size, 0, "max size of the old generation (in Mbytes)") +DEFINE_int(max_new_space_size, 0, + "max size of the new space consisting of two semi-spaces which are half" + "the size (in MBytes)") +DEFINE_int(max_old_space_size, 0, "max size of the old space (in Mbytes)") DEFINE_int(max_executable_size, 0, "max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false, "always perform global GCs") DEFINE_int(gc_interval, -1, "garbage collect after allocations") diff --git a/src/heap.cc b/src/heap.cc index ee622f2..13771e6 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -4980,17 +4980,17 @@ void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) { // 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(int max_semispace_size, - intptr_t max_old_gen_size, + intptr_t max_old_space_size, intptr_t max_executable_size, intptr_t code_range_size) { if (HasBeenSetUp()) return false; // If max space size flags are specified overwrite the configuration. if (FLAG_max_new_space_size > 0) { - max_semispace_size = FLAG_max_new_space_size * kLumpOfMemory; + max_semispace_size = (FLAG_max_new_space_size / 2) * kLumpOfMemory; } if (FLAG_max_old_space_size > 0) { - max_old_gen_size = FLAG_max_old_space_size * kLumpOfMemory; + max_old_space_size = FLAG_max_old_space_size * kLumpOfMemory; } if (FLAG_max_executable_size > 0) { max_executable_size = FLAG_max_executable_size * kLumpOfMemory; @@ -5031,7 +5031,7 @@ bool Heap::ConfigureHeap(int max_semispace_size, reserved_semispace_size_ = max_semispace_size_; } - if (max_old_gen_size > 0) max_old_generation_size_ = max_old_gen_size; + if (max_old_space_size > 0) max_old_generation_size_ = max_old_space_size; if (max_executable_size > 0) { max_executable_size_ = RoundUp(max_executable_size, Page::kPageSize); } diff --git a/src/heap.h b/src/heap.h index 44e1b94..1b42efd 100644 --- a/src/heap.h +++ b/src/heap.h @@ -549,7 +549,7 @@ class Heap { // Configure heap size before setup. Return false if the heap has been // set up already. bool ConfigureHeap(int max_semispace_size, - intptr_t max_old_gen_size, + intptr_t max_old_space_size, intptr_t max_executable_size, intptr_t code_range_size); bool ConfigureHeapDefault(); diff --git a/src/v8.cc b/src/v8.cc index 30f64d6..4050e34 100644 --- a/src/v8.cc +++ b/src/v8.cc @@ -99,7 +99,7 @@ void V8::InitializeOncePerProcessImpl() { if (FLAG_stress_compaction) { FLAG_force_marking_deque_overflows = true; FLAG_gc_global = true; - FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; + FLAG_max_new_space_size = 2 * Page::kPageSize; } #ifdef V8_USE_DEFAULT_PLATFORM -- 2.7.4