[object-stats] Add contexts and scope info

Bug: v8:7266
Change-Id: Ibc8df4219ea990c3e1bf7a586356689080ab9eb9
Reviewed-on: https://chromium-review.googlesource.com/879182
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50773}
This commit is contained in:
Michael Lippautz 2018-01-22 19:22:47 +01:00 committed by Commit Bot
parent 7d2be718c6
commit cddf3e3f07
3 changed files with 34 additions and 0 deletions

View File

@ -239,12 +239,14 @@ class ObjectStatsCollectorImpl {
void RecordVirtualAllocationSiteDetails(AllocationSite* site);
void RecordVirtualBytecodeArrayDetails(BytecodeArray* bytecode);
void RecordVirtualCodeDetails(Code* code);
void RecordVirtualContext(Context* context);
void RecordVirtualFeedbackVectorDetails(FeedbackVector* vector);
void RecordVirtualFixedArrayDetails(FixedArray* array);
void RecordVirtualJSGlobalObjectDetails(JSGlobalObject* object);
void RecordVirtualJSCollectionDetails(JSObject* object);
void RecordVirtualJSObjectDetails(JSObject* object);
void RecordVirtualMapDetails(Map* map);
void RecordVirtualSharedFunctionInfoDetails(SharedFunctionInfo* info);
Heap* heap_;
ObjectStats* stats_;
@ -421,7 +423,12 @@ void ObjectStatsCollectorImpl::CollectStatistics(HeapObject* obj, Phase phase) {
RecordVirtualJSObjectDetails(JSObject::cast(obj));
} else if (obj->IsJSCollection()) {
RecordVirtualJSCollectionDetails(JSObject::cast(obj));
} else if (obj->IsSharedFunctionInfo()) {
RecordVirtualSharedFunctionInfoDetails(SharedFunctionInfo::cast(obj));
} else if (obj->IsContext()) {
RecordVirtualContext(Context::cast(obj));
} else if (obj->IsFixedArray()) {
// Has to go last as it triggers too eagerly.
RecordVirtualFixedArrayDetails(FixedArray::cast(obj));
}
break;
@ -527,6 +534,13 @@ void ObjectStatsCollectorImpl::RecordVirtualMapDetails(Map* map) {
}
}
void ObjectStatsCollectorImpl::RecordVirtualSharedFunctionInfoDetails(
SharedFunctionInfo* info) {
// SharedFunctonInfo::feedback_metadata() is a COW array.
RecordSimpleVirtualObjectStats(info, info->scope_info(),
ObjectStats::SCOPE_INFO_TYPE);
}
void ObjectStatsCollectorImpl::RecordVirtualBytecodeArrayDetails(
BytecodeArray* bytecode) {
RecordVirtualObjectStats(bytecode, bytecode->constant_pool(),
@ -563,6 +577,19 @@ void ObjectStatsCollectorImpl::RecordVirtualCodeDetails(Code* code) {
code->Size(), 0);
}
void ObjectStatsCollectorImpl::RecordVirtualContext(Context* context) {
if (context->IsNativeContext()) {
RecordSimpleVirtualObjectStats(nullptr, context,
ObjectStats::NATIVE_CONTEXT_TYPE);
} else if (context->IsFunctionContext()) {
RecordSimpleVirtualObjectStats(nullptr, context,
ObjectStats::FUNCTION_CONTEXT_TYPE);
} else {
RecordSimpleVirtualObjectStats(nullptr, context,
ObjectStats::OTHER_CONTEXT_TYPE);
}
}
class ObjectStatsVisitor {
public:
ObjectStatsVisitor(Heap* heap, ObjectStatsCollectorImpl* live_collector,

View File

@ -33,19 +33,23 @@
V(ENUM_CACHE_TYPE) \
V(ENUM_INDICES_CACHE_TYPE) \
V(FEEDBACK_VECTOR_ENTRY_TYPE) \
V(FUNCTION_CONTEXT_TYPE) \
V(GLOBAL_ELEMENTS_TYPE) \
V(GLOBAL_PROPERTIES_TYPE) \
V(JS_ARRAY_BOILERPLATE_TYPE) \
V(JS_COLLETION_TABLE_TYPE) \
V(JS_OBJECT_BOILERPLATE_TYPE) \
V(NATIVE_CONTEXT_TYPE) \
V(NOSCRIPT_SHARED_FUNCTION_INFOS_TYPE) \
V(NUMBER_STRING_CACHE_TYPE) \
V(OBJECT_TO_CODE_TYPE) \
V(OTHER_CONTEXT_TYPE) \
V(PROPERTY_ARRAY_TYPE) \
V(PROPERTY_DICTIONARY_TYPE) \
V(PROTOTYPE_USERS_TYPE) \
V(REGEXP_MULTIPLE_CACHE_TYPE) \
V(RETAINED_MAPS_TYPE) \
V(SCOPE_INFO_TYPE) \
V(SCRIPT_LIST_TYPE) \
V(SERIALIZED_OBJECTS_TYPE) \
V(SINGLE_CHARACTER_STRING_CACHE_TYPE) \

View File

@ -25,6 +25,7 @@ const CATEGORIES = new Map([
'FIXED_UINT32_ARRAY_TYPE',
'FIXED_UINT8_ARRAY_TYPE',
'FIXED_UINT8_CLAMPED_ARRAY_TYPE',
'FUNCTION_CONTEXT_TYPE',
'GLOBAL_ELEMENTS_TYPE',
'GLOBAL_PROPERTIES_TYPE',
'HEAP_NUMBER_TYPE',
@ -59,6 +60,7 @@ const CATEGORIES = new Map([
'JS_VALUE_TYPE',
'JS_WEAK_MAP_TYPE',
'MUTABLE_HEAP_NUMBER_TYPE',
'NATIVE_CONTEXT_TYPE',
'ONE_BYTE_INTERNALIZED_STRING_TYPE',
'ONE_BYTE_STRING_TYPE',
'PROPERTY_ARRAY_TYPE',
@ -110,6 +112,7 @@ const CATEGORIES = new Map([
'PROTOTYPE_USERS_TYPE',
'REGEXP_MULTIPLE_CACHE_TYPE',
'RETAINED_MAPS_TYPE',
'SCOPE_INFO_TYPE',
'SCRIPT_LIST_TYPE',
'SERIALIZED_OBJECTS_TYPE',
'SINGLE_CHARACTER_STRING_CACHE_TYPE',