Reviewers: Mikhail Naganov (Chromium), Yury Semikhatsky, loislo,

Description:
Add field names to Code, ConsString, and JSGlobalPropertyCell in heap snapshot.


Please review this at https://chromiumcodereview.appspot.com/10217001/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/profile-generator.h
  M src/profile-generator.cc


Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 5d03fe6461f722c6139ba3c1bbda04de4219d928..195c8ea94cc186a13b969441238462ff3d38cb25 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -1996,6 +1996,9 @@ void V8HeapExplorer::ExtractReferences(HeapObject* obj) {
     ExtractCodeCache(entry, CodeCache::cast(obj));
   } else if (obj->IsCode()) {
     ExtractCode(entry, Code::cast(obj));
+  } else if (obj->IsJSGlobalPropertyCell()) {
+    ExtractJSGlobalPropertyCell(entry, JSGlobalPropertyCell::cast(obj));
+    extract_indexed_refs = false;
   }
   if (extract_indexed_refs) {
SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); @@ -2093,10 +2096,9 @@ void V8HeapExplorer::ExtractJSObject(HeapEntry* entry, JSObject* js_obj) {
 void V8HeapExplorer::ExtractString(HeapEntry* entry, String* string) {
   if (string->IsConsString()) {
     ConsString* cs = ConsString::cast(string);
-    SetInternalReference(cs, entry, 1, cs->first());
-    SetInternalReference(cs, entry, 2, cs->second());
-  }
-  if (string->IsSlicedString()) {
+    SetInternalReference(cs, entry, "first", cs->first());
+    SetInternalReference(cs, entry, "second", cs->second());
+  } else if (string->IsSlicedString()) {
     SlicedString* ss = SlicedString::cast(string);
     SetInternalReference(ss, entry, "parent", ss->parent());
   }
@@ -2229,7 +2231,28 @@ void V8HeapExplorer::ExtractCodeCache(HeapEntry* entry, CodeCache* code_cache) {

 void V8HeapExplorer::ExtractCode(HeapEntry* entry, Code* code) {
   TagObject(code->unchecked_relocation_info(), "(code relocation info)");
+  SetInternalReference(code, entry,
+                       "relocation_info", code->relocation_info(),
+                       Code::kRelocationInfoOffset);
+  SetInternalReference(code, entry,
+                       "handler_table", code->handler_table(),
+                       Code::kHandlerTableOffset);
   TagObject(code->unchecked_deoptimization_data(), "(code deopt data)");
+  SetInternalReference(code, entry,
+                       "deoptimization_data", code->deoptimization_data(),
+                       Code::kDeoptimizationDataOffset);
+  SetInternalReference(code, entry,
+                       "type_feedback_info", code->type_feedback_info(),
+                       Code::kTypeFeedbackInfoOffset);
+  SetInternalReference(code, entry,
+                       "gc_metadata", code->gc_metadata(),
+                       Code::kGCMetadataOffset);
+}
+
+
+void V8HeapExplorer::ExtractJSGlobalPropertyCell(HeapEntry* entry,
+    JSGlobalPropertyCell* cell) {
+  SetInternalReference(cell, entry, "value", cell->value());
 }


Index: src/profile-generator.h
diff --git a/src/profile-generator.h b/src/profile-generator.h
index 1468777fc77d7684e1b0b4c4d65dbe898e53b980..0f8481f9946fa47f1f980c8b75c4936765104bd1 100644
--- a/src/profile-generator.h
+++ b/src/profile-generator.h
@@ -986,6 +986,8 @@ class V8HeapExplorer : public HeapEntriesAllocator {
   void ExtractScript(HeapEntry* entry, Script* script);
   void ExtractCodeCache(HeapEntry* entry, CodeCache* code_cache);
   void ExtractCode(HeapEntry* entry, Code* code);
+  void ExtractJSGlobalPropertyCell(HeapEntry* entry,
+                                   JSGlobalPropertyCell* cell);
   void ExtractClosureReferences(JSObject* js_obj, HeapEntry* entry);
   void ExtractPropertyReferences(JSObject* js_obj, HeapEntry* entry);
   void ExtractElementReferences(JSObject* js_obj, HeapEntry* entry);


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

Reply via email to