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

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

Issue 1670463002: [Oilpan] Unify memory usage reporters of Oilpan (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 4 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 #endif 513 #endif
514 514
515 #if defined(LEAK_SANITIZER) 515 #if defined(LEAK_SANITIZER)
516 void registerStaticPersistentNode(PersistentNode*); 516 void registerStaticPersistentNode(PersistentNode*);
517 void releaseStaticPersistentNodes(); 517 void releaseStaticPersistentNodes();
518 518
519 void enterStaticReferenceRegistrationDisabledScope(); 519 void enterStaticReferenceRegistrationDisabledScope();
520 void leaveStaticReferenceRegistrationDisabledScope(); 520 void leaveStaticReferenceRegistrationDisabledScope();
521 #endif 521 #endif
522 522
523 void resetHeapCounters();
524 void increaseAllocatedObjectSize(size_t);
525 void decreaseAllocatedObjectSize(size_t);
526 void increaseMarkedObjectSize(size_t);
527
523 private: 528 private:
524 enum SnapshotType { 529 enum SnapshotType {
525 HeapSnapshot, 530 HeapSnapshot,
526 FreelistSnapshot 531 FreelistSnapshot
527 }; 532 };
528 533
529 ThreadState(); 534 ThreadState();
530 ~ThreadState(); 535 ~ThreadState();
531 536
532 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); 537 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 void cleanupPages(); 596 void cleanupPages();
592 597
593 void prepareForThreadStateTermination(); 598 void prepareForThreadStateTermination();
594 599
595 void invokePreFinalizers(); 600 void invokePreFinalizers();
596 601
597 void takeSnapshot(SnapshotType); 602 void takeSnapshot(SnapshotType);
598 void clearHeapAges(); 603 void clearHeapAges();
599 int heapIndexOfVectorHeapLeastRecentlyExpanded(int beginHeapIndex, int endHe apIndex); 604 int heapIndexOfVectorHeapLeastRecentlyExpanded(int beginHeapIndex, int endHe apIndex);
600 605
606 void reportMemoryToV8();
607
601 // Should only be called under protection of threadAttachMutex(). 608 // Should only be called under protection of threadAttachMutex().
602 const Vector<OwnPtr<BlinkGCInterruptor>>& interruptors() const { return m_in terruptors; } 609 const Vector<OwnPtr<BlinkGCInterruptor>>& interruptors() const { return m_in terruptors; }
603 610
604 friend class SafePointAwareMutexLocker; 611 friend class SafePointAwareMutexLocker;
605 friend class SafePointBarrier; 612 friend class SafePointBarrier;
606 friend class SafePointScope; 613 friend class SafePointScope;
607 614
608 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific; 615 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific;
609 static uintptr_t s_mainThreadStackStart; 616 static uintptr_t s_mainThreadStackStart;
610 static uintptr_t s_mainThreadUnderestimatedStackSize; 617 static uintptr_t s_mainThreadUnderestimatedStackSize;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 size_t m_disabledStaticPersistentsRegistration; 678 size_t m_disabledStaticPersistentsRegistration;
672 #endif 679 #endif
673 680
674 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will 681 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will
675 // waste memory. Thus we limit the array size to 2^8 and share one entry 682 // waste memory. Thus we limit the array size to 2^8 and share one entry
676 // with multiple types of vectors. This won't be an issue in practice, 683 // with multiple types of vectors. This won't be an issue in practice,
677 // since there will be less than 2^8 types of objects in common cases. 684 // since there will be less than 2^8 types of objects in common cases.
678 static const int likelyToBePromptlyFreedArraySize = (1 << 8); 685 static const int likelyToBePromptlyFreedArraySize = (1 << 8);
679 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA rraySize - 1; 686 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA rraySize - 1;
680 OwnPtr<int[]> m_likelyToBePromptlyFreed; 687 OwnPtr<int[]> m_likelyToBePromptlyFreed;
688
689 // Stats for heap memory of this thread.
690 size_t m_allocatedObjectSize;
691 size_t m_markedObjectSize;
692 size_t m_reportedMemoryToV8;
681 }; 693 };
682 694
683 template<ThreadAffinity affinity> class ThreadStateFor; 695 template<ThreadAffinity affinity> class ThreadStateFor;
684 696
685 template<> class ThreadStateFor<MainThreadOnly> { 697 template<> class ThreadStateFor<MainThreadOnly> {
686 STATIC_ONLY(ThreadStateFor); 698 STATIC_ONLY(ThreadStateFor);
687 public: 699 public:
688 static ThreadState* state() 700 static ThreadState* state()
689 { 701 {
690 // This specialization must only be used from the main thread. 702 // This specialization must only be used from the main thread.
691 ASSERT(ThreadState::current()->isMainThread()); 703 ASSERT(ThreadState::current()->isMainThread());
692 return ThreadState::mainThreadState(); 704 return ThreadState::mainThreadState();
693 } 705 }
694 }; 706 };
695 707
696 template<> class ThreadStateFor<AnyThread> { 708 template<> class ThreadStateFor<AnyThread> {
697 STATIC_ONLY(ThreadStateFor); 709 STATIC_ONLY(ThreadStateFor);
698 public: 710 public:
699 static ThreadState* state() { return ThreadState::current(); } 711 static ThreadState* state() { return ThreadState::current(); }
700 }; 712 };
701 713
702 } // namespace blink 714 } // namespace blink
703 715
704 #endif // ThreadState_h 716 #endif // ThreadState_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapPage.cpp ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698