Changeset 99374 in webkit for trunk/Source/JavaScriptCore/heap
- Timestamp:
- Nov 6, 2011, 3:39:12 AM (14 years ago)
- Location:
- trunk/Source/JavaScriptCore/heap
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/Heap.cpp
r98937 r99374 554 554 void Heap::markRoots(bool fullGC) 555 555 { 556 SamplingRegion samplingRegion("Garbage Collection: Tracing"); 557 556 558 COND_GCPHASE(fullGC, MarkFullRoots, MarkYoungRoots); 557 559 UNUSED_PARAM(fullGC); … … 760 762 void Heap::collect(SweepToggle sweepToggle) 761 763 { 764 SamplingRegion samplingRegion("Garbage Collection"); 765 762 766 GCPHASE(Collect); 763 767 ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable()); … … 793 797 794 798 if (sweepToggle == DoSweep) { 799 SamplingRegion samplingRegion("Garbage Collection: Sweeping"); 795 800 GCPHASE(Sweeping); 796 801 sweep(); -
trunk/Source/JavaScriptCore/heap/VTableSpectrum.cpp
r95901 r99374 50 50 void VTableSpectrum::countVPtr(void* vTablePointer) 51 51 { 52 std::pair<HashMap<void*, unsigned long>::iterator, bool> result = m_map.add(vTablePointer, 1); 53 if (!result.second) 54 result.first->second++; 52 add(vTablePointer); 55 53 } 56 54 … … 60 58 } 61 59 62 struct VTableAndCount {63 void* vtable;64 unsigned long count;65 66 VTableAndCount() { }67 68 VTableAndCount(void* vtable, unsigned long count)69 : vtable(vtable)70 , count(count)71 {72 }73 74 bool operator<(const VTableAndCount& other) const75 {76 if (count != other.count)77 return count < other.count;78 return vtable > other.vtable; // this results in lower-addressed vtables being printed first79 }80 };81 82 60 void VTableSpectrum::dump(FILE* output, const char* comment) 83 61 { 84 62 fprintf(output, "%s:\n", comment); 85 63 86 HashMap<void*, unsigned long>::iterator begin = m_map.begin(); 87 HashMap<void*, unsigned long>::iterator end = m_map.end(); 88 89 Vector<VTableAndCount, 0> list; 90 91 for (HashMap<void*, unsigned long>::iterator iter = begin; iter != end; ++iter) 92 list.append(VTableAndCount(iter->first, iter->second)); 93 94 std::sort(list.begin(), list.end()); 64 Vector<KeyAndCount> list = buildList(); 95 65 96 66 for (size_t index = list.size(); index-- > 0;) { 97 VTableAndCount item = list.at(index);67 KeyAndCount item = list.at(index); 98 68 #if PLATFORM(MAC) 99 69 Dl_info info; 100 if (dladdr(item. vtable, &info)) {70 if (dladdr(item.key, &info)) { 101 71 char* findResult = strrchr(info.dli_fname, '/'); 102 72 const char* strippedFileName; … … 107 77 strippedFileName = info.dli_fname; 108 78 109 fprintf(output, " %s:%s(%p): %lu\n", strippedFileName, info.dli_sname, item. vtable, item.count);79 fprintf(output, " %s:%s(%p): %lu\n", strippedFileName, info.dli_sname, item.key, item.count); 110 80 continue; 111 81 } 112 82 #endif 113 fprintf(output, " %p: %lu\n", item. vtable, item.count);83 fprintf(output, " %p: %lu\n", item.key, item.count); 114 84 } 115 85 -
trunk/Source/JavaScriptCore/heap/VTableSpectrum.h
r95901 r99374 28 28 29 29 #include <stdio.h> 30 #include <wtf/ HashMap.h>30 #include <wtf/Spectrum.h> 31 31 32 32 namespace JSC { … … 34 34 class JSCell; 35 35 36 class VTableSpectrum {36 class VTableSpectrum: Spectrum<void*> { 37 37 public: 38 38 VTableSpectrum(); … … 43 43 44 44 void dump(FILE* output, const char* comment); 45 46 private:47 HashMap<void*, unsigned long> m_map;48 45 }; 49 46
Note:
See TracChangeset
for help on using the changeset viewer.