Commit 0a920f60 authored by alph's avatar alph Committed by Commit bot

Add Map::weak_cell_cache internal link to heap snapshot.

Review-Url: https://codereview.chromium.org/2204893002
Cr-Commit-Position: refs/heads/master@{#38244}
parent 682c4e44
......@@ -1318,9 +1318,11 @@ void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) {
}
TagObject(map->dependent_code(), "(dependent code)");
MarkAsWeakContainer(map->dependent_code());
SetInternalReference(map, entry,
"dependent_code", map->dependent_code(),
SetInternalReference(map, entry, "dependent_code", map->dependent_code(),
Map::kDependentCodeOffset);
TagObject(map->weak_cell_cache(), "(weak cell)");
SetInternalReference(map, entry, "weak_cell_cache", map->weak_cell_cache(),
Map::kWeakCellCacheOffset);
}
......
......@@ -671,6 +671,29 @@ TEST(HeapSnapshotCollection) {
CHECK_EQ(s->GetId(), map_s->GetId());
}
TEST(HeapSnapshotMap) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
CompileRun(
"function Z() { this.foo = {}; }\n"
"z = new Z();\n");
const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* z =
GetProperty(global, v8::HeapGraphEdge::kProperty, "z");
CHECK(z);
const v8::HeapGraphNode* map =
GetProperty(z, v8::HeapGraphEdge::kInternal, "map");
CHECK(map);
CHECK(GetProperty(map, v8::HeapGraphEdge::kInternal, "map"));
CHECK(GetProperty(map, v8::HeapGraphEdge::kInternal, "prototype"));
CHECK(GetProperty(map, v8::HeapGraphEdge::kInternal, "back_pointer"));
CHECK(GetProperty(map, v8::HeapGraphEdge::kInternal, "descriptors"));
CHECK(GetProperty(map, v8::HeapGraphEdge::kInternal, "weak_cell_cache"));
}
TEST(HeapSnapshotInternalReferences) {
v8::Isolate* isolate = CcTest::isolate();
......
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