Reviewers: Michael Starzinger,

Description:
When shrinking semispace don't relink pages if semispace is not committed

[email protected]


Please review this at http://codereview.chromium.org/9086005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/spaces.cc


Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index 84b0f1bcb49c8191521ad1497aa2d3e67aac8ea3..b82d06c49f21f8d34f4c3a8ae93858cb85cfc1a8 100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -1263,11 +1263,16 @@ bool SemiSpace::ShrinkTo(int new_capacity) {
   Address old_start = space_end - capacity_;
   size_t delta = capacity_ - new_capacity;
   ASSERT(IsAligned(delta, OS::AllocateAlignment()));
- if (!heap()->isolate()->memory_allocator()->UncommitBlock(old_start, delta)) {
+  if (is_committed() &&
+ !heap()->isolate()->memory_allocator()->UncommitBlock(old_start, delta)) {
     return false;
   }
   capacity_ = new_capacity;

+  if (!is_committed()) {
+    return true;
+  }
+
   int pages_after = capacity_ / Page::kPageSize;
   NewSpacePage* new_last_page =
       NewSpacePage::FromAddress(space_end - pages_after * Page::kPageSize);


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to