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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapCompact.cpp

Issue 2633463006: HeapCompact doesn't need to support multiple threads (Closed)
Patch Set: temp Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapCompact.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/HeapCompact.cpp
diff --git a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp
index b31a31bdb98160411c91a9a083d65c07d314645e..591caef5627387ef155a6ff1a8009b98f1199e79 100644
--- a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp
@@ -253,7 +253,6 @@ class HeapCompact::MovableObjectFixups final {
HeapCompact::HeapCompact()
: m_doCompact(false),
m_gcCountSinceLastCompaction(0),
- m_threadCount(0),
m_freeListSize(0),
m_compactableArenas(0u),
m_freedPages(0),
@@ -346,7 +345,6 @@ void HeapCompact::initialize(ThreadState* state) {
m_doCompact = true;
m_freedPages = 0;
m_freedSize = 0;
- m_threadCount = state->heap().threads().size();
m_fixups.reset();
m_gcCountSinceLastCompaction = 0;
s_forceCompactionGC = false;
@@ -418,7 +416,6 @@ void HeapCompact::startThreadCompaction() {
if (!m_doCompact)
return;
- MutexLocker locker(m_mutex);
if (!m_startCompactionTimeMS)
m_startCompactionTimeMS = WTF::currentTimeMS();
}
@@ -427,48 +424,32 @@ void HeapCompact::finishThreadCompaction() {
if (!m_doCompact)
return;
- MutexLocker locker(m_mutex);
- // Final one clears out.
- if (!--m_threadCount) {
#if DEBUG_HEAP_COMPACTION
- if (m_fixups)
- m_fixups->dumpDebugStats();
+ if (m_fixups)
+ m_fixups->dumpDebugStats();
#endif
- m_fixups.reset();
- m_doCompact = false;
+ m_fixups.reset();
+ m_doCompact = false;
- double timeForHeapCompaction =
- WTF::currentTimeMS() - m_startCompactionTimeMS;
- DEFINE_STATIC_LOCAL(CustomCountHistogram, timeForHeapCompactionHistogram,
- ("BlinkGC.TimeForHeapCompaction", 1, 10 * 1000, 50));
- timeForHeapCompactionHistogram.count(timeForHeapCompaction);
- m_startCompactionTimeMS = 0;
+ double timeForHeapCompaction = WTF::currentTimeMS() - m_startCompactionTimeMS;
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, timeForHeapCompactionHistogram,
+ ("BlinkGC.TimeForHeapCompaction", 1, 10 * 1000, 50));
+ timeForHeapCompactionHistogram.count(timeForHeapCompaction);
+ m_startCompactionTimeMS = 0;
- DEFINE_STATIC_LOCAL(
- CustomCountHistogram, objectSizeFreedByHeapCompaction,
- ("BlinkGC.ObjectSizeFreedByHeapCompaction", 1, 4 * 1024 * 1024, 50));
- objectSizeFreedByHeapCompaction.count(m_freedSize / 1024);
+ DEFINE_STATIC_LOCAL(
+ CustomCountHistogram, objectSizeFreedByHeapCompaction,
+ ("BlinkGC.ObjectSizeFreedByHeapCompaction", 1, 4 * 1024 * 1024, 50));
+ objectSizeFreedByHeapCompaction.count(m_freedSize / 1024);
#if DEBUG_LOG_HEAP_COMPACTION_RUNNING_TIME
- LOG_HEAP_COMPACTION_INTERNAL(
- "Compaction stats: time=%gms, pages freed=%zu, size=%zu\n",
- timeForHeapCompaction, m_freedPages, m_freedSize);
+ LOG_HEAP_COMPACTION_INTERNAL(
+ "Compaction stats: time=%gms, pages freed=%zu, size=%zu\n",
+ timeForHeapCompaction, m_freedPages, m_freedSize);
#else
- LOG_HEAP_COMPACTION("Compaction stats: freed pages=%zu size=%zu\n",
- m_freedPages, m_freedSize);
+ LOG_HEAP_COMPACTION("Compaction stats: freed pages=%zu size=%zu\n",
+ m_freedPages, m_freedSize);
#endif
-
- // Compaction has been completed by all participating threads, unblock
- // them all.
- m_finished.broadcast();
- } else {
- // Letting a thread return here and let it exit its safe point opens up
- // the possibility of it accessing heaps of other threads that are
- // still being compacted. It is not in a valid state until objects have
- // all been moved together, hence all GC-participating threads must
- // complete compaction together. Grab the condition variable and wait.
- m_finished.wait(m_mutex);
- }
}
void HeapCompact::addCompactingPage(BasePage* page) {
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapCompact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698