Revision: 11430
Author:   [email protected]
Date:     Wed Apr 25 03:20:38 2012
Log: Add field names to Code, ConsString, and JSGlobalPropertyCell in heap snapshot.

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

Modified:
 /branches/bleeding_edge/src/profile-generator.cc
 /branches/bleeding_edge/src/profile-generator.h

=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Tue Apr 24 05:38:58 2012 +++ /branches/bleeding_edge/src/profile-generator.cc Wed Apr 25 03:20:38 2012
@@ -1978,24 +1978,28 @@

   bool extract_indexed_refs = true;
   if (obj->IsJSGlobalProxy()) {
-    ExtractJSGlobalProxy(JSGlobalProxy::cast(obj));
+    ExtractJSGlobalProxyReferences(JSGlobalProxy::cast(obj));
   } else if (obj->IsJSObject()) {
-    ExtractJSObject(entry, JSObject::cast(obj));
+    ExtractJSObjectReferences(entry, JSObject::cast(obj));
   } else if (obj->IsString()) {
-    ExtractString(entry, String::cast(obj));
+    ExtractStringReferences(entry, String::cast(obj));
     extract_indexed_refs = false;
   } else if (obj->IsContext()) {
-    ExtractContext(entry, Context::cast(obj));
+    ExtractContextReferences(entry, Context::cast(obj));
   } else if (obj->IsMap()) {
-    ExtractMap(entry, Map::cast(obj));
+    ExtractMapReferences(entry, Map::cast(obj));
   } else if (obj->IsSharedFunctionInfo()) {
-    ExtractSharedFunctionInfo(entry, SharedFunctionInfo::cast(obj));
+ ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj));
   } else if (obj->IsScript()) {
-    ExtractScript(entry, Script::cast(obj));
+    ExtractScriptReferences(entry, Script::cast(obj));
   } else if (obj->IsCodeCache()) {
-    ExtractCodeCache(entry, CodeCache::cast(obj));
+    ExtractCodeCacheReferences(entry, CodeCache::cast(obj));
   } else if (obj->IsCode()) {
-    ExtractCode(entry, Code::cast(obj));
+    ExtractCodeReferences(entry, Code::cast(obj));
+  } else if (obj->IsJSGlobalPropertyCell()) {
+    ExtractJSGlobalPropertyCellReferences(
+        entry, JSGlobalPropertyCell::cast(obj));
+    extract_indexed_refs = false;
   }
   if (extract_indexed_refs) {
SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset);
@@ -2005,7 +2009,7 @@
 }


-void V8HeapExplorer::ExtractJSGlobalProxy(JSGlobalProxy* proxy) {
+void V8HeapExplorer::ExtractJSGlobalProxyReferences(JSGlobalProxy* proxy) {
   // We need to reference JS global objects from snapshot's root.
   // We use JSGlobalProxy because this is what embedder (e.g. browser)
   // uses for the global object.
@@ -2021,7 +2025,8 @@
 }


-void V8HeapExplorer::ExtractJSObject(HeapEntry* entry, JSObject* js_obj) {
+void V8HeapExplorer::ExtractJSObjectReferences(
+    HeapEntry* entry, JSObject* js_obj) {
   HeapObject* obj = js_obj;
   ExtractClosureReferences(js_obj, entry);
   ExtractPropertyReferences(js_obj, entry);
@@ -2090,20 +2095,20 @@
 }


-void V8HeapExplorer::ExtractString(HeapEntry* entry, String* string) {
+void V8HeapExplorer::ExtractStringReferences(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());
   }
 }


-void V8HeapExplorer::ExtractContext(HeapEntry* entry, Context* context) {
+void V8HeapExplorer::ExtractContextReferences(
+    HeapEntry* entry, Context* context) {
 #define EXTRACT_CONTEXT_FIELD(index, type, name) \
SetInternalReference(context, entry, #name, context->get(Context::index), \
       FixedArray::OffsetOfElementAt(Context::index));
@@ -2129,7 +2134,7 @@
 }


-void V8HeapExplorer::ExtractMap(HeapEntry* entry, Map* map) {
+void V8HeapExplorer::ExtractMapReferences(HeapEntry* entry, Map* map) {
   SetInternalReference(map, entry,
"prototype", map->prototype(), Map::kPrototypeOffset);
   SetInternalReference(map, entry,
@@ -2151,7 +2156,7 @@
 }


-void V8HeapExplorer::ExtractSharedFunctionInfo(
+void V8HeapExplorer::ExtractSharedFunctionInfoReferences(
     HeapEntry* entry, SharedFunctionInfo* shared) {
   HeapObject* obj = shared;
   SetInternalReference(obj, entry,
@@ -2194,7 +2199,7 @@
 }


-void V8HeapExplorer::ExtractScript(HeapEntry* entry, Script* script) {
+void V8HeapExplorer::ExtractScriptReferences(HeapEntry* entry, Script* script) {
   HeapObject* obj = script;
   SetInternalReference(obj, entry,
                        "source", script->source(),
@@ -2215,7 +2220,8 @@
 }


-void V8HeapExplorer::ExtractCodeCache(HeapEntry* entry, CodeCache* code_cache) {
+void V8HeapExplorer::ExtractCodeCacheReferences(
+    HeapEntry* entry, CodeCache* code_cache) {
   TagObject(code_cache->default_cache(), "(default code cache)");
   SetInternalReference(code_cache, entry,
                        "default_cache", code_cache->default_cache(),
@@ -2227,9 +2233,30 @@
 }


-void V8HeapExplorer::ExtractCode(HeapEntry* entry, Code* code) {
-  TagObject(code->unchecked_relocation_info(), "(code relocation info)");
-  TagObject(code->unchecked_deoptimization_data(), "(code deopt data)");
+void V8HeapExplorer::ExtractCodeReferences(HeapEntry* entry, Code* code) {
+  TagObject(code->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->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::ExtractJSGlobalPropertyCellReferences(
+    HeapEntry* entry, JSGlobalPropertyCell* cell) {
+  SetInternalReference(cell, entry, "value", cell->value());
 }


=======================================
--- /branches/bleeding_edge/src/profile-generator.h     Tue Apr 24 05:38:58 2012
+++ /branches/bleeding_edge/src/profile-generator.h     Wed Apr 25 03:20:38 2012
@@ -977,15 +977,18 @@
   const char* GetSystemEntryName(HeapObject* object);

   void ExtractReferences(HeapObject* obj);
-  void ExtractJSGlobalProxy(JSGlobalProxy* proxy);
-  void ExtractJSObject(HeapEntry* entry, JSObject* js_obj);
-  void ExtractString(HeapEntry* entry, String* obj);
-  void ExtractContext(HeapEntry* entry, Context* context);
-  void ExtractMap(HeapEntry* entry, Map* map);
- void ExtractSharedFunctionInfo(HeapEntry* entry, SharedFunctionInfo* shared);
-  void ExtractScript(HeapEntry* entry, Script* script);
-  void ExtractCodeCache(HeapEntry* entry, CodeCache* code_cache);
-  void ExtractCode(HeapEntry* entry, Code* code);
+  void ExtractJSGlobalProxyReferences(JSGlobalProxy* proxy);
+  void ExtractJSObjectReferences(HeapEntry* entry, JSObject* js_obj);
+  void ExtractStringReferences(HeapEntry* entry, String* obj);
+  void ExtractContextReferences(HeapEntry* entry, Context* context);
+  void ExtractMapReferences(HeapEntry* entry, Map* map);
+  void ExtractSharedFunctionInfoReferences(HeapEntry* entry,
+                                           SharedFunctionInfo* shared);
+  void ExtractScriptReferences(HeapEntry* entry, Script* script);
+  void ExtractCodeCacheReferences(HeapEntry* entry, CodeCache* code_cache);
+  void ExtractCodeReferences(HeapEntry* entry, Code* code);
+  void ExtractJSGlobalPropertyCellReferences(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