Index: src/heap/heap.h |
diff --git a/src/heap/heap.h b/src/heap/heap.h |
index c537beb2cb32c9741d958ba89b7f0668c102dfdb..186bf976fdf74be4af5971160232419551fd0970 100644 |
--- a/src/heap/heap.h |
+++ b/src/heap/heap.h |
@@ -618,9 +618,11 @@ class Heap { |
static const int kPointerMultiplier = i::kPointerSize / 4; |
#endif |
- // The new space size has to be a power of 2. Sizes are in MB. |
- static const int kMinSemiSpaceSize = 1 * kPointerMultiplier; |
- static const int kMaxSemiSpaceSize = 8 * kPointerMultiplier; |
+ // Semi-space size needs to be a multiple of page size. |
+ static const int kMinSemiSpaceSizeInKB = |
+ 1 * kPointerMultiplier * ((1 << kPageSizeBits) / KB); |
+ static const int kMaxSemiSpaceSizeInKB = |
+ 16 * kPointerMultiplier * ((1 << kPageSizeBits) / KB); |
// The old space size has to be a multiple of Page::kPageSize. |
// Sizes are in MB. |
@@ -974,10 +976,14 @@ class Heap { |
// Initialization. =========================================================== |
// =========================================================================== |
- // Configure heap size in MB before setup. Return false if the heap has been |
- // set up already. |
- bool ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size, |
- size_t code_range_size); |
+ // Configure heap sizes |
+ // max_semi_space_size_in_kb: maximum semi-space size in KB |
+ // max_old_generation_size_in_mb: maximum old generation size in MB |
+ // code_range_size_in_mb: code range size in MB |
+ // Return false if the heap has been set up already. |
+ bool ConfigureHeap(size_t max_semi_space_size_in_kb, |
+ size_t max_old_generation_size_in_mb, |
+ size_t code_range_size_in_mb); |
bool ConfigureHeapDefault(); |
// Prepares the heap, setting up memory areas that are needed in the isolate |
@@ -1353,10 +1359,12 @@ class Heap { |
uint64_t capped_physical_memory = |
Max(Min(physical_memory, max_physical_memory), min_physical_memory); |
// linearly scale max semi-space size: (X-A)/(B-A)*(D-C)+C |
- return static_cast<int>(((capped_physical_memory - min_physical_memory) * |
- (kMaxSemiSpaceSize - kMinSemiSpaceSize)) / |
- (max_physical_memory - min_physical_memory) + |
- kMinSemiSpaceSize); |
+ int semi_space_size_in_kb = |
+ static_cast<int>(((capped_physical_memory - min_physical_memory) * |
+ (kMaxSemiSpaceSizeInKB - kMinSemiSpaceSizeInKB)) / |
+ (max_physical_memory - min_physical_memory) + |
+ kMinSemiSpaceSizeInKB); |
+ return RoundUp(semi_space_size_in_kb, (1 << kPageSizeBits) / KB); |
} |
// Returns the capacity of the heap in bytes w/o growing. Heap grows when |