Commit 61d11f99 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Show map -> transition array -> descriptor array to the heap profiler.

BUG=chromium:142625

Review URL: https://chromiumcodereview.appspot.com/10830309

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12321 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5a3ec853
......@@ -2007,11 +2007,21 @@ void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) {
SetInternalReference(map, entry,
"constructor", map->constructor(),
Map::kConstructorOffset);
if (!map->instance_descriptors()->IsEmpty()) {
TagObject(map->instance_descriptors(), "(map descriptors)");
// TODO(verwaest): Check what to do here.
if (map->HasTransitionArray()) {
TransitionArray* transitions = map->transitions();
if (!transitions->descriptors()->IsEmpty()) {
DescriptorArray* descriptors = transitions->descriptors();
TagObject(descriptors, "(map descriptors)");
SetInternalReference(transitions, entry,
"descriptors", descriptors,
TransitionArray::kDescriptorsOffset);
IndexedReferencesExtractor refs_extractor(
this, transitions, entry);
transitions->Iterate(&refs_extractor);
}
TagObject(transitions, "(transition array)");
SetInternalReference(map, entry,
"descriptors", map->instance_descriptors(),
"transitions", transitions,
Map::kTransitionsOrBackPointerOffset);
}
SetInternalReference(map, entry,
......
......@@ -1658,3 +1658,25 @@ TEST(NoRefsToNonEssentialEntries) {
GetProperty(global_object, v8::HeapGraphEdge::kInternal, "elements");
CHECK_EQ(NULL, elements);
}
TEST(MapHasDescriptorsAndTransitions) {
v8::HandleScope scope;
LocalContext env;
CompileRun("obj = { a: 10 };\n");
const v8::HeapSnapshot* snapshot =
v8::HeapProfiler::TakeSnapshot(v8_str("snapshot"));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* global_object =
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj");
CHECK_NE(NULL, global_object);
const v8::HeapGraphNode* map =
GetProperty(global_object, v8::HeapGraphEdge::kInternal, "map");
CHECK_NE(NULL, map);
const v8::HeapGraphNode* descriptors =
GetProperty(map, v8::HeapGraphEdge::kInternal, "descriptors");
CHECK_NE(NULL, descriptors);
const v8::HeapGraphNode* transitions =
GetProperty(map, v8::HeapGraphEdge::kInternal, "transitions");
CHECK_NE(NULL, transitions);
}
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