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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Heap.h

Issue 2697703005: Remove ThreadHeap::m_threads (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
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 size_t m_objectSizeAtLastGC; 213 size_t m_objectSizeAtLastGC;
214 size_t m_markedObjectSize; 214 size_t m_markedObjectSize;
215 size_t m_markedObjectSizeAtLastCompleteSweep; 215 size_t m_markedObjectSizeAtLastCompleteSweep;
216 size_t m_wrapperCount; 216 size_t m_wrapperCount;
217 size_t m_wrapperCountAtLastGC; 217 size_t m_wrapperCountAtLastGC;
218 size_t m_collectedWrapperCount; 218 size_t m_collectedWrapperCount;
219 size_t m_partitionAllocSizeAtLastGC; 219 size_t m_partitionAllocSizeAtLastGC;
220 double m_estimatedMarkingTimePerByte; 220 double m_estimatedMarkingTimePerByte;
221 }; 221 };
222 222
223 using ThreadStateSet = HashSet<ThreadState*>;
224
225 class PLATFORM_EXPORT ThreadHeap { 223 class PLATFORM_EXPORT ThreadHeap {
226 public: 224 public:
227 ThreadHeap(); 225 ThreadHeap();
228 ~ThreadHeap(); 226 ~ThreadHeap();
229 227
230 // Returns true for main thread's heap. 228 // Returns true for main thread's heap.
231 // TODO(keishi): Per-thread-heap will return false. 229 // TODO(keishi): Per-thread-heap will return false.
232 bool isMainThreadHeap() { return this == ThreadHeap::mainThreadHeap(); } 230 bool isMainThreadHeap() { return this == ThreadHeap::mainThreadHeap(); }
233 static ThreadHeap* mainThreadHeap() { return s_mainThreadHeap; } 231 static ThreadHeap* mainThreadHeap() { return s_mainThreadHeap; }
234 232
(...skipping 29 matching lines...) Expand all
264 static inline bool isHeapObjectAlive(const WeakMember<T>& member) { 262 static inline bool isHeapObjectAlive(const WeakMember<T>& member) {
265 return isHeapObjectAlive(member.get()); 263 return isHeapObjectAlive(member.get());
266 } 264 }
267 template <typename T> 265 template <typename T>
268 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) { 266 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) {
269 return isHeapObjectAlive(member.get()); 267 return isHeapObjectAlive(member.get());
270 } 268 }
271 269
272 StackFrameDepth& stackFrameDepth() { return m_stackFrameDepth; } 270 StackFrameDepth& stackFrameDepth() { return m_stackFrameDepth; }
273 271
274 RecursiveMutex& threadAttachMutex() { return m_threadAttachMutex; }
275 const ThreadStateSet& threads() const { return m_threads; }
276 ThreadHeapStats& heapStats() { return m_stats; } 272 ThreadHeapStats& heapStats() { return m_stats; }
277 SafePointBarrier* safePointBarrier() { return m_safePointBarrier.get(); } 273 SafePointBarrier* safePointBarrier() { return m_safePointBarrier.get(); }
278 CallbackStack* markingStack() const { return m_markingStack.get(); } 274 CallbackStack* markingStack() const { return m_markingStack.get(); }
279 CallbackStack* postMarkingCallbackStack() const { 275 CallbackStack* postMarkingCallbackStack() const {
280 return m_postMarkingCallbackStack.get(); 276 return m_postMarkingCallbackStack.get();
281 } 277 }
282 CallbackStack* globalWeakCallbackStack() const { 278 CallbackStack* globalWeakCallbackStack() const {
283 return m_globalWeakCallbackStack.get(); 279 return m_globalWeakCallbackStack.get();
284 } 280 }
285 CallbackStack* ephemeronStack() const { return m_ephemeronStack.get(); } 281 CallbackStack* ephemeronStack() const { return m_ephemeronStack.get(); }
286 282
287 void attach(ThreadState*); 283 void attach(ThreadState*);
288 void detach(ThreadState*); 284 void detach(ThreadState*);
289 void lockThreadAttachMutex();
290 void unlockThreadAttachMutex();
291 285
292 void visitPersistentRoots(Visitor*); 286 void visitPersistentRoots(Visitor*);
293 void visitStackRoots(Visitor*); 287 void visitStackRoots(Visitor*);
294 void enterSafePoint(ThreadState*); 288 void enterSafePoint(ThreadState*);
295 void leaveSafePoint(); 289 void leaveSafePoint();
296 290
297 static RecursiveMutex& allHeapsMutex(); 291 static RecursiveMutex& allHeapsMutex();
298 static HashSet<ThreadHeap*>& allHeaps(); 292 static HashSet<ThreadHeap*>& allHeaps();
299 293
300 // Is the finalizable GC object still alive, but slated for lazy sweeping? 294 // Is the finalizable GC object still alive, but slated for lazy sweeping?
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 private: 446 private:
453 // Reset counters that track live and allocated-since-last-GC sizes. 447 // Reset counters that track live and allocated-since-last-GC sizes.
454 void resetHeapCounters(); 448 void resetHeapCounters();
455 449
456 static int arenaIndexForObjectSize(size_t); 450 static int arenaIndexForObjectSize(size_t);
457 static bool isNormalArenaIndex(int); 451 static bool isNormalArenaIndex(int);
458 452
459 void commitCallbackStacks(); 453 void commitCallbackStacks();
460 void decommitCallbackStacks(); 454 void decommitCallbackStacks();
461 455
462 RecursiveMutex m_threadAttachMutex; 456 ThreadState* m_threadState;
463 ThreadStateSet m_threads;
464 ThreadHeapStats m_stats; 457 ThreadHeapStats m_stats;
465 std::unique_ptr<RegionTree> m_regionTree; 458 std::unique_ptr<RegionTree> m_regionTree;
466 std::unique_ptr<HeapDoesNotContainCache> m_heapDoesNotContainCache; 459 std::unique_ptr<HeapDoesNotContainCache> m_heapDoesNotContainCache;
467 std::unique_ptr<SafePointBarrier> m_safePointBarrier; 460 std::unique_ptr<SafePointBarrier> m_safePointBarrier;
468 std::unique_ptr<PagePool> m_freePagePool; 461 std::unique_ptr<PagePool> m_freePagePool;
469 std::unique_ptr<CallbackStack> m_markingStack; 462 std::unique_ptr<CallbackStack> m_markingStack;
470 std::unique_ptr<CallbackStack> m_postMarkingCallbackStack; 463 std::unique_ptr<CallbackStack> m_postMarkingCallbackStack;
471 std::unique_ptr<CallbackStack> m_globalWeakCallbackStack; 464 std::unique_ptr<CallbackStack> m_globalWeakCallbackStack;
472 std::unique_ptr<CallbackStack> m_ephemeronStack; 465 std::unique_ptr<CallbackStack> m_ephemeronStack;
473 BlinkGC::GCReason m_lastGCReason; 466 BlinkGC::GCReason m_lastGCReason;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 T** cell = reinterpret_cast<T**>(object); 676 T** cell = reinterpret_cast<T**>(object);
684 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) 677 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell))
685 *cell = nullptr; 678 *cell = nullptr;
686 } 679 }
687 680
688 } // namespace blink 681 } // namespace blink
689 682
690 #include "platform/heap/VisitorImpl.h" 683 #include "platform/heap/VisitorImpl.h"
691 684
692 #endif // Heap_h 685 #endif // Heap_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/Heap.cpp » ('j') | third_party/WebKit/Source/platform/heap/Heap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698