Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index a448292789ad72511cb6c6922dc903bc1f14eb8a..ea65f274d641dec4108996cd6864b9b316df5f28 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -179,6 +179,8 @@ Heap::Heap() |
| // Put a dummy entry in the remembered pages so we can find the list the |
| // minidump even if there are no real unmapped pages. |
| RememberUnmappedPage(NULL, false); |
| + |
| + ClearObjectStats(true); |
| } |
| @@ -7225,4 +7227,31 @@ void Heap::RememberUnmappedPage(Address page, bool compacted) { |
| remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |
| } |
| + |
| +void Heap::ClearObjectStats(bool clear_last_time_stats) { |
| + memset(object_counts_, 0, sizeof(object_counts_)); |
| + memset(object_sizes_, 0, sizeof(object_counts_)); |
|
Michael Starzinger
2012/07/12 20:12:26
Better use sizeof(object_sizes_) here.
danno
2012/07/12 21:18:16
Done.
|
| + if (clear_last_time_stats) { |
| + memset(object_counts_last_time_, 0, sizeof(object_counts_last_time_)); |
| + memset(object_sizes_last_time_, 0, sizeof(object_sizes_last_time_)); |
| + } |
| +} |
| + |
| + |
| +void Heap::CheckpointObjectStats() { |
| + Counters* counters = isolate()->counters(); |
| +#define ADJUST_LAST_TIME_OBJECT_COUNT(name) \ |
| + counters->count_of_##name()->Increment(object_counts_[name]); \ |
|
Michael Starzinger
2012/07/12 20:12:26
Is there a particular reason we cannot use counter
danno
2012/07/12 21:18:16
Yes, the reason is that you can have multiple isol
|
| + counters->count_of_##name()->Decrement(object_counts_last_time_[name]); \ |
| + counters->size_of_##name()->Increment(object_sizes_[name]); \ |
| + counters->size_of_##name()->Decrement(object_sizes_last_time_[name]); |
| + INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
| +#undef ADJUST_LAST_TIME_OBJECT_COUNT |
| + memcpy(object_counts_last_time_, object_counts_, |
| + sizeof(object_counts_)); |
| + memcpy(object_sizes_last_time_, object_sizes_, |
| + sizeof(object_sizes_)); |
| + ClearObjectStats(); |
| +} |
| + |
| } } // namespace v8::internal |