Commit 229a3e37 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[object-stats] Add capability of recording virtual instance types

Each of those types have to split off a single actual instance type.
There can be many that split off the same instance type.

Bug: v8:7266
Change-Id: Ic78b707e26e67bdd2072cd8a716c89eaae024e48
Reviewed-on: https://chromium-review.googlesource.com/860651Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50530}
parent 2de8b680
......@@ -1400,28 +1400,6 @@ class Counters : public std::enable_shared_from_this<Counters> {
STATS_COUNTER_TS_LIST(SC)
#undef SC
#define SC(name) \
StatsCounter* count_of_##name() { return &count_of_##name##_; } \
StatsCounter* size_of_##name() { return &size_of_##name##_; }
INSTANCE_TYPE_LIST(SC)
#undef SC
#define SC(name) \
StatsCounter* count_of_CODE_TYPE_##name() \
{ return &count_of_CODE_TYPE_##name##_; } \
StatsCounter* size_of_CODE_TYPE_##name() \
{ return &size_of_CODE_TYPE_##name##_; }
CODE_KIND_LIST(SC)
#undef SC
#define SC(name) \
StatsCounter* count_of_FIXED_ARRAY_##name() \
{ return &count_of_FIXED_ARRAY_##name##_; } \
StatsCounter* size_of_FIXED_ARRAY_##name() \
{ return &size_of_FIXED_ARRAY_##name##_; }
FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
#undef SC
// clang-format off
enum Id {
#define RATE_ID(name, caption, max, res) k_##name,
......
......@@ -85,24 +85,6 @@ void StatisticsExtension::GetCounters(
,
STATS_COUNTER_LIST_1(ADD_COUNTER) STATS_COUNTER_LIST_2(ADD_COUNTER)
#undef ADD_COUNTER
#define ADD_COUNTER(name) \
{ counters->count_of_##name(), "count_of_" #name } \
, {counters->size_of_##name(), "size_of_" #name},
INSTANCE_TYPE_LIST(ADD_COUNTER)
#undef ADD_COUNTER
#define ADD_COUNTER(name) \
{ counters->count_of_CODE_TYPE_##name(), "count_of_CODE_TYPE_" #name } \
, {counters->size_of_CODE_TYPE_##name(), "size_of_CODE_TYPE_" #name},
CODE_KIND_LIST(ADD_COUNTER)
#undef ADD_COUNTER
#define ADD_COUNTER(name) \
{ counters->count_of_FIXED_ARRAY_##name(), "count_of_FIXED_ARRAY_" #name } \
, {counters->size_of_FIXED_ARRAY_##name(), "size_of_FIXED_ARRAY_" #name},
FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADD_COUNTER)
#undef ADD_COUNTER
}; // End counter_list array.
......
This diff is collapsed.
......@@ -13,6 +13,16 @@
#include "src/heap/objects-visiting.h"
#include "src/objects.h"
// These instance types do not exist for actual use but are merely introduced
// for object stats tracing. In contrast to Code and FixedArray sub types
// these types are not known to other counters outside of object stats
// tracing.
//
// Update LAST_VIRTUAL_TYPE below when changing this macro.
#define VIRTUAL_INSTANCE_TYPE_LIST(V) \
V(JS_ARRAY_BOILERPLATE_TYPE) \
V(JS_OBJECT_BOILERPLATE_TYPE)
namespace v8 {
namespace internal {
......@@ -20,6 +30,14 @@ class ObjectStats {
public:
explicit ObjectStats(Heap* heap) : heap_(heap) { ClearObjectStats(); }
// See description on VIRTUAL_INSTANCE_TYPE_LIST.
enum VirtualInstanceType {
#define DEFINE_VIRTUAL_INSTANCE_TYPE(type) type,
VIRTUAL_INSTANCE_TYPE_LIST(DEFINE_VIRTUAL_INSTANCE_TYPE)
#undef DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE
LAST_VIRTUAL_TYPE = JS_OBJECT_BOILERPLATE_TYPE,
};
// ObjectStats are kept in two arrays, counts and sizes. Related stats are
// stored in a contiguous linear buffer. Stats groups are stored one after
// another.
......@@ -27,17 +45,19 @@ class ObjectStats {
FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1,
FIRST_FIXED_ARRAY_SUB_TYPE =
FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS,
OBJECT_STATS_COUNT =
FIRST_VIRTUAL_TYPE =
FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1,
OBJECT_STATS_COUNT = FIRST_VIRTUAL_TYPE + LAST_VIRTUAL_TYPE + 1,
};
void ClearObjectStats(bool clear_last_time_stats = false);
void CheckpointObjectStats();
void PrintJSON(const char* key);
void Dump(std::stringstream& stream);
void CheckpointObjectStats();
void RecordObjectStats(InstanceType type, size_t size);
void RecordVirtualObjectStats(VirtualInstanceType type, size_t size);
void RecordCodeSubTypeStats(int code_sub_type, size_t size);
bool RecordFixedArraySubTypeStats(FixedArrayBase* array, int array_sub_type,
size_t size, size_t over_allocated);
......
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