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

Unified Diff: Source/platform/heap/ThreadState.cpp

Issue 1213133002: Oilpan: Reduce sizeof(Persistent) to 16 byte (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | « Source/platform/heap/ThreadState.h ('k') | Source/platform/heap/blink_heap.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/ThreadState.cpp
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
index 940d45a60aeb7c461545664c17ca410c3dca6700..bcf2993d038a9454a13cebe608c1e4fc6addd924 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -85,7 +85,7 @@ RecursiveMutex& ThreadState::threadAttachMutex()
ThreadState::ThreadState()
: m_thread(currentThread())
- , m_persistents(adoptPtr(new PersistentAnchor()))
+ , m_persistentRegion(adoptPtr(new PersistentRegion()))
, m_startOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart()))
, m_endOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart()))
, m_safePointScopeMarker(nullptr)
@@ -243,14 +243,13 @@ void ThreadState::cleanup()
// Do thread local GC's as long as the count of thread local Persistents
// changes and is above zero.
- PersistentAnchor* anchor = m_persistents.get();
int oldCount = -1;
- int currentCount = anchor->numberOfPersistents();
+ int currentCount = persistentRegion()->numberOfPersistents();
ASSERT(currentCount >= 0);
while (currentCount != oldCount) {
Heap::collectGarbageForTerminatingThread(this);
oldCount = currentCount;
- currentCount = anchor->numberOfPersistents();
+ currentCount = persistentRegion()->numberOfPersistents();
}
// We should not have any persistents left when getting to this point,
// if we have it is probably a bug so adding a debug ASSERT to catch this.
@@ -280,13 +279,7 @@ void ThreadState::detach()
void ThreadState::visitPersistentRoots(Visitor* visitor)
{
TRACE_EVENT0("blink_gc", "ThreadState::visitPersistentRoots");
- {
- // All threads are at safepoints so this is not strictly necessary.
- // However we acquire the mutex to make mutation and traversal of this
- // list symmetrical.
- MutexLocker locker(globalRootsMutex());
- globalRoots().tracePersistentNodes(visitor);
- }
+ crossThreadPersistentRegion().tracePersistentNodes(visitor);
for (ThreadState* state : attachedThreads())
state->visitPersistents(visitor);
@@ -373,7 +366,7 @@ void ThreadState::visitStack(Visitor* visitor)
void ThreadState::visitPersistents(Visitor* visitor)
{
- m_persistents->tracePersistentNodes(visitor);
+ m_persistentRegion->tracePersistentNodes(visitor);
if (m_traceDOMWrappers) {
TRACE_EVENT0("blink_gc", "V8GCController::traceDOMWrappers");
m_traceDOMWrappers(m_isolate, visitor);
@@ -542,16 +535,10 @@ void ThreadState::threadLocalWeakProcessing()
ScriptForbiddenScope::exit();
}
-PersistentAnchor& ThreadState::globalRoots()
-{
- AtomicallyInitializedStaticReference(PersistentAnchor, anchor, new PersistentAnchor);
- return anchor;
-}
-
-Mutex& ThreadState::globalRootsMutex()
+CrossThreadPersistentRegion& ThreadState::crossThreadPersistentRegion()
{
- AtomicallyInitializedStaticReference(Mutex, mutex, new Mutex);
- return mutex;
+ AtomicallyInitializedStaticReference(CrossThreadPersistentRegion, persistentRegion, new CrossThreadPersistentRegion());
+ return persistentRegion;
}
bool ThreadState::shouldForceMemoryPressureGC()
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | Source/platform/heap/blink_heap.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698