Revision: 12973
Author: [email protected]
Date: Thu Nov 15 05:35:05 2012
Log: Heap explorer: Show representation of strings.
* src/profile-generator.cc (V8HeapExplorer::GetSystemEntryName): For
maps of strings, return a name that encodes the representation
strategy used for the strings.
(V8HeapExplorer::ExtractReferences): For strings, visit the maps as
well, so that the user can see what representation is used for their
strings.
See http://wingolog.org/pub/string-representations.png for an example of
what it looks like.
BUG=
Review URL: https://chromiumcodereview.appspot.com/11344021
Patch from Andy Wingo <[email protected]>.
http://code.google.com/p/v8/source/detail?r=12973
Modified:
/branches/bleeding_edge/src/profile-generator.cc
=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Wed Nov 14 07:59:45
2012
+++ /branches/bleeding_edge/src/profile-generator.cc Thu Nov 15 05:35:05
2012
@@ -1774,7 +1774,14 @@
const char* V8HeapExplorer::GetSystemEntryName(HeapObject* object) {
switch (object->map()->instance_type()) {
- case MAP_TYPE: return "system / Map";
+ case MAP_TYPE:
+ switch (Map::cast(object)->instance_type()) {
+#define MAKE_STRING_MAP_CASE(instance_type, size, name, Name) \
+ case instance_type: return "system / Map (" #Name ")";
+ STRING_TYPE_LIST(MAKE_STRING_MAP_CASE)
+#undef MAKE_STRING_MAP_CASE
+ default: return "system / Map";
+ }
case JS_GLOBAL_PROPERTY_CELL_TYPE: return "system /
JSGlobalPropertyCell";
case FOREIGN_TYPE: return "system / Foreign";
case ODDBALL_TYPE: return "system / Oddball";
@@ -1851,7 +1858,6 @@
ExtractJSObjectReferences(entry, JSObject::cast(obj));
} else if (obj->IsString()) {
ExtractStringReferences(entry, String::cast(obj));
- extract_indexed_refs = false;
} else if (obj->IsContext()) {
ExtractContextReferences(entry, Context::cast(obj));
} else if (obj->IsMap()) {
@@ -1966,11 +1972,14 @@
void V8HeapExplorer::ExtractStringReferences(int entry, String* string) {
if (string->IsConsString()) {
ConsString* cs = ConsString::cast(string);
- SetInternalReference(cs, entry, "first", cs->first());
- SetInternalReference(cs, entry, "second", cs->second());
+ SetInternalReference(cs, entry, "first", cs->first(),
+ ConsString::kFirstOffset);
+ SetInternalReference(cs, entry, "second", cs->second(),
+ ConsString::kSecondOffset);
} else if (string->IsSlicedString()) {
SlicedString* ss = SlicedString::cast(string);
- SetInternalReference(ss, entry, "parent", ss->parent());
+ SetInternalReference(ss, entry, "parent", ss->parent(),
+ SlicedString::kParentOffset);
}
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev