Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 4660a67dd2847e668ca305a780bc8e80a2482488..ab4e79048680b0d0b5b01095f1ff421b0dfea3c3 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -169,7 +169,7 @@ Heap::Heap() |
#endif |
// Ensure old_generation_size_ is a multiple of kPageSize. |
- DCHECK(MB >= Page::kPageSize); |
+ DCHECK((max_old_generation_size_ & (Page::kPageSize - 1)) == 0); |
memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); |
set_native_contexts_list(NULL); |
@@ -5354,6 +5354,13 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, |
max_executable_size_ = static_cast<intptr_t>(FLAG_max_executable_size) * MB; |
} |
+ if (Page::kPageSize > MB) { |
+ max_semi_space_size_ = ROUND_UP(max_semi_space_size_, Page::kPageSize); |
+ max_old_generation_size_ = |
+ ROUND_UP(max_old_generation_size_, Page::kPageSize); |
+ max_executable_size_ = ROUND_UP(max_executable_size_, Page::kPageSize); |
+ } |
+ |
if (FLAG_stress_compaction) { |
// This will cause more frequent GCs when stressing. |
max_semi_space_size_ = Page::kPageSize; |
@@ -5379,12 +5386,6 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, |
reserved_semispace_size_ = max_semi_space_size_; |
} |
- // The max executable size must be less than or equal to the max old |
- // generation size. |
- if (max_executable_size_ > max_old_generation_size_) { |
- max_executable_size_ = max_old_generation_size_; |
- } |
- |
// The new space size must be a power of two to support single-bit testing |
// for containment. |
max_semi_space_size_ = |
@@ -5403,7 +5404,8 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, |
max_semi_space_size_ / MB); |
} |
} else { |
- initial_semispace_size_ = initial_semispace_size; |
+ initial_semispace_size_ = |
+ ROUND_UP(initial_semispace_size, Page::kPageSize); |
} |
} |
@@ -5428,7 +5430,7 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, |
max_semi_space_size_ / MB); |
} |
} else { |
- target_semispace_size_ = target_semispace_size; |
+ target_semispace_size_ = ROUND_UP(target_semispace_size, Page::kPageSize); |
} |
} |
@@ -5444,6 +5446,12 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, |
Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize), |
max_old_generation_size_); |
+ // The max executable size must be less than or equal to the max old |
+ // generation size. |
+ if (max_executable_size_ > max_old_generation_size_) { |
+ max_executable_size_ = max_old_generation_size_; |
+ } |
+ |
if (FLAG_initial_old_space_size > 0) { |
initial_old_generation_size_ = FLAG_initial_old_space_size * MB; |
} else { |