profiler: Provide raw heap snapshots
Omit user roots when raw heap snapshots are used, i.e., when the gn flag v8_enable_raw_heap_snapshots is enabled. For regular Chrome production builds this is not the case. Blink CL: https://crrev.com/c/1529096 Bug: chromium:936797 Change-Id: I5ae0ec1ecfab9a76352d8ce927d1c40e707262cc Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1528994 Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Alexei Filippov <alph@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Cr-Commit-Position: refs/heads/master@{#60351}
This commit is contained in:
parent
ffabcbe8c0
commit
73c62c845e
3
BUILD.gn
3
BUILD.gn
@ -345,6 +345,9 @@ config("features") {
|
|||||||
}
|
}
|
||||||
defines +=
|
defines +=
|
||||||
[ "V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=${v8_typed_array_max_size_in_heap}" ]
|
[ "V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=${v8_typed_array_max_size_in_heap}" ]
|
||||||
|
if (v8_enable_raw_heap_snapshots) {
|
||||||
|
defines += [ "V8_ENABLE_RAW_HEAP_SNAPSHOTS" ]
|
||||||
|
}
|
||||||
if (v8_enable_future) {
|
if (v8_enable_future) {
|
||||||
defines += [ "V8_ENABLE_FUTURE" ]
|
defines += [ "V8_ENABLE_FUTURE" ]
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,12 @@ declare_args() {
|
|||||||
# Support for backtrace_symbols on linux.
|
# Support for backtrace_symbols on linux.
|
||||||
v8_enable_backtrace = ""
|
v8_enable_backtrace = ""
|
||||||
|
|
||||||
# Enables full heap snapshots containing internals. Used for debugging memory
|
# Enables raw heap snapshots containing internals. Used for debugging memory
|
||||||
# on platform and embedder level.
|
# on platform and embedder level.
|
||||||
|
v8_enable_raw_heap_snapshots = false
|
||||||
|
|
||||||
|
# See v8_enable_raw_heap_snapshots.
|
||||||
|
# TODO(mlippautz): Remove after adjusting Blink embedder code.
|
||||||
v8_enable_full_heap_snapshots = false
|
v8_enable_full_heap_snapshots = false
|
||||||
|
|
||||||
# Enable the snapshot feature, for fast context creation.
|
# Enable the snapshot feature, for fast context creation.
|
||||||
|
@ -292,6 +292,12 @@ HARMONY_SHIPPING(FLAG_SHIPPING_FEATURES)
|
|||||||
DEFINE_BOOL(icu_timezone_data, true, "get information about timezones from ICU")
|
DEFINE_BOOL(icu_timezone_data, true, "get information about timezones from ICU")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef V8_ENABLE_RAW_HEAP_SNAPSHOTS
|
||||||
|
#define V8_ENABLE_RAW_HEAP_SNAPSHOTS_BOOL true
|
||||||
|
#else
|
||||||
|
#define V8_ENABLE_RAW_HEAP_SNAPSHOTS_BOOL false
|
||||||
|
#endif // V8_ENABLE_RAW_HEAP_SNAPSHOTS
|
||||||
|
|
||||||
#ifdef V8_LITE_MODE
|
#ifdef V8_LITE_MODE
|
||||||
#define V8_LITE_BOOL true
|
#define V8_LITE_BOOL true
|
||||||
#else
|
#else
|
||||||
@ -1536,6 +1542,9 @@ DEFINE_BOOL(unbox_double_fields, V8_DOUBLE_FIELDS_UNBOXING,
|
|||||||
"enable in-object double fields unboxing (64-bit only)")
|
"enable in-object double fields unboxing (64-bit only)")
|
||||||
DEFINE_IMPLICATION(unbox_double_fields, track_double_fields)
|
DEFINE_IMPLICATION(unbox_double_fields, track_double_fields)
|
||||||
|
|
||||||
|
DEFINE_BOOL(raw_heap_snapshots, V8_ENABLE_RAW_HEAP_SNAPSHOTS_BOOL,
|
||||||
|
"enable raw heap snapshots contain garbage collection internals")
|
||||||
|
|
||||||
DEFINE_BOOL(lite_mode, V8_LITE_BOOL,
|
DEFINE_BOOL(lite_mode, V8_LITE_BOOL,
|
||||||
"enables trade-off of performance for memory savings "
|
"enables trade-off of performance for memory savings "
|
||||||
"(Lite mode only)")
|
"(Lite mode only)")
|
||||||
|
@ -1681,6 +1681,10 @@ void V8HeapExplorer::SetGcSubrootReference(Root root, const char* description,
|
|||||||
edge_type, description, child_entry, names_);
|
edge_type, description, child_entry, names_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For full heap snapshots we do not emit user roots but rather rely on
|
||||||
|
// regular GC roots to retain objects.
|
||||||
|
if (FLAG_raw_heap_snapshots) return;
|
||||||
|
|
||||||
// Add a shortcut to JS global object reference at snapshot root.
|
// Add a shortcut to JS global object reference at snapshot root.
|
||||||
// That allows the user to easily find global objects. They are
|
// That allows the user to easily find global objects. They are
|
||||||
// also used as starting points in distance calculations.
|
// also used as starting points in distance calculations.
|
||||||
@ -1837,7 +1841,7 @@ const char* EmbedderGraphNodeName(StringsStorage* names,
|
|||||||
}
|
}
|
||||||
|
|
||||||
HeapEntry::Type EmbedderGraphNodeType(EmbedderGraphImpl::Node* node) {
|
HeapEntry::Type EmbedderGraphNodeType(EmbedderGraphImpl::Node* node) {
|
||||||
return HeapEntry::kNative;
|
return node->IsRootNode() ? HeapEntry::kSynthetic : HeapEntry::kNative;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merges the names of an embedder node and its wrapper node.
|
// Merges the names of an embedder node and its wrapper node.
|
||||||
|
@ -1672,11 +1672,11 @@ TEST(HeapSnapshotRetainedObjectInfo) {
|
|||||||
CHECK(ValidateSnapshot(snapshot));
|
CHECK(ValidateSnapshot(snapshot));
|
||||||
|
|
||||||
const v8::HeapGraphNode* native_group_aaa =
|
const v8::HeapGraphNode* native_group_aaa =
|
||||||
GetNode(snapshot->GetRoot(), v8::HeapGraphNode::kNative, "aaa-group");
|
GetNode(snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "aaa-group");
|
||||||
CHECK(native_group_aaa);
|
CHECK_NOT_NULL(native_group_aaa);
|
||||||
const v8::HeapGraphNode* native_group_ccc =
|
const v8::HeapGraphNode* native_group_ccc =
|
||||||
GetNode(snapshot->GetRoot(), v8::HeapGraphNode::kNative, "ccc-group");
|
GetNode(snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "ccc-group");
|
||||||
CHECK(native_group_ccc);
|
CHECK_NOT_NULL(native_group_ccc);
|
||||||
|
|
||||||
const v8::HeapGraphNode* n_AAA =
|
const v8::HeapGraphNode* n_AAA =
|
||||||
GetNode(native_group_aaa, v8::HeapGraphNode::kString, "AAA");
|
GetNode(native_group_aaa, v8::HeapGraphNode::kString, "AAA");
|
||||||
|
Loading…
Reference in New Issue
Block a user