Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index a1e2e1671e42c0e7072e05fa194688400a41e296..110d60deb9e6634789d55468b5cf675df5bc67c3 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -6439,5 +6439,35 @@ 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) |
ulan
2015/05/06 12:46:02
index >= OBJECT_STATS_COUNT
ssid
2015/05/07 13:53:03
Done.
|
+ return nullptr; |
+ |
+ switch (static_cast<int>(index)) { |
+#define ADJUST_LAST_TIME_OBJECT_COUNT(name) \ |
ulan
2015/05/06 12:46:02
The name "ADJUST_LAST_TIME_OBJECT_COUNT" is confus
ssid
2015/05/07 13:53:03
Done.
|
+ case name: \ |
+ return #name; |
+ INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
+#undef ADJUST_LAST_TIME_OBJECT_COUNT |
+#define ADJUST_LAST_TIME_OBJECT_COUNT(name) \ |
+ case FIRST_CODE_KIND_SUB_TYPE + Code::name: \ |
+ return "CODE_TYPE_" #name; |
+ CODE_KIND_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
+#undef ADJUST_LAST_TIME_OBJECT_COUNT |
+#define ADJUST_LAST_TIME_OBJECT_COUNT(name) \ |
+ case FIRST_FIXED_ARRAY_SUB_TYPE + name: \ |
+ return "FIXED_ARRAY_" #name; |
+ FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
+#undef ADJUST_LAST_TIME_OBJECT_COUNT |
+#define ADJUST_LAST_TIME_OBJECT_COUNT(name) \ |
+ case FIRST_CODE_AGE_SUB_TYPE + Code::k##name##CodeAge - Code::kFirstCodeAge: \ |
+ return "CODE_AGE_" #name; |
+ CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
+#undef ADJUST_LAST_TIME_OBJECT_COUNT |
+ } |
+ return nullptr; |
+} |
} |
} // namespace v8::internal |