Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 9986df8bf2dd399a8ed836af7b6b353a5221d59c..16300c515fe291592a14aca855daa2ee3aeac904 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -5348,6 +5348,10 @@ HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), |
physical_space_size_(0) { } |
+HeapObjectStatistics::HeapObjectStatistics(): object_type_(nullptr), |
+ object_count_(0), |
+ object_size_(0) { } |
+ |
bool v8::V8::InitializeICU(const char* icu_data_file) { |
return i::InitializeICU(icu_data_file); |
} |
@@ -6921,6 +6925,36 @@ bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, |
} |
+size_t Isolate::NumberOfTrackedGCObjectsTypes() { |
+ return i::Heap::OBJECT_STATS_COUNT; |
+} |
+ |
+ |
+bool Isolate::GetHeapObjectStatisticsAtLastGC( |
+ HeapObjectStatistics* object_statistics, size_t type_index) { |
+ if (!object_statistics) return false; |
+ if (type_index >= i::Heap::OBJECT_STATS_COUNT) return false; |
+ if (!i::FLAG_track_gc_object_stats) return false; |
+ |
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
+ i::Heap* heap = isolate->heap(); |
+ const char* object_type = heap->GetObjectTypeName(type_index); |
+ size_t object_count = heap->object_count_last_gc(type_index); |
+ size_t object_size = heap->object_size_last_gc(type_index); |
+ if (object_type == nullptr) { |
+ // There should be no objects counted when the type is unknown. |
+ DCHECK_EQ(object_count, 0); |
+ DCHECK_EQ(object_size, 0); |
+ return false; |
+ } |
+ |
+ object_statistics->object_type_ = object_type; |
+ object_statistics->object_count_ = object_count; |
+ object_statistics->object_size_ = object_size; |
+ return true; |
+} |
+ |
+ |
void Isolate::GetStackSample(const RegisterState& state, void** frames, |
size_t frames_limit, SampleInfo* sample_info) { |
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |