Heap explorer: Show representation of strings. (issue 11344021)

10 views
Skip to first unread message

verw...@chromium.org

unread,
Oct 30, 2012, 10:03:33 AM10/30/12
to wi...@igalia.com, yu...@chromium.org, v8-...@googlegroups.com
lgtm with comment


https://chromiumcodereview.appspot.com/11344021/diff/1/src/profile-generator.cc
File src/profile-generator.cc (right):

https://chromiumcodereview.appspot.com/11344021/diff/1/src/profile-generator.cc#newcode1861
src/profile-generator.cc:1861: SetInternalReference(obj, entry, "map",
obj->map(), HeapObject::kMapOffset);
This seems to be unnecessary given that the same function is called in
if(extract_indexed_refs) below.

https://chromiumcodereview.appspot.com/11344021/

yan...@chromium.org

unread,
Oct 30, 2012, 10:39:39 AM10/30/12
to wi...@igalia.com, verw...@chromium.org, yu...@chromium.org, v8-...@googlegroups.com
drive-by comment.
https://chromiumcodereview.appspot.com/11344021/diff/1/src/profile-generator.cc#newcode1980
src/profile-generator.cc:1980: SetInternalReference(ss, entry, "parent",
ss->parent(), SlicedString::kParentOffset);
Please keep the 80-char limit.

https://chromiumcodereview.appspot.com/11344021/

wi...@igalia.com

unread,
Oct 31, 2012, 6:41:13 AM10/31/12
to verw...@chromium.org, yu...@chromium.org, yan...@chromium.org, v8-...@googlegroups.com
Reviewers: Toon Verwaest, Yury Semikhatsky, Yang,

Message:
On 2012/10/30 14:03:33, Toon Verwaest wrote:
> This seems to be unnecessary given that the same function is called in
> if(extract_indexed_refs) below.

Indeed, fixed. Fixed the 80-char limit as well.

Description:
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=


Please review this at https://codereview.chromium.org/11344021/

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

Affected files:
M src/profile-generator.cc


Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index
b853f33cb19aa2a15405cbdca4f76fdf3d25382b..c57ec3506665c6d8d0766379309c659f133f5dab
100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -1774,7 +1774,14 @@ void
V8HeapExplorer::AddRootEntries(SnapshotFillerInterface* filler) {

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 @@ void V8HeapExplorer::ExtractReferences(HeapObject*
obj) {
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::ExtractJSObjectReferences(
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);
}
}



Reply all
Reply to author
Forward
0 new messages