Chromium Code Reviews| 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 d8882ad5babb73e58f7d680967f1331d4e2c1940..282dfbc5c4961517f03df3fc48a09681ad70945e 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. |
| + RELEASE_ASSERT(!m_perThreadHeapEnabled); |
|
haraken
2016/04/25 06:57:12
CHECK
keishi
2016/04/25 08:00:26
Done.
|
| + |
| + 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() |