Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: src/heap.cc

Issue 202017: Do not use left-over space after new space alignment for other spaces.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 2849)
+++ src/heap.cc (working copy)
@@ -3185,63 +3185,49 @@
if (!ConfigureHeapDefault()) return false;
}
- // Setup memory allocator and allocate an initial chunk of memory. The
- // initial chunk is double the size of the new space to ensure that we can
- // find a pair of semispaces that are contiguous and aligned to their size.
+ // Setup memory allocator and reserve a chunk of memory for new
+ // space. The chunk is double the size of the new space to ensure
+ // that we can find a pair of semispaces that are contiguous and
+ // aligned to their size.
if (!MemoryAllocator::Setup(MaxCapacity())) return false;
- void* chunk
- = MemoryAllocator::ReserveInitialChunk(2 * young_generation_size_);
+ void* chunk =
+ MemoryAllocator::ReserveInitialChunk(2 * young_generation_size_);
if (chunk == NULL) return false;
- // Put the initial chunk of the old space at the start of the initial
- // chunk, then the two new space semispaces, then the initial chunk of
- // code space. Align the pair of semispaces to their size, which must be
- // a power of 2.
+ // Align the pair of semispaces to their size, which must be a power
+ // of 2.
ASSERT(IsPowerOf2(young_generation_size_));
- Address code_space_start = reinterpret_cast<Address>(chunk);
- Address new_space_start = RoundUp(code_space_start, young_generation_size_);
- Address old_space_start = new_space_start + young_generation_size_;
- int code_space_size = new_space_start - code_space_start;
- int old_space_size = young_generation_size_ - code_space_size;
-
- // Initialize new space.
+ Address new_space_start =
+ RoundUp(reinterpret_cast<byte*>(chunk), young_generation_size_);
if (!new_space_.Setup(new_space_start, young_generation_size_)) return false;
- // Initialize old space, set the maximum capacity to the old generation
- // size. It will not contain code.
+ // Initialize old pointer space.
old_pointer_space_ =
new OldSpace(old_generation_size_, OLD_POINTER_SPACE, NOT_EXECUTABLE);
if (old_pointer_space_ == NULL) return false;
- if (!old_pointer_space_->Setup(old_space_start, old_space_size >> 1)) {
- return false;
- }
+ if (!old_pointer_space_->Setup(NULL, 0)) return false;
+
+ // Initialize old data space.
old_data_space_ =
new OldSpace(old_generation_size_, OLD_DATA_SPACE, NOT_EXECUTABLE);
if (old_data_space_ == NULL) return false;
- if (!old_data_space_->Setup(old_space_start + (old_space_size >> 1),
- old_space_size >> 1)) {
- return false;
- }
+ if (!old_data_space_->Setup(NULL, 0)) return false;
// Initialize the code space, set its maximum capacity to the old
// generation size. It needs executable memory.
code_space_ =
new OldSpace(old_generation_size_, CODE_SPACE, EXECUTABLE);
if (code_space_ == NULL) return false;
- if (!code_space_->Setup(code_space_start, code_space_size)) return false;
+ if (!code_space_->Setup(NULL, 0)) return false;
// Initialize map space.
map_space_ = new MapSpace(kMaxMapSpaceSize, MAP_SPACE);
if (map_space_ == NULL) return false;
- // Setting up a paged space without giving it a virtual memory range big
- // enough to hold at least a page will cause it to allocate.
if (!map_space_->Setup(NULL, 0)) return false;
// Initialize global property cell space.
cell_space_ = new CellSpace(old_generation_size_, CELL_SPACE);
if (cell_space_ == NULL) return false;
- // Setting up a paged space without giving it a virtual memory range big
- // enough to hold at least a page will cause it to allocate.
if (!cell_space_->Setup(NULL, 0)) return false;
// The large object code space may contain code or data. We set the memory
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698