Index: src/spaces.cc |
diff --git a/src/spaces.cc b/src/spaces.cc |
index 9aacf9603e42ada46f2c1953d1453695dfdeb3f8..a1bc3b9d80886afdb878685d28d0aec62391d4dd 100644 |
--- a/src/spaces.cc |
+++ b/src/spaces.cc |
@@ -924,10 +924,14 @@ void NewSpace::Flip() { |
void NewSpace::Grow() { |
+ // Double the semispace size but only up to maximum capacity. |
ASSERT(Capacity() < MaximumCapacity()); |
- if (to_space_.Grow()) { |
+ ASSERT(static_cast<size_t>(Page::kPageSize) > OS::AllocateAlignment()); |
Vyacheslav Egorov (Chromium)
2011/09/20 14:26:40
I don't think we really need this assert here. The
Michael Starzinger
2011/09/20 15:29:03
Done.
|
+ int new_capacity = Min(MaximumCapacity(), 2 * static_cast<int>(Capacity())); |
Vyacheslav Egorov (Chromium)
2011/09/20 14:26:40
We should ensure that MaxCapacity & Capacity is _a
Michael Starzinger
2011/09/20 15:29:03
Done. I just checked that it is only modified in a
|
+ int rounded_new_capacity = RoundUp(new_capacity, Page::kPageSize); |
+ if (to_space_.GrowTo(rounded_new_capacity)) { |
// Only grow from space if we managed to grow to-space. |
- if (!from_space_.Grow()) { |
+ if (!from_space_.GrowTo(rounded_new_capacity)) { |
// If we managed to grow to-space but couldn't grow from-space, |
// attempt to shrink to-space. |
if (!to_space_.ShrinkTo(from_space_.Capacity())) { |
@@ -942,9 +946,9 @@ void NewSpace::Grow() { |
void NewSpace::Shrink() { |
+ ASSERT(static_cast<size_t>(Page::kPageSize) > OS::AllocateAlignment()); |
Vyacheslav Egorov (Chromium)
2011/09/20 14:26:40
I don't think we really need this assert here. The
Michael Starzinger
2011/09/20 15:29:03
Done.
|
int new_capacity = Max(InitialCapacity(), 2 * SizeAsInt()); |
- int rounded_new_capacity = |
- RoundUp(new_capacity, static_cast<int>(OS::AllocateAlignment())); |
+ int rounded_new_capacity = RoundUp(new_capacity, Page::kPageSize); |
if (rounded_new_capacity < Capacity() && |
to_space_.ShrinkTo(rounded_new_capacity)) { |
// Only shrink from-space if we managed to shrink to-space. |
@@ -1144,15 +1148,6 @@ bool SemiSpace::Uncommit() { |
} |
-bool SemiSpace::Grow() { |
- // Double the semispace size but only up to maximum capacity. |
- ASSERT(static_cast<size_t>(Page::kPageSize) > OS::AllocateAlignment()); |
- int new_capacity = Min(maximum_capacity_, |
- RoundUp(capacity_ * 2, static_cast<int>(Page::kPageSize))); |
- return GrowTo(new_capacity); |
-} |
- |
- |
bool SemiSpace::GrowTo(int new_capacity) { |
ASSERT((new_capacity & Page::kPageAlignmentMask) == 0); |
ASSERT(new_capacity <= maximum_capacity_); |