Commit 768c41c8 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[object-stats] Better accounting

- Add WASM types
- Account for FeedbackMetadata
- Account entries in FunctionTemplateInfo

Bug: v8:7266
Change-Id: I527792768bb11a3540a34e7c00db311609a40b01
Reviewed-on: https://chromium-review.googlesource.com/894524Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50977}
parent 268531b3
...@@ -214,9 +214,12 @@ class ObjectStatsCollectorImpl { ...@@ -214,9 +214,12 @@ class ObjectStatsCollectorImpl {
kIgnoreCow, kIgnoreCow,
}; };
Isolate* isolate() { return heap_->isolate(); }
bool RecordVirtualObjectStats(HeapObject* parent, HeapObject* obj, bool RecordVirtualObjectStats(HeapObject* parent, HeapObject* obj,
ObjectStats::VirtualInstanceType type, ObjectStats::VirtualInstanceType type,
size_t size, size_t over_allocated); size_t size, size_t over_allocated,
CowMode check_cow_array = kCheckCow);
// Gets size from |ob| and assumes no over allocating. // Gets size from |ob| and assumes no over allocating.
bool RecordSimpleVirtualObjectStats(HeapObject* parent, HeapObject* obj, bool RecordSimpleVirtualObjectStats(HeapObject* parent, HeapObject* obj,
ObjectStats::VirtualInstanceType type); ObjectStats::VirtualInstanceType type);
...@@ -249,6 +252,7 @@ class ObjectStatsCollectorImpl { ...@@ -249,6 +252,7 @@ class ObjectStatsCollectorImpl {
void RecordVirtualContext(Context* context); void RecordVirtualContext(Context* context);
void RecordVirtualFeedbackVectorDetails(FeedbackVector* vector); void RecordVirtualFeedbackVectorDetails(FeedbackVector* vector);
void RecordVirtualFixedArrayDetails(FixedArray* array); void RecordVirtualFixedArrayDetails(FixedArray* array);
void RecordVirtualFunctionTemplateInfoDetails(FunctionTemplateInfo* fti);
void RecordVirtualJSGlobalObjectDetails(JSGlobalObject* object); void RecordVirtualJSGlobalObjectDetails(JSGlobalObject* object);
void RecordVirtualJSCollectionDetails(JSObject* object); void RecordVirtualJSCollectionDetails(JSObject* object);
void RecordVirtualJSObjectDetails(JSObject* object); void RecordVirtualJSObjectDetails(JSObject* object);
...@@ -293,13 +297,13 @@ bool ObjectStatsCollectorImpl::RecordSimpleVirtualObjectStats( ...@@ -293,13 +297,13 @@ bool ObjectStatsCollectorImpl::RecordSimpleVirtualObjectStats(
HeapObject* parent, HeapObject* obj, HeapObject* parent, HeapObject* obj,
ObjectStats::VirtualInstanceType type) { ObjectStats::VirtualInstanceType type) {
return RecordVirtualObjectStats(parent, obj, type, obj->Size(), return RecordVirtualObjectStats(parent, obj, type, obj->Size(),
ObjectStats::kNoOverAllocation); ObjectStats::kNoOverAllocation, kCheckCow);
} }
bool ObjectStatsCollectorImpl::RecordVirtualObjectStats( bool ObjectStatsCollectorImpl::RecordVirtualObjectStats(
HeapObject* parent, HeapObject* obj, ObjectStats::VirtualInstanceType type, HeapObject* parent, HeapObject* obj, ObjectStats::VirtualInstanceType type,
size_t size, size_t over_allocated) { size_t size, size_t over_allocated, CowMode check_cow_array) {
if (!SameLiveness(parent, obj) || !ShouldRecordObject(obj, kCheckCow)) if (!SameLiveness(parent, obj) || !ShouldRecordObject(obj, check_cow_array))
return false; return false;
if (virtual_objects_.find(obj) == virtual_objects_.end()) { if (virtual_objects_.find(obj) == virtual_objects_.end()) {
...@@ -339,6 +343,22 @@ void ObjectStatsCollectorImpl::RecordVirtualAllocationSiteDetails( ...@@ -339,6 +343,22 @@ void ObjectStatsCollectorImpl::RecordVirtualAllocationSiteDetails(
ObjectStats::BOILERPLATE_ELEMENTS_TYPE); ObjectStats::BOILERPLATE_ELEMENTS_TYPE);
} }
void ObjectStatsCollectorImpl::RecordVirtualFunctionTemplateInfoDetails(
FunctionTemplateInfo* fti) {
// named_property_handler and indexed_property_handler are recorded as
// INTERCEPTOR_INFO_TYPE.
if (!fti->call_code()->IsUndefined(isolate())) {
RecordSimpleVirtualObjectStats(
fti, CallHandlerInfo::cast(fti->call_code()),
ObjectStats::FUNCTION_TEMPLATE_INFO_ENTRIES_TYPE);
}
if (!fti->instance_call_handler()->IsUndefined(isolate())) {
RecordSimpleVirtualObjectStats(
fti, CallHandlerInfo::cast(fti->instance_call_handler()),
ObjectStats::FUNCTION_TEMPLATE_INFO_ENTRIES_TYPE);
}
}
void ObjectStatsCollectorImpl::RecordVirtualJSGlobalObjectDetails( void ObjectStatsCollectorImpl::RecordVirtualJSGlobalObjectDetails(
JSGlobalObject* object) { JSGlobalObject* object) {
// Properties. // Properties.
...@@ -400,16 +420,9 @@ void ObjectStatsCollectorImpl::RecordVirtualFeedbackVectorDetails( ...@@ -400,16 +420,9 @@ void ObjectStatsCollectorImpl::RecordVirtualFeedbackVectorDetails(
void ObjectStatsCollectorImpl::RecordVirtualFixedArrayDetails( void ObjectStatsCollectorImpl::RecordVirtualFixedArrayDetails(
FixedArray* array) { FixedArray* array) {
if (IsCowArray(array)) { if (IsCowArray(array)) {
// Manually check and dispatch to lower level recording due to COW array RecordVirtualObjectStats(nullptr, array, ObjectStats::COW_ARRAY_TYPE,
// check. No need for SameLiveness as we call it on a single object. array->Size(), ObjectStats::kNoOverAllocation,
if (!ShouldRecordObject(array, kIgnoreCow)) return; kIgnoreCow);
if (virtual_objects_.find(array) == virtual_objects_.end()) {
virtual_objects_.insert(array);
stats_->RecordVirtualObjectStats(ObjectStats::COW_ARRAY_TYPE,
array->Size(),
ObjectStats::kNoOverAllocation);
}
} }
} }
...@@ -425,6 +438,9 @@ void ObjectStatsCollectorImpl::CollectStatistics(HeapObject* obj, Phase phase) { ...@@ -425,6 +438,9 @@ void ObjectStatsCollectorImpl::CollectStatistics(HeapObject* obj, Phase phase) {
RecordVirtualBytecodeArrayDetails(BytecodeArray::cast(obj)); RecordVirtualBytecodeArrayDetails(BytecodeArray::cast(obj));
} else if (obj->IsCode()) { } else if (obj->IsCode()) {
RecordVirtualCodeDetails(Code::cast(obj)); RecordVirtualCodeDetails(Code::cast(obj));
} else if (obj->IsFunctionTemplateInfo()) {
RecordVirtualFunctionTemplateInfoDetails(
FunctionTemplateInfo::cast(obj));
} else if (obj->IsJSGlobalObject()) { } else if (obj->IsJSGlobalObject()) {
RecordVirtualJSGlobalObjectDetails(JSGlobalObject::cast(obj)); RecordVirtualJSGlobalObjectDetails(JSGlobalObject::cast(obj));
} else if (obj->IsJSObject()) { } else if (obj->IsJSObject()) {
...@@ -571,6 +587,10 @@ void ObjectStatsCollectorImpl::RecordVirtualSharedFunctionInfoDetails( ...@@ -571,6 +587,10 @@ void ObjectStatsCollectorImpl::RecordVirtualSharedFunctionInfoDetails(
// SharedFunctonInfo::feedback_metadata() is a COW array. // SharedFunctonInfo::feedback_metadata() is a COW array.
RecordSimpleVirtualObjectStats(info, info->scope_info(), RecordSimpleVirtualObjectStats(info, info->scope_info(),
ObjectStats::SCOPE_INFO_TYPE); ObjectStats::SCOPE_INFO_TYPE);
FeedbackMetadata* fm = FeedbackMetadata::cast(info->feedback_metadata());
RecordVirtualObjectStats(info, fm, ObjectStats::FEEDBACK_METADATA_TYPE,
fm->Size(), ObjectStats::kNoOverAllocation,
kIgnoreCow);
} }
namespace { namespace {
......
...@@ -29,8 +29,10 @@ ...@@ -29,8 +29,10 @@
V(EMBEDDED_OBJECT_TYPE) \ V(EMBEDDED_OBJECT_TYPE) \
V(ENUM_CACHE_TYPE) \ V(ENUM_CACHE_TYPE) \
V(ENUM_INDICES_CACHE_TYPE) \ V(ENUM_INDICES_CACHE_TYPE) \
V(FEEDBACK_METADATA_TYPE) \
V(FEEDBACK_VECTOR_ENTRY_TYPE) \ V(FEEDBACK_VECTOR_ENTRY_TYPE) \
V(FUNCTION_CONTEXT_TYPE) \ V(FUNCTION_CONTEXT_TYPE) \
V(FUNCTION_TEMPLATE_INFO_ENTRIES_TYPE) \
V(GLOBAL_ELEMENTS_TYPE) \ V(GLOBAL_ELEMENTS_TYPE) \
V(GLOBAL_PROPERTIES_TYPE) \ V(GLOBAL_PROPERTIES_TYPE) \
V(JS_ARRAY_BOILERPLATE_TYPE) \ V(JS_ARRAY_BOILERPLATE_TYPE) \
......
...@@ -56,6 +56,7 @@ const CATEGORIES = new Map([ ...@@ -56,6 +56,7 @@ const CATEGORIES = new Map([
'JS_SET_TYPE', 'JS_SET_TYPE',
'JS_SET_VALUE_ITERATOR_TYPE', 'JS_SET_VALUE_ITERATOR_TYPE',
'JS_STRING_ITERATOR_TYPE', 'JS_STRING_ITERATOR_TYPE',
'JS_TO_WASM_FUNCTION',
'JS_TYPED_ARRAY_TYPE', 'JS_TYPED_ARRAY_TYPE',
'JS_VALUE_TYPE', 'JS_VALUE_TYPE',
'JS_WEAK_MAP_TYPE', 'JS_WEAK_MAP_TYPE',
...@@ -75,6 +76,9 @@ const CATEGORIES = new Map([ ...@@ -75,6 +76,9 @@ const CATEGORIES = new Map([
'SYMBOL_TYPE', 'SYMBOL_TYPE',
'THIN_ONE_BYTE_STRING_TYPE', 'THIN_ONE_BYTE_STRING_TYPE',
'THIN_STRING_TYPE', 'THIN_STRING_TYPE',
'WASM_INSTANCE_TYPE',
'WASM_MEMORY_TYPE',
'WASM_MODULE_TYPE',
]) ])
], ],
[ [
...@@ -94,6 +98,7 @@ const CATEGORIES = new Map([ ...@@ -94,6 +98,7 @@ const CATEGORIES = new Map([
'ENUM_CACHE_TYPE', 'ENUM_CACHE_TYPE',
'ENUM_INDICES_CACHE_TYPE', 'ENUM_INDICES_CACHE_TYPE',
'FOREIGN_TYPE', 'FOREIGN_TYPE',
'FUNCTION_TEMPLATE_INFO_ENTRIES_TYPE',
'FUNCTION_TEMPLATE_INFO_TYPE', 'FUNCTION_TEMPLATE_INFO_TYPE',
'INTERCEPTOR_INFO_TYPE', 'INTERCEPTOR_INFO_TYPE',
'JS_API_OBJECT_TYPE', 'JS_API_OBJECT_TYPE',
...@@ -138,6 +143,7 @@ const CATEGORIES = new Map([ ...@@ -138,6 +143,7 @@ const CATEGORIES = new Map([
'CODE_DATA_CONTAINER_TYPE', 'CODE_DATA_CONTAINER_TYPE',
'DEOPTIMIZATION_DATA_TYPE', 'DEOPTIMIZATION_DATA_TYPE',
'EMBEDDED_OBJECT_TYPE', 'EMBEDDED_OBJECT_TYPE',
'FEEDBACK_METADATA_TYPE',
'FEEDBACK_VECTOR_ENTRY_TYPE', 'FEEDBACK_VECTOR_ENTRY_TYPE',
'FEEDBACK_VECTOR_TYPE', 'FEEDBACK_VECTOR_TYPE',
'LOAD_HANDLER_TYPE', 'LOAD_HANDLER_TYPE',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment