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

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

Issue 2687833002: Remove prepareForThreadStateTermination() (Closed)
Patch Set: Created 3 years, 10 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 m_safePointScopeMarker(nullptr), 146 m_safePointScopeMarker(nullptr),
147 m_atSafePoint(false), 147 m_atSafePoint(false),
148 m_interruptors(), 148 m_interruptors(),
149 m_sweepForbidden(false), 149 m_sweepForbidden(false),
150 m_noAllocationCount(0), 150 m_noAllocationCount(0),
151 m_gcForbiddenCount(0), 151 m_gcForbiddenCount(0),
152 m_mixinsBeingConstructedCount(0), 152 m_mixinsBeingConstructedCount(0),
153 m_accumulatedSweepingTime(0), 153 m_accumulatedSweepingTime(0),
154 m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex), 154 m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex),
155 m_currentArenaAges(0), 155 m_currentArenaAges(0),
156 m_isTerminating(false),
157 m_gcMixinMarker(nullptr), 156 m_gcMixinMarker(nullptr),
158 m_shouldFlushHeapDoesNotContainCache(false), 157 m_shouldFlushHeapDoesNotContainCache(false),
159 m_gcState(NoGCScheduled), 158 m_gcState(NoGCScheduled),
160 m_threadLocalWeakCallbackStack(CallbackStack::create()), 159 m_threadLocalWeakCallbackStack(CallbackStack::create()),
161 m_isolate(nullptr), 160 m_isolate(nullptr),
162 m_traceDOMWrappers(nullptr), 161 m_traceDOMWrappers(nullptr),
163 m_invalidateDeadObjectsInWrappersMarkingDeque(nullptr), 162 m_invalidateDeadObjectsInWrappersMarkingDeque(nullptr),
164 #if defined(ADDRESS_SANITIZER) 163 #if defined(ADDRESS_SANITIZER)
165 m_asanFakeStack(__asan_get_current_fake_stack()), 164 m_asanFakeStack(__asan_get_current_fake_stack()),
166 #endif 165 #endif
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 removeAllPages(); 216 removeAllPages();
218 return; 217 return;
219 } 218 }
220 ASSERT(checkThread()); 219 ASSERT(checkThread());
221 220
222 // Finish sweeping. 221 // Finish sweeping.
223 completeSweep(); 222 completeSweep();
224 223
225 releaseStaticPersistentNodes(); 224 releaseStaticPersistentNodes();
226 225
227 // From here on ignore all conservatively discovered
228 // pointers into the heap owned by this thread.
229 m_isTerminating = true;
230
231 // Set the terminate flag on all heap pages of this thread. This is used to
232 // ensure we don't trace pages on other threads that are not part of the
233 // thread local GC.
234 // TODO(haraken): Remove this. This is not needed once we remove a thread-
235 // local termination GC.
236 prepareForThreadStateTermination();
237
238 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination( 226 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination(
239 this); 227 this);
240 228
241 // Do thread local GC's as long as the count of thread local Persistents 229 // Do thread local GC's as long as the count of thread local Persistents
242 // changes and is above zero. 230 // changes and is above zero.
243 int oldCount = -1; 231 int oldCount = -1;
244 int currentCount = getPersistentRegion()->numberOfPersistents(); 232 int currentCount = getPersistentRegion()->numberOfPersistents();
245 ASSERT(currentCount >= 0); 233 ASSERT(currentCount >= 0);
246 while (currentCount != oldCount) { 234 while (currentCount != oldCount) {
247 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, 235 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep,
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 break; 1181 break;
1194 case SweepingAndIdleGCScheduled: 1182 case SweepingAndIdleGCScheduled:
1195 setGCState(NoGCScheduled); 1183 setGCState(NoGCScheduled);
1196 scheduleIdleGC(); 1184 scheduleIdleGC();
1197 break; 1185 break;
1198 default: 1186 default:
1199 ASSERT_NOT_REACHED(); 1187 ASSERT_NOT_REACHED();
1200 } 1188 }
1201 } 1189 }
1202 1190
1203 void ThreadState::prepareForThreadStateTermination() {
1204 ASSERT(checkThread());
1205 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i)
1206 m_arenas[i]->prepareHeapForTermination();
1207 }
1208
1209 #if DCHECK_IS_ON() 1191 #if DCHECK_IS_ON()
1210 BasePage* ThreadState::findPageFromAddress(Address address) { 1192 BasePage* ThreadState::findPageFromAddress(Address address) {
1211 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i) { 1193 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i) {
1212 if (BasePage* page = m_arenas[i]->findPageFromAddress(address)) 1194 if (BasePage* page = m_arenas[i]->findPageFromAddress(address))
1213 return page; 1195 return page;
1214 } 1196 }
1215 return nullptr; 1197 return nullptr;
1216 } 1198 }
1217 #endif 1199 #endif
1218 1200
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, 1725 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep,
1744 BlinkGC::ForcedGC); 1726 BlinkGC::ForcedGC);
1745 size_t liveObjects = heap().heapStats().markedObjectSize(); 1727 size_t liveObjects = heap().heapStats().markedObjectSize();
1746 if (liveObjects == previousLiveObjects) 1728 if (liveObjects == previousLiveObjects)
1747 break; 1729 break;
1748 previousLiveObjects = liveObjects; 1730 previousLiveObjects = liveObjects;
1749 } 1731 }
1750 } 1732 }
1751 1733
1752 } // namespace blink 1734 } // 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