Don't treat ScopeInfos as arrays in heap snapshot

This is a partial reland of https://crrev.com/c/v8/v8/+/2601880 .

I think it makes more sense to list ScopeInfos under "(system)" in the
dev tools, like most other V8 internal types.

Change-Id: If85f869e805d7c374fc7584a79155bb4f400e4b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2707249
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#73015}
This commit is contained in:
Seth Brenith 2021-02-19 09:09:34 -08:00 committed by Commit Bot
parent f6952513ba
commit bac84a5324
2 changed files with 6 additions and 4 deletions

View File

@ -635,7 +635,7 @@ HeapEntry* V8HeapExplorer::AddEntry(HeapObject object) {
} else if (object.IsContext()) {
return AddEntry(object, HeapEntry::kObject, "system / Context");
} else if (object.IsFixedArray() || object.IsFixedDoubleArray() ||
object.IsByteArray() || object.IsScopeInfo()) {
object.IsByteArray()) {
return AddEntry(object, HeapEntry::kArray, "");
} else if (object.IsHeapNumber()) {
return AddEntry(object, HeapEntry::kHeapNumber, "number");

View File

@ -459,12 +459,13 @@ TEST(HeapSnapshotCodeObjects) {
// Verify that non-compiled function doesn't contain references to "x"
// literal, while compiled function does. The scope info is stored in
// FixedArray objects attached to the SharedFunctionInfo.
// ScopeInfo objects attached to the SharedFunctionInfo.
bool compiled_references_x = false, lazy_references_x = false;
for (int i = 0, count = compiled_sfi->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = compiled_sfi->GetChild(i);
const v8::HeapGraphNode* node = prop->GetToNode();
if (node->GetType() == v8::HeapGraphNode::kArray) {
if (node->GetType() == v8::HeapGraphNode::kHidden &&
!strcmp("system / ScopeInfo", GetName(node))) {
if (HasString(env->GetIsolate(), node, "x")) {
compiled_references_x = true;
break;
@ -474,7 +475,8 @@ TEST(HeapSnapshotCodeObjects) {
for (int i = 0, count = lazy_sfi->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = lazy_sfi->GetChild(i);
const v8::HeapGraphNode* node = prop->GetToNode();
if (node->GetType() == v8::HeapGraphNode::kArray) {
if (node->GetType() == v8::HeapGraphNode::kHidden &&
!strcmp("system / ScopeInfo", GetName(node))) {
if (HasString(env->GetIsolate(), node, "x")) {
lazy_references_x = true;
break;