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

Side by Side Diff: Source/heap/ThreadState.h

Issue 100433005: [oilpan] Rename PauseScope to SafePointScope (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years 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 | Annotate | Revision Log
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 bool contains(void* pointer) { return contains(reinterpret_cast<Address>(poi nter)); } 177 bool contains(void* pointer) { return contains(reinterpret_cast<Address>(poi nter)); }
178 bool contains(const void* pointer) { return contains(const_cast<void*>(point er)); } 178 bool contains(const void* pointer) { return contains(const_cast<void*>(point er)); }
179 BaseHeapPage* heapPageFromAddress(Address); 179 BaseHeapPage* heapPageFromAddress(Address);
180 180
181 bool isAllocationAllowed() const { return !m_noAllocationCount; } 181 bool isAllocationAllowed() const { return !m_noAllocationCount; }
182 void enterNoAllocationScope() { m_noAllocationCount++; } 182 void enterNoAllocationScope() { m_noAllocationCount++; }
183 void leaveNoAllocationScope() { m_noAllocationCount--; } 183 void leaveNoAllocationScope() { m_noAllocationCount--; }
184 184
185 void executePendingAction(); 185 void executePendingAction();
186 186
187 void paused(StackState); 187 void enterSafePoint(StackState);
188 void resumed(); 188 void leaveSafePoint();
189 bool isPaused() const { return m_isPaused; } 189 bool isInSafePoint() const { return m_inSafePoint; }
190 190
191 bool shouldGC(); 191 bool shouldGC();
192 bool shouldForceConservativeGC(); 192 bool shouldForceConservativeGC();
193 bool isInGC() const { return m_inGC; } 193 bool isInGC() const { return m_inGC; }
194 void enterGC() 194 void enterGC()
195 { 195 {
196 if (!m_inGC++) 196 if (!m_inGC++)
197 s_inGC = true; 197 s_inGC = true;
198 } 198 }
199 void leaveGC() 199 void leaveGC()
(...skipping 27 matching lines...) Expand all
227 227
228 static ThreadState* Current(); 228 static ThreadState* Current();
229 static ThreadState* MainThreadState() { return &s_mainThreadState; } 229 static ThreadState* MainThreadState() { return &s_mainThreadState; }
230 static bool IsMainThread() { return Current() == MainThreadState(); } 230 static bool IsMainThread() { return Current() == MainThreadState(); }
231 231
232 static void stopThreads(StackState); 232 static void stopThreads(StackState);
233 static void resumeThreads(); 233 static void resumeThreads();
234 234
235 void safePoint(); 235 void safePoint();
236 236
237 class PauseScope { 237 class SafePointScope {
238 public: 238 public:
239 PauseScope(StackState stackState) { ThreadState::Current()->paused(stack State); } 239 SafePointScope(StackState stackState) { ThreadState::Current()->enterSaf ePoint(stackState); }
240 ~PauseScope() { ThreadState::Current()->resumed(); } 240 ~SafePointScope() { ThreadState::Current()->leaveSafePoint(); }
241 }; 241 };
242 242
243 void visitStack(Visitor*); 243 void visitStack(Visitor*);
244 void visitPersistents(Visitor*); 244 void visitPersistents(Visitor*);
245 bool checkAndVisitPointer(Visitor*, Address); 245 bool checkAndVisitPointer(Visitor*, Address);
246 bool isConsistentForGC(); 246 bool isConsistentForGC();
247 void makeConsistentForGC(); 247 void makeConsistentForGC();
248 void getStats(HeapStats&); 248 void getStats(HeapStats&);
249 HeapStats& stats() { return m_stats; } 249 HeapStats& stats() { return m_stats; }
250 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; } 250 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; }
(...skipping 28 matching lines...) Expand all
279 static SafePointBarrier* s_safePointBarrier; 279 static SafePointBarrier* s_safePointBarrier;
280 // This variable is flipped to true after all threads are stoped and outermo st GC has started. 280 // This variable is flipped to true after all threads are stoped and outermo st GC has started.
281 static bool s_inGC; 281 static bool s_inGC;
282 282
283 void create(intptr_t* startOfStack); 283 void create(intptr_t* startOfStack);
284 void destroy(); 284 void destroy();
285 void trace(Visitor*); 285 void trace(Visitor*);
286 bool pointersOnStack() const { return m_stackState == HeapPointersOnStack; } 286 bool pointersOnStack() const { return m_stackState == HeapPointersOnStack; }
287 287
288 ThreadIdentifier m_thread; 288 ThreadIdentifier m_thread;
289 bool m_isPaused; 289 bool m_inSafePoint;
Mads Ager (chromium) 2013/12/05 09:22:24 m_atSafePoint?
290 int m_inGC; 290 int m_inGC;
291 PersistentNode* m_persistents; 291 PersistentNode* m_persistents;
292 StackState m_stackState; 292 StackState m_stackState;
293 intptr_t* m_startOfStack; 293 intptr_t* m_startOfStack;
294 intptr_t* m_endOfStack; 294 intptr_t* m_endOfStack;
295 HeapContainsCache* m_heapContainsCache; 295 HeapContainsCache* m_heapContainsCache;
296 BaseHeap* m_heaps[NumberOfHeaps]; 296 BaseHeap* m_heaps[NumberOfHeaps];
297 PendingAction m_pendingAction; 297 PendingAction m_pendingAction;
298 size_t m_noAllocationCount; 298 size_t m_noAllocationCount;
299 bool m_sweepInProgress; 299 bool m_sweepInProgress;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WTF, Int32Array); 393 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WTF, Int32Array);
394 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WTF, Uint32Array); 394 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WTF, Uint32Array);
395 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WTF, Float32Array); 395 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WTF, Float32Array);
396 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WTF, Float64Array); 396 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WTF, Float64Array);
397 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WebKit, IDBCallbacksProxy); 397 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WebKit, IDBCallbacksProxy);
398 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WebKit, IDBDatabaseBackendProxy); 398 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WebKit, IDBDatabaseBackendProxy);
399 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WebKit, IDBDatabaseCallbacksProxy); 399 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WebKit, IDBDatabaseCallbacksProxy);
400 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WebKit, IDBFactoryBackendProxy); 400 REQUIRE_THREADSAFE_HANDLES_WITH_NAMESPACE(WebKit, IDBFactoryBackendProxy);
401 401
402 #endif 402 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698