Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index a1e2e1671e42c0e7072e05fa194688400a41e296..c67193d2e3f5753449a0a80b27e27490cbd394d2 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -6439,5 +6439,34 @@ void Heap::CheckpointObjectStats() { |
MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
ClearObjectStats(); |
} |
+ |
+ |
+const char* Heap::GetObjectTypeName(size_t index) { |
+ if (index >= OBJECT_STATS_COUNT) return nullptr; |
+ |
+ switch (static_cast<int>(index)) { |
+#define COMPARE_AND_RETURN_NAME(name) \ |
+ case name: \ |
+ return #name; |
+ INSTANCE_TYPE_LIST(COMPARE_AND_RETURN_NAME) |
+#undef COMPARE_AND_RETURN_NAME |
+#define COMPARE_AND_RETURN_NAME(name) \ |
+ case FIRST_CODE_KIND_SUB_TYPE + Code::name: \ |
+ return "CODE_TYPE/CODE_KIND/" #name; |
+ CODE_KIND_LIST(COMPARE_AND_RETURN_NAME) |
+#undef COMPARE_AND_RETURN_NAME |
+#define COMPARE_AND_RETURN_NAME(name) \ |
+ case FIRST_FIXED_ARRAY_SUB_TYPE + name: \ |
+ return "FIXED_ARRAY_TYPE/" #name; |
+ FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COMPARE_AND_RETURN_NAME) |
+#undef COMPARE_AND_RETURN_NAME |
+#define COMPARE_AND_RETURN_NAME(name) \ |
+ case FIRST_CODE_AGE_SUB_TYPE + Code::k##name##CodeAge - Code::kFirstCodeAge: \ |
+ return "CODE_TYPE/CODE_AGE/" #name; |
+ CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
+#undef COMPARE_AND_RETURN_NAME |
+ } |
+ return nullptr; |
+} |
} |
} // namespace v8::internal |