Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 23 matching lines...) Expand all Loading... | |
| 34 #include "platform/ScriptForbiddenScope.h" | 34 #include "platform/ScriptForbiddenScope.h" |
| 35 #include "platform/Task.h" | 35 #include "platform/Task.h" |
| 36 #include "platform/TraceEvent.h" | 36 #include "platform/TraceEvent.h" |
| 37 #include "platform/heap/CallbackStack.h" | 37 #include "platform/heap/CallbackStack.h" |
| 38 #include "platform/heap/MarkingVisitor.h" | 38 #include "platform/heap/MarkingVisitor.h" |
| 39 #include "platform/heap/PageMemory.h" | 39 #include "platform/heap/PageMemory.h" |
| 40 #include "platform/heap/PagePool.h" | 40 #include "platform/heap/PagePool.h" |
| 41 #include "platform/heap/SafePoint.h" | 41 #include "platform/heap/SafePoint.h" |
| 42 #include "platform/heap/ThreadState.h" | 42 #include "platform/heap/ThreadState.h" |
| 43 #include "public/platform/Platform.h" | 43 #include "public/platform/Platform.h" |
| 44 #include "public/platform/WebMemoryAllocatorDump.h" | |
| 45 #include "public/platform/WebProcessMemoryDump.h" | |
| 44 #include "wtf/Assertions.h" | 46 #include "wtf/Assertions.h" |
| 45 #include "wtf/ContainerAnnotations.h" | 47 #include "wtf/ContainerAnnotations.h" |
| 46 #include "wtf/LeakAnnotations.h" | 48 #include "wtf/LeakAnnotations.h" |
| 47 #include "wtf/MainThread.h" | 49 #include "wtf/MainThread.h" |
| 48 #include "wtf/PageAllocator.h" | 50 #include "wtf/PageAllocator.h" |
| 49 #include "wtf/Partitions.h" | 51 #include "wtf/Partitions.h" |
| 50 #include "wtf/PassOwnPtr.h" | 52 #include "wtf/PassOwnPtr.h" |
| 51 #if ENABLE(GC_PROFILING) | 53 #if ENABLE(GC_PROFILING) |
| 52 #include "platform/TracedValue.h" | 54 #include "platform/TracedValue.h" |
| 53 #include "wtf/HashMap.h" | 55 #include "wtf/HashMap.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 | 208 |
| 207 ASSERT(!m_firstUnsweptPage); | 209 ASSERT(!m_firstUnsweptPage); |
| 208 // Add the BaseHeap's pages to the orphanedPagePool. | 210 // Add the BaseHeap's pages to the orphanedPagePool. |
| 209 for (BasePage* page = m_firstPage; page; page = page->next()) { | 211 for (BasePage* page = m_firstPage; page; page = page->next()) { |
| 210 Heap::decreaseAllocatedSpace(page->size()); | 212 Heap::decreaseAllocatedSpace(page->size()); |
| 211 Heap::orphanedPagePool()->addOrphanedPage(heapIndex(), page); | 213 Heap::orphanedPagePool()->addOrphanedPage(heapIndex(), page); |
| 212 } | 214 } |
| 213 m_firstPage = nullptr; | 215 m_firstPage = nullptr; |
| 214 } | 216 } |
| 215 | 217 |
| 218 void BaseHeap::dumpMemoryInto(WebProcessMemoryDump* memoryDump, const String* al locatorBaseName) | |
|
Primiano Tucci (use gerrit)
2015/05/21 18:43:10
maybe s/allocatorBaseName/dumpBaseName/... or just
ssid
2015/05/22 13:34:06
Done.
| |
| 219 { | |
| 220 // Returns if there is no page used in the heap. | |
| 221 if (!m_firstPage) | |
| 222 return; | |
|
Primiano Tucci (use gerrit)
2015/05/21 18:43:10
Hmm I'd much rather prefer that you dump a zero in
ssid
2015/05/22 13:34:06
Done.
| |
| 223 | |
| 224 size_t pageCount = 0; | |
| 225 for (BasePage* page = m_firstPage; page; page = page->next()) { | |
| 226 pageCount++; | |
| 227 } | |
| 228 WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDum p(*allocatorBaseName); | |
| 229 allocatorDump->AddScalar("blink_page_count", "objects", pageCount); | |
| 230 } | |
| 231 | |
| 216 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 232 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 217 BasePage* BaseHeap::findPageFromAddress(Address address) | 233 BasePage* BaseHeap::findPageFromAddress(Address address) |
| 218 { | 234 { |
| 219 for (BasePage* page = m_firstPage; page; page = page->next()) { | 235 for (BasePage* page = m_firstPage; page; page = page->next()) { |
| 220 if (page->contains(address)) | 236 if (page->contains(address)) |
| 221 return page; | 237 return page; |
| 222 } | 238 } |
| 223 for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) { | 239 for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) { |
| 224 if (page->contains(address)) | 240 if (page->contains(address)) |
| 225 return page; | 241 return page; |
| (...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2227 size_t Heap::s_allocatedObjectSize = 0; | 2243 size_t Heap::s_allocatedObjectSize = 0; |
| 2228 size_t Heap::s_allocatedSpace = 0; | 2244 size_t Heap::s_allocatedSpace = 0; |
| 2229 size_t Heap::s_markedObjectSize = 0; | 2245 size_t Heap::s_markedObjectSize = 0; |
| 2230 // We don't want to use 0 KB for the initial value because it may end up | 2246 // We don't want to use 0 KB for the initial value because it may end up |
| 2231 // triggering the first GC of some thread too prematurely. | 2247 // triggering the first GC of some thread too prematurely. |
| 2232 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2248 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; |
| 2233 size_t Heap::s_externalObjectSizeAtLastGC = 0; | 2249 size_t Heap::s_externalObjectSizeAtLastGC = 0; |
| 2234 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2250 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
| 2235 | 2251 |
| 2236 } // namespace blink | 2252 } // namespace blink |
| OLD | NEW |