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

Unified Diff: src/spaces.cc

Issue 9950048: Reduce initial boot-up memory use. This is an other attempt at what (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 9 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
« src/spaces.h ('K') | « src/spaces.h ('k') | src/spaces-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.cc
===================================================================
--- src/spaces.cc (revision 11201)
+++ src/spaces.cc (working copy)
@@ -565,11 +565,10 @@
}
-Page* MemoryAllocator::AllocatePage(PagedSpace* owner,
+Page* MemoryAllocator::AllocatePage(intptr_t size,
+ PagedSpace* owner,
Executability executable) {
- MemoryChunk* chunk = AllocateChunk(owner->AreaSize(),
- executable,
- owner);
+ MemoryChunk* chunk = AllocateChunk(size, executable, owner);
if (chunk == NULL) return NULL;
@@ -833,7 +832,6 @@
bool PagedSpace::CanExpand() {
ASSERT(max_capacity_ % AreaSize() == 0);
- ASSERT(Capacity() % AreaSize() == 0);
if (Capacity() == max_capacity_) return false;
@@ -848,8 +846,14 @@
bool PagedSpace::Expand() {
if (!CanExpand()) return false;
- Page* p = heap()->isolate()->memory_allocator()->
- AllocatePage(this, executable());
+ intptr_t size = AreaSize();
+
+ if (anchor_.next_page() == &anchor_) {
+ size = SizeOfFirstPage();
+ }
+
+ Page* p = heap()->isolate()->memory_allocator()->AllocatePage(
+ size, this, executable());
if (p == NULL) return false;
ASSERT(Capacity() <= max_capacity_);
@@ -860,6 +864,39 @@
}
+intptr_t PagedSpace::SizeOfFirstPage() {
+ int size = 0;
+ void* dummy;
+ switch (identity()) {
+ case OLD_POINTER_SPACE:
+ size = 64 * sizeof(dummy) * KB;
Michael Starzinger 2012/04/02 08:25:05 Why not use kPointerSize here?
+ break;
+ case OLD_DATA_SPACE:
+ size = 192 * KB;
+ break;
+ case MAP_SPACE:
+ size = 128 * KB;
+ break;
+ case CELL_SPACE:
+ size = 96 * KB;
+ break;
+ case CODE_SPACE:
+ if (sizeof(dummy) == 8) {
Michael Starzinger 2012/04/02 08:25:05 Why not use kPointerSize here?
+ // On x64 we allocate code pages in a special way (from the reserved
+ // 2Byte area). That part of the code is not yet upgraded to handle
+ // small pages.
+ size = AreaSize();
+ } else {
+ size = 384 * KB;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ return Min(size, AreaSize());
+}
+
+
int PagedSpace::CountTotalPages() {
PageIterator it(this);
int count = 0;
@@ -903,7 +940,6 @@
}
ASSERT(Capacity() > 0);
- ASSERT(Capacity() % AreaSize() == 0);
accounting_stats_.ShrinkSpace(AreaSize());
}
@@ -1042,6 +1078,7 @@
if (!to_space_.Commit()) {
return false;
}
+ ASSERT(!from_space_.is_committed()); // No need to use memory yet.
start_ = chunk_base_;
address_mask_ = ~(2 * reserved_semispace_capacity - 1);
« src/spaces.h ('K') | « src/spaces.h ('k') | src/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698