Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index 13771e613e5dc61cc6ef1163bcecf880e39c7be9..0c5e7c0f94219b81d079d8f5284e518a95dceff7 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -4980,20 +4980,31 @@ 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_space_size, |
| - intptr_t max_executable_size, |
| - intptr_t code_range_size) { |
| + int max_old_space_size, |
| + int max_executable_size, |
| + int code_range_size) { |
| if (HasBeenSetUp()) return false; |
| + // Overwrite default configuration. |
| + if (max_semispace_size > 0) { |
| + max_semispace_size_ = max_semispace_size * MB; |
| + } |
| + if (max_old_space_size > 0) { |
| + max_old_generation_size_ = max_old_space_size * MB; |
| + } |
| + if (max_executable_size > 0) { |
| + max_executable_size_ = max_executable_size * MB; |
| + } |
| + |
| // 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 / 2) * kLumpOfMemory; |
| + if (FLAG_max_semispace_size > 0) { |
| + max_semispace_size = FLAG_max_semispace_size * MB; |
|
Michael Starzinger
2014/05/08 13:22:02
IMHO, this should target "max_semispace_size_" fie
Hannes Payer (out of office)
2014/05/08 13:53:44
Done.
|
| } |
| if (FLAG_max_old_space_size > 0) { |
| - max_old_space_size = FLAG_max_old_space_size * kLumpOfMemory; |
| + max_old_space_size = FLAG_max_old_space_size * MB; |
| } |
| if (FLAG_max_executable_size > 0) { |
| - max_executable_size = FLAG_max_executable_size * kLumpOfMemory; |
| + max_executable_size = FLAG_max_executable_size * MB; |
| } |
| if (FLAG_stress_compaction) { |
| @@ -5001,17 +5012,6 @@ bool Heap::ConfigureHeap(int max_semispace_size, |
| max_semispace_size_ = Page::kPageSize; |
| } |
| - if (max_semispace_size > 0) { |
| - if (max_semispace_size < Page::kPageSize) { |
| - max_semispace_size = Page::kPageSize; |
| - if (FLAG_trace_gc) { |
| - PrintPID("Max semispace size cannot be less than %dkbytes\n", |
| - Page::kPageSize >> 10); |
| - } |
| - } |
| - max_semispace_size_ = max_semispace_size; |
| - } |
| - |
| if (Snapshot::IsEnabled()) { |
| // If we are using a snapshot we always reserve the default amount |
| // of memory for each semispace because code in the snapshot has |
| @@ -5031,11 +5031,6 @@ bool Heap::ConfigureHeap(int max_semispace_size, |
| reserved_semispace_size_ = max_semispace_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); |
| - } |
| - |
| // The max executable size must be less than or equal to the max old |
| // generation size. |
| if (max_executable_size_ > max_old_generation_size_) { |
| @@ -5056,10 +5051,9 @@ bool Heap::ConfigureHeap(int max_semispace_size, |
| // The old generation is paged and needs at least one page for each space. |
| int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; |
| - max_old_generation_size_ = Max(static_cast<intptr_t>(paged_space_count * |
| - Page::kPageSize), |
| - RoundUp(max_old_generation_size_, |
| - Page::kPageSize)); |
| + max_old_generation_size_ = |
| + Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize), |
| + max_old_generation_size_); |
| // We rely on being able to allocate new arrays in paged spaces. |
| ASSERT(Page::kMaxRegularHeapObjectSize >= |
| @@ -5067,7 +5061,7 @@ bool Heap::ConfigureHeap(int max_semispace_size, |
| FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) + |
| AllocationMemento::kSize)); |
| - code_range_size_ = code_range_size; |
| + code_range_size_ = code_range_size * i::MB; |
| // We set the old generation growing factor to 2 to grow the heap slower on |
| // memory-constrained devices. |
| @@ -5081,10 +5075,7 @@ bool Heap::ConfigureHeap(int max_semispace_size, |
| bool Heap::ConfigureHeapDefault() { |
| - return ConfigureHeap(static_cast<intptr_t>(FLAG_max_new_space_size / 2) * KB, |
| - static_cast<intptr_t>(FLAG_max_old_space_size) * MB, |
| - static_cast<intptr_t>(FLAG_max_executable_size) * MB, |
| - static_cast<intptr_t>(0)); |
| + return ConfigureHeap(0, 0, 0, 0); |
| } |