Index: src/spaces.cc |
=================================================================== |
--- src/spaces.cc (revision 2711) |
+++ src/spaces.cc (working copy) |
@@ -952,13 +952,13 @@ |
} |
-bool NewSpace::Grow() { |
- ASSERT(capacity_ < maximum_capacity_); |
+bool NewSpace::Double() { |
+ ASSERT(capacity_ <= maximum_capacity_ / 2); |
// 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_.Grow() || !from_space_.Grow()) return false; |
- capacity_ = to_space_.Capacity() + from_space_.Capacity(); |
+ if (!to_space_.Double() || !from_space_.Double()) return false; |
+ capacity_ *= 2; |
allocation_info_.limit = to_space_.high(); |
ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); |
return true; |
@@ -1080,16 +1080,11 @@ |
} |
-bool SemiSpace::Grow() { |
- // Commit 50% extra space but only up to maximum capacity. |
- int extra = RoundUp(capacity_ / 2, OS::AllocateAlignment()); |
- if (capacity_ + extra > maximum_capacity_) { |
- extra = maximum_capacity_ - capacity_; |
- } |
- if (!MemoryAllocator::CommitBlock(high(), extra, executable())) { |
+bool SemiSpace::Double() { |
+ if (!MemoryAllocator::CommitBlock(high(), capacity_, executable())) { |
return false; |
} |
- capacity_ += extra; |
+ capacity_ *= 2; |
return true; |
} |