Commit 5e0a513e authored by ager@chromium.org's avatar ager@chromium.org

Temporarily revert the reduction of semispace sizes and the growth

policy change.

I will put the changes back one at a time so we can see the effect of
them in isolation.  Also, there is a bug in the growth policy change
that I will fix before putting it back again.

Review URL: http://codereview.chromium.org/174050

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2712 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b9f39307
...@@ -74,11 +74,11 @@ int Heap::semispace_size_ = 512*KB; ...@@ -74,11 +74,11 @@ int Heap::semispace_size_ = 512*KB;
int Heap::old_generation_size_ = 128*MB; int Heap::old_generation_size_ = 128*MB;
int Heap::initial_semispace_size_ = 128*KB; int Heap::initial_semispace_size_ = 128*KB;
#elseif defined(V8_TARGET_ARCH_X64) #elseif defined(V8_TARGET_ARCH_X64)
int Heap::semispace_size_ = 8*MB; int Heap::semispace_size_ = 16*MB;
int Heap::old_generation_size_ = 1*GB; int Heap::old_generation_size_ = 1*GB;
int Heap::initial_semispace_size_ = 1*MB; int Heap::initial_semispace_size_ = 1*MB;
#else #else
int Heap::semispace_size_ = 4*MB; int Heap::semispace_size_ = 8*MB;
int Heap::old_generation_size_ = 512*MB; int Heap::old_generation_size_ = 512*MB;
int Heap::initial_semispace_size_ = 512*KB; int Heap::initial_semispace_size_ = 512*KB;
#endif #endif
...@@ -661,11 +661,11 @@ void Heap::Scavenge() { ...@@ -661,11 +661,11 @@ void Heap::Scavenge() {
if (new_space_.Capacity() < new_space_.MaximumCapacity() && if (new_space_.Capacity() < new_space_.MaximumCapacity() &&
survived_since_last_expansion_ > new_space_.Capacity()) { survived_since_last_expansion_ > new_space_.Capacity()) {
// Grow the size of new space if there is room to grow and enough // Double the size of new space if there is room to grow and enough
// data has survived scavenge since the last expansion. // data has survived scavenge since the last expansion.
// TODO(1240712): NewSpace::Grow has a return value which is // TODO(1240712): NewSpace::Double has a return value which is
// ignored here. // ignored here.
new_space_.Grow(); new_space_.Double();
survived_since_last_expansion_ = 0; survived_since_last_expansion_ = 0;
} }
......
...@@ -952,13 +952,13 @@ void NewSpace::Flip() { ...@@ -952,13 +952,13 @@ void NewSpace::Flip() {
} }
bool NewSpace::Grow() { bool NewSpace::Double() {
ASSERT(capacity_ < maximum_capacity_); ASSERT(capacity_ <= maximum_capacity_ / 2);
// TODO(1240712): Failure to double the from space can result in // TODO(1240712): Failure to double the from space can result in
// semispaces of different sizes. In the event of that failure, the // semispaces of different sizes. In the event of that failure, the
// to space doubling should be rolled back before returning false. // to space doubling should be rolled back before returning false.
if (!to_space_.Grow() || !from_space_.Grow()) return false; if (!to_space_.Double() || !from_space_.Double()) return false;
capacity_ = to_space_.Capacity() + from_space_.Capacity(); capacity_ *= 2;
allocation_info_.limit = to_space_.high(); allocation_info_.limit = to_space_.high();
ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);
return true; return true;
...@@ -1080,16 +1080,11 @@ void SemiSpace::TearDown() { ...@@ -1080,16 +1080,11 @@ void SemiSpace::TearDown() {
} }
bool SemiSpace::Grow() { bool SemiSpace::Double() {
// Commit 50% extra space but only up to maximum capacity. if (!MemoryAllocator::CommitBlock(high(), capacity_, executable())) {
int extra = RoundUp(capacity_ / 2, OS::AllocateAlignment());
if (capacity_ + extra > maximum_capacity_) {
extra = maximum_capacity_ - capacity_;
}
if (!MemoryAllocator::CommitBlock(high(), extra, executable())) {
return false; return false;
} }
capacity_ += extra; capacity_ *= 2;
return true; return true;
} }
......
...@@ -1004,11 +1004,11 @@ class SemiSpace : public Space { ...@@ -1004,11 +1004,11 @@ class SemiSpace : public Space {
// True if the space has been set up but not torn down. // True if the space has been set up but not torn down.
bool HasBeenSetup() { return start_ != NULL; } bool HasBeenSetup() { return start_ != NULL; }
// Grow the size of the semispace by committing extra virtual memory. // Double the size of the semispace by committing extra virtual memory.
// Assumes that the caller has checked that the semispace has not reached // Assumes that the caller has checked that the semispace has not reached
// its maximum capacity (and thus there is space available in the reserved // its maximum capacity (and thus there is space available in the reserved
// address range to grow). // address range to grow).
bool Grow(); bool Double();
// Returns the start address of the space. // Returns the start address of the space.
Address low() { return start_; } Address low() { return start_; }
...@@ -1051,9 +1051,6 @@ class SemiSpace : public Space { ...@@ -1051,9 +1051,6 @@ class SemiSpace : public Space {
virtual void Verify(); virtual void Verify();
#endif #endif
// Returns the current capacity of the semi space.
int Capacity() { return capacity_; }
private: private:
// The current and maximum capacity of the space. // The current and maximum capacity of the space.
int capacity_; int capacity_;
...@@ -1147,9 +1144,9 @@ class NewSpace : public Space { ...@@ -1147,9 +1144,9 @@ class NewSpace : public Space {
// Flip the pair of spaces. // Flip the pair of spaces.
void Flip(); void Flip();
// Grow the capacity of the semispaces. Assumes that they are not at // Doubles the capacity of the semispaces. Assumes that they are not at
// their maximum capacity. Returns a flag indicating success or failure. // their maximum capacity. Returns a flag indicating success or failure.
bool Grow(); bool Double();
// True if the address or object lies in the address range of either // True if the address or object lies in the address range of either
// semispace (not necessarily below the allocation pointer). // semispace (not necessarily below the allocation pointer).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment