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

Side by Side Diff: Source/platform/heap/Heap.h

Issue 1149673002: Adding blink gc memory dump infrastructure for thread specific dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing nits. Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #else 88 #else
89 #define FILL_ZERO_IF_PRODUCTION(address, size) memset((address), 0, (size)) 89 #define FILL_ZERO_IF_PRODUCTION(address, size) memset((address), 0, (size))
90 #define FILL_ZERO_IF_NOT_PRODUCTION(address, size) do { } while (false) 90 #define FILL_ZERO_IF_NOT_PRODUCTION(address, size) do { } while (false)
91 #endif 91 #endif
92 92
93 class CallbackStack; 93 class CallbackStack;
94 class FreePagePool; 94 class FreePagePool;
95 class NormalPageHeap; 95 class NormalPageHeap;
96 class OrphanedPagePool; 96 class OrphanedPagePool;
97 class PageMemory; 97 class PageMemory;
98 class WebProcessMemoryDump;
98 99
99 #if ENABLE(GC_PROFILING) 100 #if ENABLE(GC_PROFILING)
100 class TracedValue; 101 class TracedValue;
101 #endif 102 #endif
102 103
103 // HeapObjectHeader is 4 byte (32 bit) that has the following layout: 104 // HeapObjectHeader is 4 byte (32 bit) that has the following layout:
104 // 105 //
105 // | gcInfoIndex (14 bit) | DOM mark bit (1 bit) | size (14 bit) | dead bit (1 b it) | freed bit (1 bit) | mark bit (1 bit) | 106 // | gcInfoIndex (14 bit) | DOM mark bit (1 bit) | size (14 bit) | dead bit (1 b it) | freed bit (1 bit) | mark bit (1 bit) |
106 // 107 //
107 // - For non-large objects, 14 bit is enough for |size| because the blink 108 // - For non-large objects, 14 bit is enough for |size| because the blink
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 // 680 //
680 // BaseHeap is a parent class of NormalPageHeap and LargeObjectHeap. 681 // BaseHeap is a parent class of NormalPageHeap and LargeObjectHeap.
681 // NormalPageHeap represents a heap that contains NormalPages 682 // NormalPageHeap represents a heap that contains NormalPages
682 // and LargeObjectHeap represents a heap that contains LargeObjectPages. 683 // and LargeObjectHeap represents a heap that contains LargeObjectPages.
683 class PLATFORM_EXPORT BaseHeap { 684 class PLATFORM_EXPORT BaseHeap {
684 public: 685 public:
685 BaseHeap(ThreadState*, int); 686 BaseHeap(ThreadState*, int);
686 virtual ~BaseHeap(); 687 virtual ~BaseHeap();
687 void cleanupPages(); 688 void cleanupPages();
688 689
690 void dumpMemory(const String& allocatorBaseName);
689 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) 691 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING)
690 BasePage* findPageFromAddress(Address); 692 BasePage* findPageFromAddress(Address);
691 #endif 693 #endif
692 #if ENABLE(GC_PROFILING) 694 #if ENABLE(GC_PROFILING)
693 void snapshot(TracedValue*, ThreadState::SnapshotInfo*); 695 void snapshot(TracedValue*, ThreadState::SnapshotInfo*);
694 virtual void snapshotFreeList(TracedValue&) { }; 696 virtual void snapshotFreeList(TracedValue&) { };
695 697
696 void countMarkedObjects(ClassAgeCountsMap&) const; 698 void countMarkedObjects(ClassAgeCountsMap&) const;
697 void countObjectsToSweep(ClassAgeCountsMap&) const; 699 void countObjectsToSweep(ClassAgeCountsMap&) const;
698 void incrementMarkedObjectsAge(); 700 void incrementMarkedObjectsAge();
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 static void increaseAllocatedSpace(size_t delta) { atomicAdd(&s_allocatedSpa ce, static_cast<long>(delta)); } 990 static void increaseAllocatedSpace(size_t delta) { atomicAdd(&s_allocatedSpa ce, static_cast<long>(delta)); }
989 static void decreaseAllocatedSpace(size_t delta) { atomicSubtract(&s_allocat edSpace, static_cast<long>(delta)); } 991 static void decreaseAllocatedSpace(size_t delta) { atomicSubtract(&s_allocat edSpace, static_cast<long>(delta)); }
990 static size_t allocatedSpace() { return acquireLoad(&s_allocatedSpace); } 992 static size_t allocatedSpace() { return acquireLoad(&s_allocatedSpace); }
991 static size_t estimatedLiveObjectSize() { return acquireLoad(&s_estimatedLiv eObjectSize); } 993 static size_t estimatedLiveObjectSize() { return acquireLoad(&s_estimatedLiv eObjectSize); }
992 static void setEstimatedLiveObjectSize(size_t size) { releaseStore(&s_estima tedLiveObjectSize, size); } 994 static void setEstimatedLiveObjectSize(size_t size) { releaseStore(&s_estima tedLiveObjectSize, size); }
993 static size_t externalObjectSizeAtLastGC() { return acquireLoad(&s_externalO bjectSizeAtLastGC); } 995 static size_t externalObjectSizeAtLastGC() { return acquireLoad(&s_externalO bjectSizeAtLastGC); }
994 996
995 static double estimatedMarkingTime(); 997 static double estimatedMarkingTime();
996 static void reportMemoryUsageHistogram(); 998 static void reportMemoryUsageHistogram();
997 999
1000 static WebProcessMemoryDump* getLastProcessMemoryDump();
Primiano Tucci (use gerrit) 2015/05/22 15:50:21 Hmm I think it would be cleaner if we keep the ext
ssid 2015/05/22 17:17:10 Done.
1001 static void clearLastProcessMemoryDump();
1002
998 private: 1003 private:
999 // A RegionTree is a simple binary search tree of PageMemoryRegions sorted 1004 // A RegionTree is a simple binary search tree of PageMemoryRegions sorted
1000 // by base addresses. 1005 // by base addresses.
1001 class RegionTree { 1006 class RegionTree {
1002 public: 1007 public:
1003 explicit RegionTree(PageMemoryRegion* region) : m_region(region), m_left (nullptr), m_right(nullptr) { } 1008 explicit RegionTree(PageMemoryRegion* region) : m_region(region), m_left (nullptr), m_right(nullptr) { }
1004 ~RegionTree() 1009 ~RegionTree()
1005 { 1010 {
1006 delete m_left; 1011 delete m_left;
1007 delete m_right; 1012 delete m_right;
(...skipping 20 matching lines...) Expand all
1028 static bool s_lastGCWasConservative; 1033 static bool s_lastGCWasConservative;
1029 static FreePagePool* s_freePagePool; 1034 static FreePagePool* s_freePagePool;
1030 static OrphanedPagePool* s_orphanedPagePool; 1035 static OrphanedPagePool* s_orphanedPagePool;
1031 static RegionTree* s_regionTree; 1036 static RegionTree* s_regionTree;
1032 static size_t s_allocatedSpace; 1037 static size_t s_allocatedSpace;
1033 static size_t s_allocatedObjectSize; 1038 static size_t s_allocatedObjectSize;
1034 static size_t s_markedObjectSize; 1039 static size_t s_markedObjectSize;
1035 static size_t s_estimatedLiveObjectSize; 1040 static size_t s_estimatedLiveObjectSize;
1036 static size_t s_externalObjectSizeAtLastGC; 1041 static size_t s_externalObjectSizeAtLastGC;
1037 static double s_estimatedMarkingTimePerByte; 1042 static double s_estimatedMarkingTimePerByte;
1043 static WebProcessMemoryDump* s_lastProcessMemoryDump;
Primiano Tucci (use gerrit) 2015/05/22 15:50:21 Same here, if you move the WPMD to the GCDumpprovi
ssid 2015/05/22 17:17:10 Done.
1038 1044
1039 friend class ThreadState; 1045 friend class ThreadState;
1040 }; 1046 };
1041 1047
1042 template<typename T> class GarbageCollected { 1048 template<typename T> class GarbageCollected {
1043 WTF_MAKE_NONCOPYABLE(GarbageCollected); 1049 WTF_MAKE_NONCOPYABLE(GarbageCollected);
1044 1050
1045 // For now direct allocation of arrays on the heap is not allowed. 1051 // For now direct allocation of arrays on the heap is not allowed.
1046 void* operator new[](size_t size); 1052 void* operator new[](size_t size);
1047 1053
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 size_t copySize = previousHeader->payloadSize(); 1279 size_t copySize = previousHeader->payloadSize();
1274 if (copySize > size) 1280 if (copySize > size)
1275 copySize = size; 1281 copySize = size;
1276 memcpy(address, previous, copySize); 1282 memcpy(address, previous, copySize);
1277 return address; 1283 return address;
1278 } 1284 }
1279 1285
1280 } // namespace blink 1286 } // namespace blink
1281 1287
1282 #endif // Heap_h 1288 #endif // Heap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698