- Reduced the maximum capacity of a semi space from 8MB to 4MB.
- Changed the semi space growth policy from doubling to increasing by 50%. This slows down V8BenchmarkSuite with 1.32% but reduces the memory footprint with 8MB per V8 instance. Review URL: http://codereview.chromium.org/164397 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2667 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
395206b1df
commit
d7449ddebf
@ -74,7 +74,7 @@ int Heap::semispace_size_ = 512*KB;
|
||||
int Heap::old_generation_size_ = 128*MB;
|
||||
int Heap::initial_semispace_size_ = 128*KB;
|
||||
#else
|
||||
int Heap::semispace_size_ = 8*MB;
|
||||
int Heap::semispace_size_ = 4*MB;
|
||||
int Heap::old_generation_size_ = 512*MB;
|
||||
int Heap::initial_semispace_size_ = 512*KB;
|
||||
#endif
|
||||
@ -641,11 +641,11 @@ void Heap::Scavenge() {
|
||||
|
||||
if (new_space_.Capacity() < new_space_.MaximumCapacity() &&
|
||||
survived_since_last_expansion_ > new_space_.Capacity()) {
|
||||
// Double the size of new space if there is room to grow and enough
|
||||
// Grow the size of new space if there is room to grow and enough
|
||||
// data has survived scavenge since the last expansion.
|
||||
// TODO(1240712): NewSpace::Double has a return value which is
|
||||
// TODO(1240712): NewSpace::Grow has a return value which is
|
||||
// ignored here.
|
||||
new_space_.Double();
|
||||
new_space_.Grow();
|
||||
survived_since_last_expansion_ = 0;
|
||||
}
|
||||
|
||||
|
@ -963,13 +963,13 @@ void NewSpace::Flip() {
|
||||
}
|
||||
|
||||
|
||||
bool NewSpace::Double() {
|
||||
ASSERT(capacity_ <= maximum_capacity_ / 2);
|
||||
bool NewSpace::Grow() {
|
||||
ASSERT(capacity_ < maximum_capacity_);
|
||||
// TODO(1240712): Failure to double the from space can result in
|
||||
// semispaces of different sizes. In the event of that failure, the
|
||||
// to space doubling should be rolled back before returning false.
|
||||
if (!to_space_.Double() || !from_space_.Double()) return false;
|
||||
capacity_ *= 2;
|
||||
if (!to_space_.Grow() || !from_space_.Grow()) return false;
|
||||
capacity_ = to_space_.Capacity() + from_space_.Capacity();
|
||||
allocation_info_.limit = to_space_.high();
|
||||
ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);
|
||||
return true;
|
||||
@ -1074,11 +1074,16 @@ void SemiSpace::TearDown() {
|
||||
}
|
||||
|
||||
|
||||
bool SemiSpace::Double() {
|
||||
if (!MemoryAllocator::CommitBlock(high(), capacity_, executable())) {
|
||||
bool SemiSpace::Grow() {
|
||||
// Commit 50% extra space but only up to maximum capacity.
|
||||
int extra = capacity_/2;
|
||||
if (capacity_ + extra > maximum_capacity_) {
|
||||
extra = maximum_capacity_ - capacity_;
|
||||
}
|
||||
if (!MemoryAllocator::CommitBlock(high(), extra, executable())) {
|
||||
return false;
|
||||
}
|
||||
capacity_ *= 2;
|
||||
capacity_ += extra;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
11
src/spaces.h
11
src/spaces.h
@ -997,11 +997,11 @@ class SemiSpace : public Space {
|
||||
// True if the space has been set up but not torn down.
|
||||
bool HasBeenSetup() { return start_ != NULL; }
|
||||
|
||||
// Double the size of the semispace by committing extra virtual memory.
|
||||
// Grow the size of the semispace by committing extra virtual memory.
|
||||
// Assumes that the caller has checked that the semispace has not reached
|
||||
// its maximum capacity (and thus there is space available in the reserved
|
||||
// address range to grow).
|
||||
bool Double();
|
||||
bool Grow();
|
||||
|
||||
// Returns the start address of the space.
|
||||
Address low() { return start_; }
|
||||
@ -1040,6 +1040,9 @@ class SemiSpace : public Space {
|
||||
virtual void Verify();
|
||||
#endif
|
||||
|
||||
// Returns the current capacity of the semi space.
|
||||
int Capacity() { return capacity_; }
|
||||
|
||||
private:
|
||||
// The current and maximum capacity of the space.
|
||||
int capacity_;
|
||||
@ -1131,9 +1134,9 @@ class NewSpace : public Space {
|
||||
// Flip the pair of spaces.
|
||||
void Flip();
|
||||
|
||||
// Doubles the capacity of the semispaces. Assumes that they are not at
|
||||
// Grow the capacity of the semispaces. Assumes that they are not at
|
||||
// their maximum capacity. Returns a flag indicating success or failure.
|
||||
bool Double();
|
||||
bool Grow();
|
||||
|
||||
// True if the address or object lies in the address range of either
|
||||
// semispace (not necessarily below the allocation pointer).
|
||||
|
Loading…
Reference in New Issue
Block a user