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

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

Issue 10382106: Set object tags directly to the entry name in heap profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 months 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 | « src/profile-generator.h ('k') | 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 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 ? collection_->names()->GetName(String::cast(name)) 1703 ? collection_->names()->GetName(String::cast(name))
1704 : ""); 1704 : "");
1705 } else if (object->IsGlobalContext()) { 1705 } else if (object->IsGlobalContext()) {
1706 return AddEntry(object, HeapEntry::kHidden, "system / GlobalContext"); 1706 return AddEntry(object, HeapEntry::kHidden, "system / GlobalContext");
1707 } else if (object->IsContext()) { 1707 } else if (object->IsContext()) {
1708 return AddEntry(object, HeapEntry::kHidden, "system / Context"); 1708 return AddEntry(object, HeapEntry::kHidden, "system / Context");
1709 } else if (object->IsFixedArray() || 1709 } else if (object->IsFixedArray() ||
1710 object->IsFixedDoubleArray() || 1710 object->IsFixedDoubleArray() ||
1711 object->IsByteArray() || 1711 object->IsByteArray() ||
1712 object->IsExternalArray()) { 1712 object->IsExternalArray()) {
1713 const char* tag = objects_tags_.GetTag(object); 1713 return AddEntry(object, HeapEntry::kArray, "");
1714 return AddEntry(object, HeapEntry::kArray, tag != NULL ? tag : "");
1715 } else if (object->IsHeapNumber()) { 1714 } else if (object->IsHeapNumber()) {
1716 return AddEntry(object, HeapEntry::kHeapNumber, "number"); 1715 return AddEntry(object, HeapEntry::kHeapNumber, "number");
1717 } 1716 }
1718 return AddEntry(object, HeapEntry::kHidden, GetSystemEntryName(object)); 1717 return AddEntry(object, HeapEntry::kHidden, GetSystemEntryName(object));
1719 } 1718 }
1720 1719
1721 1720
1722 HeapEntry* V8HeapExplorer::AddEntry(HeapObject* object, 1721 HeapEntry* V8HeapExplorer::AddEntry(HeapObject* object,
1723 HeapEntry::Type type, 1722 HeapEntry::Type type,
1724 const char* name) { 1723 const char* name) {
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 #undef SYMBOL_NAME 2627 #undef SYMBOL_NAME
2629 #undef NAME_ENTRY 2628 #undef NAME_ENTRY
2630 CHECK(!strong_gc_subroot_names_.is_empty()); 2629 CHECK(!strong_gc_subroot_names_.is_empty());
2631 } 2630 }
2632 return strong_gc_subroot_names_.GetTag(object); 2631 return strong_gc_subroot_names_.GetTag(object);
2633 } 2632 }
2634 2633
2635 2634
2636 void V8HeapExplorer::TagObject(Object* obj, const char* tag) { 2635 void V8HeapExplorer::TagObject(Object* obj, const char* tag) {
2637 if (IsEssentialObject(obj)) { 2636 if (IsEssentialObject(obj)) {
2638 objects_tags_.SetTag(obj, tag); 2637 HeapEntry* entry = GetEntry(obj);
2638 if (entry->name()[0] == '\0') {
2639 entry->set_name(tag);
2640 }
2639 } 2641 }
2640 } 2642 }
2641 2643
2642 2644
2643 class GlobalObjectsEnumerator : public ObjectVisitor { 2645 class GlobalObjectsEnumerator : public ObjectVisitor {
2644 public: 2646 public:
2645 virtual void VisitPointers(Object** start, Object** end) { 2647 virtual void VisitPointers(Object** start, Object** end) {
2646 for (Object** p = start; p < end; p++) { 2648 for (Object** p = start; p < end; p++) {
2647 if ((*p)->IsGlobalContext()) { 2649 if ((*p)->IsGlobalContext()) {
2648 Context* context = Context::cast(*p); 2650 Context* context = Context::cast(*p);
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3753 3755
3754 3756
3755 void HeapSnapshotJSONSerializer::SortHashMap( 3757 void HeapSnapshotJSONSerializer::SortHashMap(
3756 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3758 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3757 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3759 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3758 sorted_entries->Add(p); 3760 sorted_entries->Add(p);
3759 sorted_entries->Sort(SortUsingEntryValue); 3761 sorted_entries->Sort(SortUsingEntryValue);
3760 } 3762 }
3761 3763
3762 } } // namespace v8::internal 3764 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698