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

Side by Side Diff: third_party/WebKit/Source/platform/heap/ThreadState.cpp

Issue 1919793002: Revert of Add enablePerThreadHeap flag to ThreadState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 #include <v8.h> 67 #include <v8.h>
68 68
69 namespace blink { 69 namespace blink {
70 70
71 WTF::ThreadSpecific<ThreadState*>* ThreadState::s_threadSpecific = nullptr; 71 WTF::ThreadSpecific<ThreadState*>* ThreadState::s_threadSpecific = nullptr;
72 uintptr_t ThreadState::s_mainThreadStackStart = 0; 72 uintptr_t ThreadState::s_mainThreadStackStart = 0;
73 uintptr_t ThreadState::s_mainThreadUnderestimatedStackSize = 0; 73 uintptr_t ThreadState::s_mainThreadUnderestimatedStackSize = 0;
74 uint8_t ThreadState::s_mainThreadStateStorage[sizeof(ThreadState)]; 74 uint8_t ThreadState::s_mainThreadStateStorage[sizeof(ThreadState)];
75 75
76 ThreadState::ThreadState(bool perThreadHeapEnabled) 76 ThreadState::ThreadState()
77 : m_thread(currentThread()) 77 : m_thread(currentThread())
78 , m_persistentRegion(adoptPtr(new PersistentRegion())) 78 , m_persistentRegion(adoptPtr(new PersistentRegion()))
79 #if OS(WIN) && COMPILER(MSVC) 79 #if OS(WIN) && COMPILER(MSVC)
80 , m_threadStackSize(0) 80 , m_threadStackSize(0)
81 #endif 81 #endif
82 , m_startOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart( ))) 82 , m_startOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart( )))
83 , m_endOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart()) ) 83 , m_endOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart()) )
84 , m_safePointScopeMarker(nullptr) 84 , m_safePointScopeMarker(nullptr)
85 , m_atSafePoint(false) 85 , m_atSafePoint(false)
86 , m_interruptors() 86 , m_interruptors()
87 , m_sweepForbidden(false) 87 , m_sweepForbidden(false)
88 , m_noAllocationCount(0) 88 , m_noAllocationCount(0)
89 , m_gcForbiddenCount(0) 89 , m_gcForbiddenCount(0)
90 , m_accumulatedSweepingTime(0) 90 , m_accumulatedSweepingTime(0)
91 , m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex) 91 , m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex)
92 , m_currentArenaAges(0) 92 , m_currentArenaAges(0)
93 , m_perThreadHeapEnabled(perThreadHeapEnabled)
94 , m_isTerminating(false) 93 , m_isTerminating(false)
95 , m_gcMixinMarker(nullptr) 94 , m_gcMixinMarker(nullptr)
96 , m_shouldFlushHeapDoesNotContainCache(false) 95 , m_shouldFlushHeapDoesNotContainCache(false)
97 , m_gcState(NoGCScheduled) 96 , m_gcState(NoGCScheduled)
98 , m_isolate(nullptr) 97 , m_isolate(nullptr)
99 , m_traceDOMWrappers(nullptr) 98 , m_traceDOMWrappers(nullptr)
100 #if defined(ADDRESS_SANITIZER) 99 #if defined(ADDRESS_SANITIZER)
101 , m_asanFakeStack(__asan_get_current_fake_stack()) 100 , m_asanFakeStack(__asan_get_current_fake_stack())
102 #endif 101 #endif
103 #if defined(LEAK_SANITIZER) 102 #if defined(LEAK_SANITIZER)
104 , m_disabledStaticPersistentsRegistration(0) 103 , m_disabledStaticPersistentsRegistration(0)
105 #endif 104 #endif
106 , m_allocatedObjectSize(0) 105 , m_allocatedObjectSize(0)
107 , m_markedObjectSize(0) 106 , m_markedObjectSize(0)
108 , m_reportedMemoryToV8(0) 107 , m_reportedMemoryToV8(0)
109 { 108 {
110 ASSERT(checkThread()); 109 ASSERT(checkThread());
111 ASSERT(!**s_threadSpecific); 110 ASSERT(!**s_threadSpecific);
112 **s_threadSpecific = this; 111 **s_threadSpecific = this;
113 112
114 // TODO(keishi) Remove when per thread heap is ready. 113 if (isMainThread()) {
115 CHECK(!m_perThreadHeapEnabled);
116
117 if (m_perThreadHeapEnabled) {
118 m_heap = new ThreadHeap();
119 } else if (isMainThread()) {
120 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s izeof(void*); 114 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s izeof(void*);
121 size_t underestimatedStackSize = StackFrameDepth::getUnderestimatedStack Size(); 115 size_t underestimatedStackSize = StackFrameDepth::getUnderestimatedStack Size();
122 if (underestimatedStackSize > sizeof(void*)) 116 if (underestimatedStackSize > sizeof(void*))
123 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size of(void*); 117 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size of(void*);
124 m_heap = new ThreadHeap(); 118 m_heap = new ThreadHeap();
125 } else { 119 } else {
126 m_heap = &ThreadState::mainThreadState()->heap(); 120 m_heap = &ThreadState::mainThreadState()->heap();
127 } 121 }
128 ASSERT(m_heap); 122 ASSERT(m_heap);
129 m_heap->attach(this); 123 m_heap->attach(this);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 RELEASE_ASSERT(m_threadStackSize > 4 * 0x1000); 182 RELEASE_ASSERT(m_threadStackSize > 4 * 0x1000);
189 m_threadStackSize -= 4 * 0x1000; 183 m_threadStackSize -= 4 * 0x1000;
190 return m_threadStackSize; 184 return m_threadStackSize;
191 } 185 }
192 #endif 186 #endif
193 187
194 void ThreadState::attachMainThread() 188 void ThreadState::attachMainThread()
195 { 189 {
196 RELEASE_ASSERT(!ProcessHeap::s_shutdownComplete); 190 RELEASE_ASSERT(!ProcessHeap::s_shutdownComplete);
197 s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>(); 191 s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>();
198 new (s_mainThreadStateStorage) ThreadState(false); 192 new (s_mainThreadStateStorage) ThreadState();
199 } 193 }
200 194
201 void ThreadState::attachCurrentThread(bool perThreadHeapEnabled) 195 void ThreadState::attachCurrentThread()
202 { 196 {
203 RELEASE_ASSERT(!ProcessHeap::s_shutdownComplete); 197 RELEASE_ASSERT(!ProcessHeap::s_shutdownComplete);
204 new ThreadState(perThreadHeapEnabled); 198 new ThreadState();
205 } 199 }
206 200
207 void ThreadState::cleanupPages() 201 void ThreadState::cleanupPages()
208 { 202 {
209 ASSERT(checkThread()); 203 ASSERT(checkThread());
210 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i) 204 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i)
211 m_arenas[i]->cleanupPages(); 205 m_arenas[i]->cleanupPages();
212 } 206 }
213 207
214 void ThreadState::runTerminationGC() 208 void ThreadState::runTerminationGC()
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 threadDump->addScalar("dead_count", "objects", totalDeadCount); 1509 threadDump->addScalar("dead_count", "objects", totalDeadCount);
1516 threadDump->addScalar("live_size", "bytes", totalLiveSize); 1510 threadDump->addScalar("live_size", "bytes", totalLiveSize);
1517 threadDump->addScalar("dead_size", "bytes", totalDeadSize); 1511 threadDump->addScalar("dead_size", "bytes", totalDeadSize);
1518 1512
1519 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); 1513 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName);
1520 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName); 1514 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName);
1521 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid()); 1515 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid());
1522 } 1516 }
1523 1517
1524 } // namespace blink 1518 } // namespace blink
OLDNEW
« 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