Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: src/profile-generator.cc

Issue 11344021: Heap explorer: Show representation of strings. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updated patch Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 void V8HeapExplorer::AddRootEntries(SnapshotFillerInterface* filler) { 1767 void V8HeapExplorer::AddRootEntries(SnapshotFillerInterface* filler) {
1768 filler->AddEntry(kInternalRootObject, this); 1768 filler->AddEntry(kInternalRootObject, this);
1769 filler->AddEntry(kGcRootsObject, this); 1769 filler->AddEntry(kGcRootsObject, this);
1770 GcSubrootsEnumerator enumerator(filler, this); 1770 GcSubrootsEnumerator enumerator(filler, this);
1771 heap_->IterateRoots(&enumerator, VISIT_ALL); 1771 heap_->IterateRoots(&enumerator, VISIT_ALL);
1772 } 1772 }
1773 1773
1774 1774
1775 const char* V8HeapExplorer::GetSystemEntryName(HeapObject* object) { 1775 const char* V8HeapExplorer::GetSystemEntryName(HeapObject* object) {
1776 switch (object->map()->instance_type()) { 1776 switch (object->map()->instance_type()) {
1777 case MAP_TYPE: return "system / Map"; 1777 case MAP_TYPE:
1778 switch (Map::cast(object)->instance_type()) {
1779 #define MAKE_STRING_MAP_CASE(instance_type, size, name, Name) \
1780 case instance_type: return "system / Map (" #Name ")";
1781 STRING_TYPE_LIST(MAKE_STRING_MAP_CASE)
1782 #undef MAKE_STRING_MAP_CASE
1783 default: return "system / Map";
1784 }
1778 case JS_GLOBAL_PROPERTY_CELL_TYPE: return "system / JSGlobalPropertyCell"; 1785 case JS_GLOBAL_PROPERTY_CELL_TYPE: return "system / JSGlobalPropertyCell";
1779 case FOREIGN_TYPE: return "system / Foreign"; 1786 case FOREIGN_TYPE: return "system / Foreign";
1780 case ODDBALL_TYPE: return "system / Oddball"; 1787 case ODDBALL_TYPE: return "system / Oddball";
1781 #define MAKE_STRUCT_CASE(NAME, Name, name) \ 1788 #define MAKE_STRUCT_CASE(NAME, Name, name) \
1782 case NAME##_TYPE: return "system / "#Name; 1789 case NAME##_TYPE: return "system / "#Name;
1783 STRUCT_LIST(MAKE_STRUCT_CASE) 1790 STRUCT_LIST(MAKE_STRUCT_CASE)
1784 #undef MAKE_STRUCT_CASE 1791 #undef MAKE_STRUCT_CASE
1785 default: return "system"; 1792 default: return "system";
1786 } 1793 }
1787 } 1794 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 if (heap_entry == NULL) return; // No interest in this object. 1851 if (heap_entry == NULL) return; // No interest in this object.
1845 int entry = heap_entry->index(); 1852 int entry = heap_entry->index();
1846 1853
1847 bool extract_indexed_refs = true; 1854 bool extract_indexed_refs = true;
1848 if (obj->IsJSGlobalProxy()) { 1855 if (obj->IsJSGlobalProxy()) {
1849 ExtractJSGlobalProxyReferences(JSGlobalProxy::cast(obj)); 1856 ExtractJSGlobalProxyReferences(JSGlobalProxy::cast(obj));
1850 } else if (obj->IsJSObject()) { 1857 } else if (obj->IsJSObject()) {
1851 ExtractJSObjectReferences(entry, JSObject::cast(obj)); 1858 ExtractJSObjectReferences(entry, JSObject::cast(obj));
1852 } else if (obj->IsString()) { 1859 } else if (obj->IsString()) {
1853 ExtractStringReferences(entry, String::cast(obj)); 1860 ExtractStringReferences(entry, String::cast(obj));
1854 extract_indexed_refs = false;
1855 } else if (obj->IsContext()) { 1861 } else if (obj->IsContext()) {
1856 ExtractContextReferences(entry, Context::cast(obj)); 1862 ExtractContextReferences(entry, Context::cast(obj));
1857 } else if (obj->IsMap()) { 1863 } else if (obj->IsMap()) {
1858 ExtractMapReferences(entry, Map::cast(obj)); 1864 ExtractMapReferences(entry, Map::cast(obj));
1859 } else if (obj->IsSharedFunctionInfo()) { 1865 } else if (obj->IsSharedFunctionInfo()) {
1860 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); 1866 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj));
1861 } else if (obj->IsScript()) { 1867 } else if (obj->IsScript()) {
1862 ExtractScriptReferences(entry, Script::cast(obj)); 1868 ExtractScriptReferences(entry, Script::cast(obj));
1863 } else if (obj->IsCodeCache()) { 1869 } else if (obj->IsCodeCache()) {
1864 ExtractCodeCacheReferences(entry, CodeCache::cast(obj)); 1870 ExtractCodeCacheReferences(entry, CodeCache::cast(obj));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 TagObject(js_obj->elements(), "(object elements)"); 1965 TagObject(js_obj->elements(), "(object elements)");
1960 SetInternalReference(obj, entry, 1966 SetInternalReference(obj, entry,
1961 "elements", js_obj->elements(), 1967 "elements", js_obj->elements(),
1962 JSObject::kElementsOffset); 1968 JSObject::kElementsOffset);
1963 } 1969 }
1964 1970
1965 1971
1966 void V8HeapExplorer::ExtractStringReferences(int entry, String* string) { 1972 void V8HeapExplorer::ExtractStringReferences(int entry, String* string) {
1967 if (string->IsConsString()) { 1973 if (string->IsConsString()) {
1968 ConsString* cs = ConsString::cast(string); 1974 ConsString* cs = ConsString::cast(string);
1969 SetInternalReference(cs, entry, "first", cs->first()); 1975 SetInternalReference(cs, entry, "first", cs->first(),
1970 SetInternalReference(cs, entry, "second", cs->second()); 1976 ConsString::kFirstOffset);
1977 SetInternalReference(cs, entry, "second", cs->second(),
1978 ConsString::kSecondOffset);
1971 } else if (string->IsSlicedString()) { 1979 } else if (string->IsSlicedString()) {
1972 SlicedString* ss = SlicedString::cast(string); 1980 SlicedString* ss = SlicedString::cast(string);
1973 SetInternalReference(ss, entry, "parent", ss->parent()); 1981 SetInternalReference(ss, entry, "parent", ss->parent(),
1982 SlicedString::kParentOffset);
1974 } 1983 }
1975 } 1984 }
1976 1985
1977 1986
1978 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { 1987 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) {
1979 #define EXTRACT_CONTEXT_FIELD(index, type, name) \ 1988 #define EXTRACT_CONTEXT_FIELD(index, type, name) \
1980 SetInternalReference(context, entry, #name, context->get(Context::index), \ 1989 SetInternalReference(context, entry, #name, context->get(Context::index), \
1981 FixedArray::OffsetOfElementAt(Context::index)); 1990 FixedArray::OffsetOfElementAt(Context::index));
1982 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure); 1991 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure);
1983 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous); 1992 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous);
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
3579 3588
3580 3589
3581 void HeapSnapshotJSONSerializer::SortHashMap( 3590 void HeapSnapshotJSONSerializer::SortHashMap(
3582 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3591 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3583 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3592 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3584 sorted_entries->Add(p); 3593 sorted_entries->Add(p);
3585 sorted_entries->Sort(SortUsingEntryValue); 3594 sorted_entries->Sort(SortUsingEntryValue);
3586 } 3595 }
3587 3596
3588 } } // namespace v8::internal 3597 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698