| Index: src/heap.cc
|
| diff --git a/src/heap.cc b/src/heap.cc
|
| index c06a592efacb435b04bf248fa1bb7eaebb5f8322..e9dc1fe91f827657a02eec97b063d33d70d3bda6 100644
|
| --- a/src/heap.cc
|
| +++ b/src/heap.cc
|
| @@ -172,8 +172,7 @@ Heap::Heap()
|
| max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE;
|
| #endif
|
|
|
| - intptr_t max_virtual = OS::MaxVirtualMemory();
|
| -
|
| + intptr_t max_virtual = static_cast<intptr_t>(VirtualMemory::GetLimit());
|
| if (max_virtual > 0) {
|
| if (code_range_size_ > 0) {
|
| // Reserve no more than 1/8 of the memory for the code range.
|
| @@ -4147,7 +4146,7 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc,
|
| HeapObject* result;
|
| bool force_lo_space = obj_size > code_space()->AreaSize();
|
| if (force_lo_space) {
|
| - maybe_result = lo_space_->AllocateRaw(obj_size, EXECUTABLE);
|
| + maybe_result = lo_space_->AllocateRaw(obj_size, VirtualMemory::EXECUTABLE);
|
| } else {
|
| maybe_result = code_space_->AllocateRaw(obj_size);
|
| }
|
| @@ -4159,7 +4158,7 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc,
|
| // Discard the first code allocation, which was on a page where it could be
|
| // moved.
|
| CreateFillerObjectAt(result->address(), obj_size);
|
| - maybe_result = lo_space_->AllocateRaw(obj_size, EXECUTABLE);
|
| + maybe_result = lo_space_->AllocateRaw(obj_size, VirtualMemory::EXECUTABLE);
|
| if (!maybe_result->To<HeapObject>(&result)) return maybe_result;
|
| }
|
|
|
| @@ -4210,7 +4209,7 @@ MaybeObject* Heap::CopyCode(Code* code) {
|
| int obj_size = code->Size();
|
| MaybeObject* maybe_result;
|
| if (obj_size > code_space()->AreaSize()) {
|
| - maybe_result = lo_space_->AllocateRaw(obj_size, EXECUTABLE);
|
| + maybe_result = lo_space_->AllocateRaw(obj_size, VirtualMemory::EXECUTABLE);
|
| } else {
|
| maybe_result = code_space_->AllocateRaw(obj_size);
|
| }
|
| @@ -4253,7 +4252,8 @@ MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
|
|
|
| MaybeObject* maybe_result;
|
| if (new_obj_size > code_space()->AreaSize()) {
|
| - maybe_result = lo_space_->AllocateRaw(new_obj_size, EXECUTABLE);
|
| + maybe_result = lo_space_->AllocateRaw(
|
| + new_obj_size, VirtualMemory::EXECUTABLE);
|
| } else {
|
| maybe_result = code_space_->AllocateRaw(new_obj_size);
|
| }
|
| @@ -5366,7 +5366,7 @@ MaybeObject* Heap::AllocateInternalizedStringImpl(
|
| // Allocate string.
|
| Object* result;
|
| { MaybeObject* maybe_result = (size > Page::kMaxNonCodeHeapObjectSize)
|
| - ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE)
|
| + ? lo_space_->AllocateRaw(size, VirtualMemory::NOT_EXECUTABLE)
|
| : old_data_space_->AllocateRaw(size);
|
| if (!maybe_result->ToObject(&result)) return maybe_result;
|
| }
|
| @@ -5519,7 +5519,7 @@ MaybeObject* Heap::AllocateRawFixedArray(int length) {
|
| int size = FixedArray::SizeFor(length);
|
| return size <= Page::kMaxNonCodeHeapObjectSize
|
| ? new_space_.AllocateRaw(size)
|
| - : lo_space_->AllocateRaw(size, NOT_EXECUTABLE);
|
| + : lo_space_->AllocateRaw(size, VirtualMemory::NOT_EXECUTABLE);
|
| }
|
|
|
|
|
| @@ -6874,7 +6874,7 @@ bool Heap::SetUp() {
|
| new OldSpace(this,
|
| max_old_generation_size_,
|
| OLD_POINTER_SPACE,
|
| - NOT_EXECUTABLE);
|
| + VirtualMemory::NOT_EXECUTABLE);
|
| if (old_pointer_space_ == NULL) return false;
|
| if (!old_pointer_space_->SetUp()) return false;
|
|
|
| @@ -6883,7 +6883,7 @@ bool Heap::SetUp() {
|
| new OldSpace(this,
|
| max_old_generation_size_,
|
| OLD_DATA_SPACE,
|
| - NOT_EXECUTABLE);
|
| + VirtualMemory::NOT_EXECUTABLE);
|
| if (old_data_space_ == NULL) return false;
|
| if (!old_data_space_->SetUp()) return false;
|
|
|
| @@ -6897,8 +6897,8 @@ bool Heap::SetUp() {
|
| }
|
| }
|
|
|
| - code_space_ =
|
| - new OldSpace(this, max_old_generation_size_, CODE_SPACE, EXECUTABLE);
|
| + code_space_ = new OldSpace(
|
| + this, max_old_generation_size_, CODE_SPACE, VirtualMemory::EXECUTABLE);
|
| if (code_space_ == NULL) return false;
|
| if (!code_space_->SetUp()) return false;
|
|
|
| @@ -7995,8 +7995,9 @@ void Heap::FreeQueuedChunks() {
|
| MemoryChunk* inner_last = MemoryChunk::FromAddress(chunk_end - 1);
|
| while (inner <= inner_last) {
|
| // Size of a large chunk is always a multiple of
|
| - // OS::AllocateAlignment() so there is always
|
| - // enough space for a fake MemoryChunk header.
|
| + // VirtualMemory::GetAllocationGranularity() so
|
| + // there is always enough space for a fake
|
| + // MemoryChunk header.
|
| Address area_end = Min(inner->address() + Page::kPageSize, chunk_end);
|
| // Guard against overflow.
|
| if (area_end < inner->address()) area_end = chunk_end;
|
|
|