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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size
of(void*); | 117 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size
of(void*); |
118 } | 118 } |
119 | 119 |
120 for (int heapIndex = 0; heapIndex < BlinkGC::LargeObjectHeapIndex; heapIndex
++) | 120 for (int heapIndex = 0; heapIndex < BlinkGC::LargeObjectHeapIndex; heapIndex
++) |
121 m_heaps[heapIndex] = new NormalPageHeap(this, heapIndex); | 121 m_heaps[heapIndex] = new NormalPageHeap(this, heapIndex); |
122 m_heaps[BlinkGC::LargeObjectHeapIndex] = new LargeObjectHeap(this, BlinkGC::
LargeObjectHeapIndex); | 122 m_heaps[BlinkGC::LargeObjectHeapIndex] = new LargeObjectHeap(this, BlinkGC::
LargeObjectHeapIndex); |
123 | 123 |
124 m_likelyToBePromptlyFreed = adoptArrayPtr(new int[likelyToBePromptlyFreedArr
aySize]); | 124 m_likelyToBePromptlyFreed = adoptArrayPtr(new int[likelyToBePromptlyFreedArr
aySize]); |
125 clearHeapAges(); | 125 clearHeapAges(); |
126 | 126 |
127 m_threadLocalWeakCallbackStack = new CallbackStack(); | 127 m_threadLocalWeakCallbackStack = new CallbackStack(isMainThread() ? 1024 : 1
28); |
128 } | 128 } |
129 | 129 |
130 ThreadState::~ThreadState() | 130 ThreadState::~ThreadState() |
131 { | 131 { |
132 ASSERT(checkThread()); | 132 ASSERT(checkThread()); |
133 delete m_threadLocalWeakCallbackStack; | 133 delete m_threadLocalWeakCallbackStack; |
134 m_threadLocalWeakCallbackStack = nullptr; | 134 m_threadLocalWeakCallbackStack = nullptr; |
135 for (int i = 0; i < BlinkGC::NumberOfHeaps; ++i) | 135 for (int i = 0; i < BlinkGC::NumberOfHeaps; ++i) |
136 delete m_heaps[i]; | 136 delete m_heaps[i]; |
137 | 137 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 // resurrected or mutate a HashTable (because HashTable's weak processing | 477 // resurrected or mutate a HashTable (because HashTable's weak processing |
478 // assumes that the HashTable hasn't been mutated since the latest marking). | 478 // assumes that the HashTable hasn't been mutated since the latest marking). |
479 // Due to the complexity, we just forbid allocations. | 479 // Due to the complexity, we just forbid allocations. |
480 NoAllocationScope noAllocationScope(this); | 480 NoAllocationScope noAllocationScope(this); |
481 | 481 |
482 MarkingVisitor<Visitor::WeakProcessing> weakProcessingVisitor; | 482 MarkingVisitor<Visitor::WeakProcessing> weakProcessingVisitor; |
483 | 483 |
484 // Perform thread-specific weak processing. | 484 // Perform thread-specific weak processing. |
485 while (popAndInvokeThreadLocalWeakCallback(&weakProcessingVisitor)) { } | 485 while (popAndInvokeThreadLocalWeakCallback(&weakProcessingVisitor)) { } |
486 | 486 |
| 487 ASSERT(m_threadLocalWeakCallbackStack->isEmpty()); |
| 488 |
487 if (isMainThread()) { | 489 if (isMainThread()) { |
488 double timeForThreadLocalWeakProcessing = WTF::currentTimeMS() - startTi
me; | 490 double timeForThreadLocalWeakProcessing = WTF::currentTimeMS() - startTi
me; |
489 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeForWeakHistogram, ("BlinkG
C.timeForThreadLocalWeakProcessing", 1, 10 * 1000, 50)); | 491 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeForWeakHistogram, ("BlinkG
C.timeForThreadLocalWeakProcessing", 1, 10 * 1000, 50)); |
490 timeForWeakHistogram.count(timeForThreadLocalWeakProcessing); | 492 timeForWeakHistogram.count(timeForThreadLocalWeakProcessing); |
491 } | 493 } |
492 } | 494 } |
493 | 495 |
494 size_t ThreadState::totalMemorySize() | 496 size_t ThreadState::totalMemorySize() |
495 { | 497 { |
496 return Heap::allocatedObjectSize() + Heap::markedObjectSize() + WTF::Partiti
ons::totalSizeOfCommittedPages(); | 498 return Heap::allocatedObjectSize() + Heap::markedObjectSize() + WTF::Partiti
ons::totalSizeOfCommittedPages(); |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 threadDump->addScalar("dead_count", "objects", totalDeadCount); | 1500 threadDump->addScalar("dead_count", "objects", totalDeadCount); |
1499 threadDump->addScalar("live_size", "bytes", totalLiveSize); | 1501 threadDump->addScalar("live_size", "bytes", totalLiveSize); |
1500 threadDump->addScalar("dead_size", "bytes", totalDeadSize); | 1502 threadDump->addScalar("dead_size", "bytes", totalDeadSize); |
1501 | 1503 |
1502 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); | 1504 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); |
1503 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); | 1505 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); |
1504 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); | 1506 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); |
1505 } | 1507 } |
1506 | 1508 |
1507 } // namespace blink | 1509 } // namespace blink |
OLD | NEW |