Revision: 12321
Author:   [email protected]
Date:     Thu Aug 16 07:25:55 2012
Log: Show map -> transition array -> descriptor array to the heap profiler.

BUG=chromium:142625

Review URL: https://chromiumcodereview.appspot.com/10830309
http://code.google.com/p/v8/source/detail?r=12321

Modified:
 /branches/bleeding_edge/src/profile-generator.cc
 /branches/bleeding_edge/test/cctest/test-heap-profiler.cc

=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Mon Aug 13 01:43:16 2012 +++ /branches/bleeding_edge/src/profile-generator.cc Thu Aug 16 07:25:55 2012
@@ -2007,11 +2007,21 @@
   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,
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Mon Jul 30 06:09:09 2012 +++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Thu Aug 16 07:25:55 2012
@@ -1658,3 +1658,25 @@
       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);
+}

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to