Chromium Code Reviews
Help | Chromium Project | Sign in
(41)

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: Created 1 year, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
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; 1861 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset);
Toon Verwaest 2012/10/30 14:03:34 This seems to be unnecessary given that the same f
1855 } else if (obj->IsContext()) { 1862 } else if (obj->IsContext()) {
1856 ExtractContextReferences(entry, Context::cast(obj)); 1863 ExtractContextReferences(entry, Context::cast(obj));
1857 } else if (obj->IsMap()) { 1864 } else if (obj->IsMap()) {
1858 ExtractMapReferences(entry, Map::cast(obj)); 1865 ExtractMapReferences(entry, Map::cast(obj));
1859 } else if (obj->IsSharedFunctionInfo()) { 1866 } else if (obj->IsSharedFunctionInfo()) {
1860 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); 1867 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj));
1861 } else if (obj->IsScript()) { 1868 } else if (obj->IsScript()) {
1862 ExtractScriptReferences(entry, Script::cast(obj)); 1869 ExtractScriptReferences(entry, Script::cast(obj));
1863 } else if (obj->IsCodeCache()) { 1870 } else if (obj->IsCodeCache()) {
1864 ExtractCodeCacheReferences(entry, CodeCache::cast(obj)); 1871 ExtractCodeCacheReferences(entry, CodeCache::cast(obj));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 TagObject(js_obj->elements(), "(object elements)"); 1966 TagObject(js_obj->elements(), "(object elements)");
1960 SetInternalReference(obj, entry, 1967 SetInternalReference(obj, entry,
1961 "elements", js_obj->elements(), 1968 "elements", js_obj->elements(),
1962 JSObject::kElementsOffset); 1969 JSObject::kElementsOffset);
1963 } 1970 }
1964 1971
1965 1972
1966 void V8HeapExplorer::ExtractStringReferences(int entry, String* string) { 1973 void V8HeapExplorer::ExtractStringReferences(int entry, String* string) {
1967 if (string->IsConsString()) { 1974 if (string->IsConsString()) {
1968 ConsString* cs = ConsString::cast(string); 1975 ConsString* cs = ConsString::cast(string);
1969 SetInternalReference(cs, entry, "first", cs->first()); 1976 SetInternalReference(cs, entry, "first", cs->first(), ConsString::kFirstOffs et);
1970 SetInternalReference(cs, entry, "second", cs->second()); 1977 SetInternalReference(cs, entry, "second", cs->second(), ConsString::kSecondO ffset);
1971 } else if (string->IsSlicedString()) { 1978 } else if (string->IsSlicedString()) {
1972 SlicedString* ss = SlicedString::cast(string); 1979 SlicedString* ss = SlicedString::cast(string);
1973 SetInternalReference(ss, entry, "parent", ss->parent()); 1980 SetInternalReference(ss, entry, "parent", ss->parent(), SlicedString::kParen tOffset);
Yang 2012/10/30 14:39:40 Please keep the 80-char limit.
1974 } 1981 }
1975 } 1982 }
1976 1983
1977 1984
1978 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { 1985 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) {
1979 #define EXTRACT_CONTEXT_FIELD(index, type, name) \ 1986 #define EXTRACT_CONTEXT_FIELD(index, type, name) \
1980 SetInternalReference(context, entry, #name, context->get(Context::index), \ 1987 SetInternalReference(context, entry, #name, context->get(Context::index), \
1981 FixedArray::OffsetOfElementAt(Context::index)); 1988 FixedArray::OffsetOfElementAt(Context::index));
1982 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure); 1989 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure);
1983 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous); 1990 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous);
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
3579 3586
3580 3587
3581 void HeapSnapshotJSONSerializer::SortHashMap( 3588 void HeapSnapshotJSONSerializer::SortHashMap(
3582 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3589 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3583 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3590 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3584 sorted_entries->Add(p); 3591 sorted_entries->Add(p);
3585 sorted_entries->Sort(SortUsingEntryValue); 3592 sorted_entries->Sort(SortUsingEntryValue);
3586 } 3593 }
3587 3594
3588 } } // namespace v8::internal 3595 } } // 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
RSS Feeds Recent Issues | This issue
This is Rietveld 1280:2d3e6564b7b6