Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 9d4356c5140777598b0c67ebc3d293fc3bcacc37..afaec338a420631d801673c98b8d424047f73bb2 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -5462,6 +5462,13 @@ HeapStatistics::HeapStatistics(): total_heap_size_(0), |
| heap_size_limit_(0) { } |
| +HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), |
| + space_size_(0), |
| + space_used_size_(0), |
| + space_avalable_size_(0), |
| + physical_space_size_(0) { } |
| + |
| + |
| bool v8::V8::InitializeICU(const char* icu_data_file) { |
| return i::InitializeICU(icu_data_file); |
| } |
| @@ -6999,6 +7006,40 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { |
| } |
| +int Isolate::NumberOfHeapSpaces() { return i::LAST_SPACE - i::FIRST_SPACE + 1; } |
|
rmcilroy
2015/04/15 10:21:42
nit - newline for body
ssid
2015/04/15 10:43:58
Done.
|
| + |
| + |
| +void Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, |
| + int index) { |
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| + i::Heap* heap = isolate->heap(); |
|
rmcilroy
2015/04/15 10:21:42
check for space_statistics being null.
rmcilroy
2015/04/15 10:21:42
check for index out-of-bounds
ssid
2015/04/15 10:43:57
Done.
|
| + if (index == i::NEW_SPACE) { |
| + space_statistics->space_name_ = heap->GetSpaceName(i::NEW_SPACE); |
| + space_statistics->space_size_ = heap->new_space()->CommittedMemory(); |
| + space_statistics->space_used_size_ = heap->new_space()->Size(); |
|
rmcilroy
2015/04/15 10:21:42
SizeOfObjects
ssid
2015/04/15 10:29:20
PrintShortHeapStatistics() uses Size() and not Siz
rmcilroy
2015/04/15 12:17:40
SizeOfObjects() calls Size() for the newspace, so
|
| + space_statistics->space_avalable_size_ = heap->new_space()->Available(); |
| + space_statistics->physical_space_size_ = |
| + heap->new_space()->CommittedPhysicalMemory(); |
| + } else if (index >= i::FIRST_PAGED_SPACE && index <= i::LAST_PAGED_SPACE) { |
| + space_statistics->space_name_ = heap->GetSpaceName(index); |
| + space_statistics->space_size_ = heap->paged_space(index)->CommittedMemory(); |
| + space_statistics->space_used_size_ = |
| + heap->paged_space(index)->SizeOfObjects(); |
| + space_statistics->space_avalable_size_ = |
| + heap->paged_space(index)->Available(); |
| + space_statistics->physical_space_size_ = |
| + heap->paged_space(index)->CommittedPhysicalMemory(); |
| + } else if (index == i::LO_SPACE) { |
| + space_statistics->space_name_ = heap->GetSpaceName(i::LO_SPACE); |
| + space_statistics->space_size_ = heap->lo_space()->CommittedMemory(); |
| + space_statistics->space_used_size_ = heap->lo_space()->SizeOfObjects(); |
| + space_statistics->space_avalable_size_ = heap->lo_space()->Available(); |
|
rmcilroy
2015/04/15 10:21:42
Does the Spaces superclass have these methods defi
ssid
2015/04/15 10:29:20
The only line i can pull out of these three cases
rmcilroy
2015/04/15 12:17:40
+hpayer
As mentioned, you could you make these fu
Hannes Payer (out of office)
2015/04/15 21:09:23
Hmm, should be possible. I cannot think of any rea
|
| + space_statistics->physical_space_size_ = |
| + heap->lo_space()->CommittedPhysicalMemory(); |
| + } |
| +} |
| + |
| + |
| void Isolate::GetStackSample(const RegisterState& state, void** frames, |
| size_t frames_limit, SampleInfo* sample_info) { |
| i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |