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

Unified Diff: src/spaces.cc

Issue 174052: Reapply the semispace growth policy change in isolation.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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
« no previous file with comments | « src/spaces.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.cc
===================================================================
--- src/spaces.cc (revision 2713)
+++ src/spaces.cc (working copy)
@@ -862,8 +862,6 @@
ASSERT(initial_semispace_capacity <= maximum_semispace_capacity);
ASSERT(IsPowerOf2(maximum_semispace_capacity));
- maximum_capacity_ = maximum_semispace_capacity;
- capacity_ = initial_semispace_capacity;
// Allocate and setup the histogram arrays if necessary.
#if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
@@ -876,15 +874,17 @@
#undef SET_NAME
#endif
- ASSERT(size == 2 * maximum_capacity_);
+ ASSERT(size == 2 * maximum_semispace_capacity);
ASSERT(IsAddressAligned(start, size, 0));
- if (!to_space_.Setup(start, capacity_, maximum_capacity_)) {
+ if (!to_space_.Setup(start,
+ initial_semispace_capacity,
+ maximum_semispace_capacity)) {
return false;
}
- if (!from_space_.Setup(start + maximum_capacity_,
- capacity_,
- maximum_capacity_)) {
+ if (!from_space_.Setup(start + maximum_semispace_capacity,
+ initial_semispace_capacity,
+ maximum_semispace_capacity)) {
return false;
}
@@ -916,7 +916,6 @@
#endif
start_ = NULL;
- capacity_ = 0;
allocation_info_.top = NULL;
allocation_info_.limit = NULL;
mc_forwarding_info_.top = NULL;
@@ -952,13 +951,12 @@
}
-bool NewSpace::Double() {
- ASSERT(capacity_ <= maximum_capacity_ / 2);
+bool NewSpace::Grow() {
+ ASSERT(Capacity() < MaximumCapacity());
// 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;
allocation_info_.limit = to_space_.high();
ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);
return true;
@@ -1080,11 +1078,15 @@
}
-bool SemiSpace::Double() {
- if (!MemoryAllocator::CommitBlock(high(), capacity_, executable())) {
+bool SemiSpace::Grow() {
+ // Commit 50% extra space but only up to maximum capacity.
+ int maximum_extra = maximum_capacity_ - capacity_;
+ int extra = Min(RoundUp(capacity_ / 2, OS::AllocateAlignment()),
+ maximum_extra);
+ if (!MemoryAllocator::CommitBlock(high(), extra, executable())) {
return false;
}
- capacity_ *= 2;
+ capacity_ += extra;
return true;
}
« no previous file with comments | « src/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698