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

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

Issue 1910753002: Add enablePerThreadHeap flag to ThreadState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 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/ThreadState.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/ThreadState.cpp
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
index 137daa4aa50d7907021466e8f70c0a75b474b94b..e1294ec308fb758f3ef5f6e26e3ba3df415c4253 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -73,7 +73,7 @@ uintptr_t ThreadState::s_mainThreadStackStart = 0;
uintptr_t ThreadState::s_mainThreadUnderestimatedStackSize = 0;
uint8_t ThreadState::s_mainThreadStateStorage[sizeof(ThreadState)];
-ThreadState::ThreadState()
+ThreadState::ThreadState(bool perThreadHeapEnabled)
: m_thread(currentThread())
, m_persistentRegion(adoptPtr(new PersistentRegion()))
#if OS(WIN) && COMPILER(MSVC)
@@ -90,6 +90,7 @@ ThreadState::ThreadState()
, m_accumulatedSweepingTime(0)
, m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex)
, m_currentArenaAges(0)
+ , m_perThreadHeapEnabled(perThreadHeapEnabled)
, m_isTerminating(false)
, m_gcMixinMarker(nullptr)
, m_shouldFlushHeapDoesNotContainCache(false)
@@ -110,7 +111,12 @@ ThreadState::ThreadState()
ASSERT(!**s_threadSpecific);
**s_threadSpecific = this;
- if (isMainThread()) {
+ // TODO(keishi) Remove when per thread heap is ready.
+ CHECK(!m_perThreadHeapEnabled);
+
+ if (m_perThreadHeapEnabled) {
+ m_heap = new ThreadHeap();
+ } else if (isMainThread()) {
s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - sizeof(void*);
size_t underestimatedStackSize = StackFrameDepth::getUnderestimatedStackSize();
if (underestimatedStackSize > sizeof(void*))
@@ -189,13 +195,13 @@ void ThreadState::attachMainThread()
{
RELEASE_ASSERT(!ProcessHeap::s_shutdownComplete);
s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>();
- new (s_mainThreadStateStorage) ThreadState();
+ new (s_mainThreadStateStorage) ThreadState(false);
}
-void ThreadState::attachCurrentThread()
+void ThreadState::attachCurrentThread(bool perThreadHeapEnabled)
{
RELEASE_ASSERT(!ProcessHeap::s_shutdownComplete);
- new ThreadState();
+ new ThreadState(perThreadHeapEnabled);
}
void ThreadState::cleanupPages()
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698