Index: src/heap.cc |
=================================================================== |
--- src/heap.cc (revision 5798) |
+++ src/heap.cc (working copy) |
@@ -83,16 +83,19 @@ |
intptr_t Heap::max_old_generation_size_ = 192*MB; |
int Heap::initial_semispace_size_ = 128*KB; |
intptr_t Heap::code_range_size_ = 0; |
+intptr_t Heap::max_executable_size_ = max_old_generation_size_; |
#elif defined(V8_TARGET_ARCH_X64) |
int Heap::max_semispace_size_ = 16*MB; |
intptr_t Heap::max_old_generation_size_ = 1*GB; |
int Heap::initial_semispace_size_ = 1*MB; |
intptr_t Heap::code_range_size_ = 512*MB; |
+intptr_t Heap::max_executable_size_ = 256*MB; |
#else |
int Heap::max_semispace_size_ = 8*MB; |
intptr_t Heap::max_old_generation_size_ = 512*MB; |
int Heap::initial_semispace_size_ = 512*KB; |
intptr_t Heap::code_range_size_ = 0; |
+intptr_t Heap::max_executable_size_ = 128*MB; |
#endif |
// The snapshot semispace size will be the default semispace size if |
@@ -172,7 +175,13 @@ |
lo_space_->Size(); |
} |
+intptr_t Heap::CommittedMemoryExecutable() { |
+ if (!HasBeenSetup()) return 0; |
+ return MemoryAllocator::SizeExecutable(); |
+} |
+ |
+ |
intptr_t Heap::Available() { |
if (!HasBeenSetup()) return 0; |
@@ -4313,7 +4322,9 @@ |
// TODO(1236194): Since the heap size is configurable on the command line |
// 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, int max_old_gen_size) { |
+bool Heap::ConfigureHeap(int max_semispace_size, |
+ int max_old_gen_size, |
+ int max_executable_size) { |
if (HasBeenSetup()) return false; |
if (max_semispace_size > 0) max_semispace_size_ = max_semispace_size; |
@@ -4334,6 +4345,9 @@ |
} |
if (max_old_gen_size > 0) max_old_generation_size_ = max_old_gen_size; |
+ if (max_executable_size > 0) { |
+ max_executable_size_ = RoundUp(max_executable_size_, Page::kPageSize); |
+ } |
// The new space size must be a power of two to support single-bit testing |
// for containment. |
@@ -4351,8 +4365,9 @@ |
bool Heap::ConfigureHeapDefault() { |
- return ConfigureHeap( |
- FLAG_max_new_space_size * (KB / 2), FLAG_max_old_space_size * MB); |
+ return ConfigureHeap(FLAG_max_new_space_size / 2 * KB, |
+ FLAG_max_old_space_size * MB, |
+ FLAG_max_executable_size * MB); |
} |
@@ -4435,7 +4450,7 @@ |
// space. The chunk is double the size of the requested reserved |
// new space size to ensure that we can find a pair of semispaces that |
// are contiguous and aligned to their size. |
- if (!MemoryAllocator::Setup(MaxReserved())) return false; |
+ if (!MemoryAllocator::Setup(MaxReserved(), MaxExecutableSize())) return false; |
void* chunk = |
MemoryAllocator::ReserveInitialChunk(4 * reserved_semispace_size_); |
if (chunk == NULL) return false; |