Commit cf500ac1 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[object-stats] Distinguish FeedbackVector entries

Record seperate virtual instance types for entries in FeedbackVectors:
- FEEDBACK_VECTOR_ENTRY_TYPE

 Bug: v8:7266

Change-Id: Ibea0615ecd23099e0107505e5d33cf194aade7c0
Reviewed-on: https://chromium-review.googlesource.com/866878
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50678}
parent 2dc800c8
......@@ -282,6 +282,7 @@ class ObjectStatsCollectorImpl {
ObjectStats::VirtualInstanceType type,
size_t size);
void RecordVirtualAllocationSiteDetails(AllocationSite* site);
void RecordVirtualFeedbackVectorDetails(FeedbackVector* site);
Heap* heap_;
ObjectStats* stats_;
......@@ -303,11 +304,22 @@ ObjectStatsCollectorImpl::ObjectStatsCollectorImpl(Heap* heap,
void ObjectStatsCollectorImpl::CollectVirtualStatistics(HeapObject* obj) {
if (obj->IsAllocationSite()) {
RecordVirtualAllocationSiteDetails(AllocationSite::cast(obj));
} else if (obj->IsFeedbackVector()) {
RecordVirtualFeedbackVectorDetails(FeedbackVector::cast(obj));
}
}
void ObjectStatsCollectorImpl::RecordVirtualObjectStats(
HeapObject* obj, ObjectStats::VirtualInstanceType type, size_t size) {
#if DEBUG
if (virtual_objects_.find(obj) != virtual_objects_.end()) {
std::stringstream description;
obj->Print(description);
V8_Fatal(__FILE__, __LINE__,
"Object with virtual instance type has been recorded before:\n%s",
description.str().c_str());
}
#endif
virtual_objects_.insert(obj);
stats_->RecordVirtualObjectStats(type, size);
}
......@@ -348,6 +360,20 @@ void ObjectStatsCollectorImpl::RecordVirtualAllocationSiteDetails(
}
}
void ObjectStatsCollectorImpl::RecordVirtualFeedbackVectorDetails(
FeedbackVector* vector) {
// Except for allocation
for (int i = 0; i < vector->length(); i++) {
Object* raw_object = vector->get(i);
if (!raw_object->IsHeapObject()) continue;
HeapObject* object = HeapObject::cast(raw_object);
if (object->IsCell() || object->IsFixedArray()) {
RecordVirtualObjectStats(object, ObjectStats::FEEDBACK_VECTOR_ENTRY_TYPE,
object->Size());
}
}
}
void ObjectStatsCollectorImpl::CollectStatistics(HeapObject* obj) {
Map* map = obj->map();
......@@ -438,8 +464,9 @@ void ObjectStatsCollectorImpl::CollectGlobalStatistics() {
void ObjectStatsCollectorImpl::RecordObjectStats(HeapObject* obj,
InstanceType type,
size_t size) {
if (virtual_objects_.find(obj) == virtual_objects_.end())
if (virtual_objects_.find(obj) == virtual_objects_.end()) {
stats_->RecordObjectStats(type, size);
}
}
static bool CanRecordFixedArray(Heap* heap, FixedArrayBase* array) {
......
......@@ -23,6 +23,7 @@
V(BOILERPLATE_ELEMENTS_TYPE) \
V(BOILERPLATE_NAME_DICTIONARY_TYPE) \
V(BOILERPLATE_PROPERTY_ARRAY_TYPE) \
V(FEEDBACK_VECTOR_ENTRY_TYPE) \
V(JS_ARRAY_BOILERPLATE_TYPE) \
V(JS_OBJECT_BOILERPLATE_TYPE)
......
......@@ -119,7 +119,7 @@ const CATEGORIES = new Map([
'PROTOTYPE_INFO_TYPE',
'STACK_FRAME_INFO_TYPE',
'TRANSITION_ARRAY_TYPE',
'WEAK_CELL_TYPE',
'WEAK_CELL_TYPE'
])
],
[
......@@ -141,6 +141,7 @@ const CATEGORIES = new Map([
'*FIXED_ARRAY_SHARED_FUNCTION_INFOS_SUB_TYPE',
'BYTECODE_ARRAY_TYPE',
'CODE_DATA_CONTAINER_TYPE',
'FEEDBACK_VECTOR_ENTRY_TYPE',
'FEEDBACK_VECTOR_TYPE',
'LOAD_HANDLER_TYPE',
'SCRIPT_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