Reviewers: Vyacheslav Egorov,
Message:
Although I'm beginning to think it would be better handle this in the outer
loop
and pass an extra boolean to EvacuateObject.
Description:
Change age-mark to not expect pages to be in increasing order.
Please review this at http://codereview.chromium.org/7144015/
SVN Base: https://v8.googlecode.com/svn/branches/experimental/gc
Affected files:
M src/heap-inl.h
M src/spaces.h
M src/spaces.cc
Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index
d35dabcb2084c6b56ca41f81f3f6ebe680794931..7cf0f4ad3f950078594dfc536227a8173ffcf10b
100644
--- a/src/heap-inl.h
+++ b/src/heap-inl.h
@@ -302,7 +302,11 @@ bool Heap::ShouldBePromoted(Address old_address, int
object_size) {
// - the object has survived a scavenge operation or
// - to space is already 25% full.
// TODO(gc): Do something about age-mark in paged new-space.
- return old_address < new_space_.age_mark()
+ NewSpacePage* page = NewSpacePage::FromAddress(old_address);
+ Address age_mark = new_space_.age_mark();
+ bool below_mark = page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK)
+ && (!page->ContainsLimit(age_mark) || old_address < age_mark);
+ return below_mark
|| (new_space_.Size() + object_size) >= (new_space_.Capacity() >> 2);
}
Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index
2671ce9e6ed90f120554987840c613f4b2a37ba3..40a981d226f355c4d00dac772a53f4cc0f43d7b8
100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -1279,6 +1279,7 @@ void SemiSpace::FlipPages(intptr_t flags, intptr_t
mask) {
if (becomes_to_space) {
page->ClearFlag(MemoryChunk::IN_FROM_SPACE);
page->SetFlag(MemoryChunk::IN_TO_SPACE);
+ page->ClearFlag(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK);
} else {
page->SetFlag(MemoryChunk::IN_FROM_SPACE);
page->ClearFlag(MemoryChunk::IN_TO_SPACE);
@@ -1590,6 +1591,16 @@ void NewSpace::RecordPromotion(HeapObject* obj) {
#endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
+void SemiSpace::set_age_mark(Address mark) {
+ age_mark_ = mark;
+ ASSERT(to_space_.Contains(mark));
+ // Mark all pages up to the one containing mark.
+ NewSpacePageIterator it(space_low(), mark);
+ while (it.has_next()) {
+ it.next()->SetFlag(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK);
+ }
+}
+
//
-----------------------------------------------------------------------------
// Free lists for old object spaces implementation
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index
a910dac6663ecc8be93aa227881805ca481b5185..41c12b448d8c6f70aaec11b9a9d3657551e1534c
100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -389,6 +389,7 @@ class MemoryChunk {
SCAN_ON_SCAVENGE,
IN_FROM_SPACE, // Mutually exclusive with IN_TO_SPACE.
IN_TO_SPACE, // All pages in new space has one of these two set.
+ NEW_SPACE_BELOW_AGE_MARK,
NUM_MEMORY_CHUNK_FLAGS
};
@@ -1651,7 +1652,7 @@ class SemiSpace : public Space {
// Age mark accessors.
Address age_mark() { return age_mark_; }
- void set_age_mark(Address mark) { age_mark_ = mark; }
+ void set_age_mark(Address mark);
// If we don't have these here then SemiSpace will be abstract. However
// they should never be called.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev