Commit 64bf1c4f authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[object-stats] Record SFI list on Script

Tbr: ulan@chromium.org
Bug: v8:7266
Change-Id: I3bafffafc662856295fa34de2c77e876e3b2a58e
Reviewed-on: https://chromium-review.googlesource.com/881172Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50819}
parent d5dca89b
......@@ -247,6 +247,7 @@ class ObjectStatsCollectorImpl {
void RecordVirtualJSCollectionDetails(JSObject* object);
void RecordVirtualJSObjectDetails(JSObject* object);
void RecordVirtualMapDetails(Map* map);
void RecordVirtualScriptDetails(Script* script);
void RecordVirtualSharedFunctionInfoDetails(SharedFunctionInfo* info);
Heap* heap_;
......@@ -362,8 +363,7 @@ void ObjectStatsCollectorImpl::RecordVirtualJSObjectDetails(JSObject* object) {
// Properties.
if (object->HasFastProperties()) {
PropertyArray* properties = object->property_array();
RecordSimpleVirtualObjectStats(object, properties,
ObjectStats::OBJECT_PROPERTY_ARRAY_TYPE);
CHECK_EQ(PROPERTY_ARRAY_TYPE, properties->map()->instance_type());
} else {
NameDictionary* properties = object->property_dictionary();
RecordHashTableVirtualObjectStats(
......@@ -428,6 +428,8 @@ void ObjectStatsCollectorImpl::CollectStatistics(HeapObject* obj, Phase phase) {
RecordVirtualSharedFunctionInfoDetails(SharedFunctionInfo::cast(obj));
} else if (obj->IsContext()) {
RecordVirtualContext(Context::cast(obj));
} else if (obj->IsScript()) {
RecordVirtualScriptDetails(Script::cast(obj));
} else if (obj->IsFixedArray()) {
// Has to go last as it triggers too eagerly.
RecordVirtualFixedArrayDetails(FixedArray::cast(obj));
......@@ -535,6 +537,21 @@ void ObjectStatsCollectorImpl::RecordVirtualMapDetails(Map* map) {
}
}
void ObjectStatsCollectorImpl::RecordVirtualScriptDetails(Script* script) {
FixedArray* infos = script->shared_function_infos();
RecordSimpleVirtualObjectStats(
script, script->shared_function_infos(),
ObjectStats::SCRIPT_SHARED_FUNCTION_INFOS_TYPE);
// Split off weak cells from the regular weak cell type.
for (int i = 0; i < infos->length(); i++) {
if (infos->get(i)->IsWeakCell()) {
RecordSimpleVirtualObjectStats(
infos, WeakCell::cast(infos->get(i)),
ObjectStats::SCRIPT_SHARED_FUNCTION_INFOS_TYPE);
}
}
}
void ObjectStatsCollectorImpl::RecordVirtualSharedFunctionInfoDetails(
SharedFunctionInfo* info) {
// SharedFunctonInfo::feedback_metadata() is a COW array.
......@@ -544,14 +561,12 @@ void ObjectStatsCollectorImpl::RecordVirtualSharedFunctionInfoDetails(
void ObjectStatsCollectorImpl::RecordVirtualBytecodeArrayDetails(
BytecodeArray* bytecode) {
RecordVirtualObjectStats(bytecode, bytecode->constant_pool(),
ObjectStats::BYTECODE_ARRAY_CONSTANT_POOL_TYPE,
bytecode->constant_pool()->Size(),
ObjectStats::kNoOverAllocation);
RecordVirtualObjectStats(bytecode, bytecode->handler_table(),
ObjectStats::BYTECODE_ARRAY_HANDLER_TABLE_TYPE,
bytecode->constant_pool()->Size(),
ObjectStats::kNoOverAllocation);
RecordSimpleVirtualObjectStats(
bytecode, bytecode->constant_pool(),
ObjectStats::BYTECODE_ARRAY_CONSTANT_POOL_TYPE);
RecordSimpleVirtualObjectStats(
bytecode, bytecode->handler_table(),
ObjectStats::BYTECODE_ARRAY_HANDLER_TABLE_TYPE);
}
namespace {
......
......@@ -41,7 +41,6 @@
V(NATIVE_CONTEXT_TYPE) \
V(NOSCRIPT_SHARED_FUNCTION_INFOS_TYPE) \
V(NUMBER_STRING_CACHE_TYPE) \
V(OBJECT_PROPERTY_ARRAY_TYPE) \
V(OBJECT_PROPERTY_DICTIONARY_TYPE) \
V(OBJECT_TO_CODE_TYPE) \
V(OTHER_CONTEXT_TYPE) \
......@@ -50,6 +49,7 @@
V(RETAINED_MAPS_TYPE) \
V(SCOPE_INFO_TYPE) \
V(SCRIPT_LIST_TYPE) \
V(SCRIPT_SHARED_FUNCTION_INFOS_TYPE) \
V(SERIALIZED_OBJECTS_TYPE) \
V(SINGLE_CHARACTER_STRING_CACHE_TYPE) \
V(STRING_SPLIT_CACHE_TYPE) \
......
......@@ -63,8 +63,8 @@ const CATEGORIES = new Map([
'NATIVE_CONTEXT_TYPE',
'ONE_BYTE_INTERNALIZED_STRING_TYPE',
'ONE_BYTE_STRING_TYPE',
'OBJECT_PROPERTY_ARRAY_TYPE',
'OBJECT_PROPERTY_DICTIONARY_TYPE',
'PROPERTY_ARRAY_TYPE',
'SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE',
'SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE',
'SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE',
......@@ -114,6 +114,7 @@ const CATEGORIES = new Map([
'RETAINED_MAPS_TYPE',
'SCOPE_INFO_TYPE',
'SCRIPT_LIST_TYPE',
'SCRIPT_SHARED_FUNCTION_INFOS_TYPE',
'SERIALIZED_OBJECTS_TYPE',
'SINGLE_CHARACTER_STRING_CACHE_TYPE',
'STACK_FRAME_INFO_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