Commit 34218e55 authored by iposva@chromium.org's avatar iposva@chromium.org

- Introduce histograms collecting data about the number of set remembered set

  bits in a page.
Review URL: http://codereview.chromium.org/113819

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2045 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6e29fadb
...@@ -2664,12 +2664,13 @@ void Heap::ZapFromSpace() { ...@@ -2664,12 +2664,13 @@ void Heap::ZapFromSpace() {
#endif // DEBUG #endif // DEBUG
void Heap::IterateRSetRange(Address object_start, int Heap::IterateRSetRange(Address object_start,
Address object_end, Address object_end,
Address rset_start, Address rset_start,
ObjectSlotCallback copy_object_func) { ObjectSlotCallback copy_object_func) {
Address object_address = object_start; Address object_address = object_start;
Address rset_address = rset_start; Address rset_address = rset_start;
int set_bits_count = 0;
// Loop over all the pointers in [object_start, object_end). // Loop over all the pointers in [object_start, object_end).
while (object_address < object_end) { while (object_address < object_end) {
...@@ -2686,6 +2687,7 @@ void Heap::IterateRSetRange(Address object_start, ...@@ -2686,6 +2687,7 @@ void Heap::IterateRSetRange(Address object_start,
// If this pointer does not need to be remembered anymore, clear // If this pointer does not need to be remembered anymore, clear
// the remembered set bit. // the remembered set bit.
if (!Heap::InNewSpace(*object_p)) result_rset &= ~bitmask; if (!Heap::InNewSpace(*object_p)) result_rset &= ~bitmask;
set_bits_count++;
} }
object_address += kPointerSize; object_address += kPointerSize;
} }
...@@ -2699,6 +2701,7 @@ void Heap::IterateRSetRange(Address object_start, ...@@ -2699,6 +2701,7 @@ void Heap::IterateRSetRange(Address object_start,
} }
rset_address += kIntSize; rset_address += kIntSize;
} }
return set_bits_count;
} }
...@@ -2706,11 +2709,20 @@ void Heap::IterateRSet(PagedSpace* space, ObjectSlotCallback copy_object_func) { ...@@ -2706,11 +2709,20 @@ void Heap::IterateRSet(PagedSpace* space, ObjectSlotCallback copy_object_func) {
ASSERT(Page::is_rset_in_use()); ASSERT(Page::is_rset_in_use());
ASSERT(space == old_pointer_space_ || space == map_space_); ASSERT(space == old_pointer_space_ || space == map_space_);
static void* paged_rset_histogram = StatsTable::CreateHistogram(
"V8.RSetPaged",
0,
Page::kObjectAreaSize / kPointerSize,
30);
PageIterator it(space, PageIterator::PAGES_IN_USE); PageIterator it(space, PageIterator::PAGES_IN_USE);
while (it.has_next()) { while (it.has_next()) {
Page* page = it.next(); Page* page = it.next();
IterateRSetRange(page->ObjectAreaStart(), page->AllocationTop(), int count = IterateRSetRange(page->ObjectAreaStart(), page->AllocationTop(),
page->RSetStart(), copy_object_func); page->RSetStart(), copy_object_func);
if (paged_rset_histogram != NULL) {
StatsTable::AddHistogramSample(paged_rset_histogram, count);
}
} }
} }
......
...@@ -667,7 +667,8 @@ class Heap : public AllStatic { ...@@ -667,7 +667,8 @@ class Heap : public AllStatic {
// Iterates a range of remembered set addresses starting with rset_start // Iterates a range of remembered set addresses starting with rset_start
// corresponding to the range of allocated pointers // corresponding to the range of allocated pointers
// [object_start, object_end). // [object_start, object_end).
static void IterateRSetRange(Address object_start, // Returns the number of bits that were set.
static int IterateRSetRange(Address object_start,
Address object_end, Address object_end,
Address rset_start, Address rset_start,
ObjectSlotCallback copy_object_func); ObjectSlotCallback copy_object_func);
......
...@@ -2423,6 +2423,13 @@ void LargeObjectSpace::ClearRSet() { ...@@ -2423,6 +2423,13 @@ void LargeObjectSpace::ClearRSet() {
void LargeObjectSpace::IterateRSet(ObjectSlotCallback copy_object_func) { void LargeObjectSpace::IterateRSet(ObjectSlotCallback copy_object_func) {
ASSERT(Page::is_rset_in_use()); ASSERT(Page::is_rset_in_use());
static void* lo_rset_histogram = StatsTable::CreateHistogram(
"V8.RSetLO",
0,
// Keeping this histogram's buckets the same as the paged space histogram.
Page::kObjectAreaSize / kPointerSize,
30);
LargeObjectIterator it(this); LargeObjectIterator it(this);
while (it.has_next()) { while (it.has_next()) {
// We only have code, sequential strings, or fixed arrays in large // We only have code, sequential strings, or fixed arrays in large
...@@ -2433,16 +2440,19 @@ void LargeObjectSpace::IterateRSet(ObjectSlotCallback copy_object_func) { ...@@ -2433,16 +2440,19 @@ void LargeObjectSpace::IterateRSet(ObjectSlotCallback copy_object_func) {
// Iterate the normal page remembered set range. // Iterate the normal page remembered set range.
Page* page = Page::FromAddress(object->address()); Page* page = Page::FromAddress(object->address());
Address object_end = object->address() + object->Size(); Address object_end = object->address() + object->Size();
Heap::IterateRSetRange(page->ObjectAreaStart(), int count = Heap::IterateRSetRange(page->ObjectAreaStart(),
Min(page->ObjectAreaEnd(), object_end), Min(page->ObjectAreaEnd(), object_end),
page->RSetStart(), page->RSetStart(),
copy_object_func); copy_object_func);
// Iterate the extra array elements. // Iterate the extra array elements.
if (object_end > page->ObjectAreaEnd()) { if (object_end > page->ObjectAreaEnd()) {
Heap::IterateRSetRange(page->ObjectAreaEnd(), object_end, count += Heap::IterateRSetRange(page->ObjectAreaEnd(), object_end,
object_end, copy_object_func); object_end, copy_object_func);
} }
if (lo_rset_histogram != NULL) {
StatsTable::AddHistogramSample(lo_rset_histogram, count);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment