Commit 6422f3b2 authored by haraken's avatar haraken Committed by Commit bot

HeapCompact doesn't need to support multiple threads

Now that the per-thread heaps have been shipped, HeapCompact no longer needs to
support multiple threads. This CL removes that code.

BUG=671856

Review-Url: https://codereview.chromium.org/2633463006
Cr-Commit-Position: refs/heads/master@{#443542}
parent 989dace1
......@@ -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,9 +424,6 @@ 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();
......@@ -437,8 +431,7 @@ void HeapCompact::finishThreadCompaction() {
m_fixups.reset();
m_doCompact = false;
double timeForHeapCompaction =
WTF::currentTimeMS() - m_startCompactionTimeMS;
double timeForHeapCompaction = WTF::currentTimeMS() - m_startCompactionTimeMS;
DEFINE_STATIC_LOCAL(CustomCountHistogram, timeForHeapCompactionHistogram,
("BlinkGC.TimeForHeapCompaction", 1, 10 * 1000, 50));
timeForHeapCompactionHistogram.count(timeForHeapCompaction);
......@@ -457,18 +450,6 @@ void HeapCompact::finishThreadCompaction() {
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) {
......
......@@ -139,18 +139,6 @@ class PLATFORM_EXPORT HeapCompact final {
bool m_doCompact;
size_t m_gcCountSinceLastCompaction;
// Lock protecting finishedThreadCompaction() signalling.
Mutex m_mutex;
// All threads performing a GC must synchronize on completion
// of all heap compactions. Not doing so risks one thread resuming
// the mutator, which could perform cross-thread access to a heap
// that's still in the process of being compacted.
ThreadCondition m_finished;
// Number of heap threads participating in the compaction.
int m_threadCount;
// Last reported freelist size, across all compactable arenas.
size_t m_freeListSize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment