OLD | NEW |
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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 return m_heaps[heapIndex]; | 645 return m_heaps[heapIndex]; |
646 } | 646 } |
647 BaseHeap* expandedVectorBackingHeap(size_t gcInfoIndex); | 647 BaseHeap* expandedVectorBackingHeap(size_t gcInfoIndex); |
648 static bool isVectorHeapIndex(int heapIndex) | 648 static bool isVectorHeapIndex(int heapIndex) |
649 { | 649 { |
650 return Vector1HeapIndex <= heapIndex && heapIndex <= Vector4HeapIndex; | 650 return Vector1HeapIndex <= heapIndex && heapIndex <= Vector4HeapIndex; |
651 } | 651 } |
652 void allocationPointAdjusted(int heapIndex); | 652 void allocationPointAdjusted(int heapIndex); |
653 void promptlyFreed(size_t gcInfoIndex); | 653 void promptlyFreed(size_t gcInfoIndex); |
654 | 654 |
| 655 #if ENABLE(ASSERT) |
| 656 static void incrementSelfKeepAliveAllocations(); |
| 657 static void decrementSelfKeepAliveAllocations(); |
| 658 #endif |
| 659 |
655 private: | 660 private: |
656 enum SnapshotType { | 661 enum SnapshotType { |
657 HeapSnapshot, | 662 HeapSnapshot, |
658 FreelistSnapshot | 663 FreelistSnapshot |
659 }; | 664 }; |
660 | 665 |
661 ThreadState(); | 666 ThreadState(); |
662 ~ThreadState(); | 667 ~ThreadState(); |
663 | 668 |
664 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 669 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 const InterruptorVector& interruptors() const { return m_interruptors; } | 726 const InterruptorVector& interruptors() const { return m_interruptors; } |
722 | 727 |
723 friend class SafePointAwareMutexLocker; | 728 friend class SafePointAwareMutexLocker; |
724 friend class SafePointBarrier; | 729 friend class SafePointBarrier; |
725 friend class SafePointScope; | 730 friend class SafePointScope; |
726 | 731 |
727 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific; | 732 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific; |
728 static uintptr_t s_mainThreadStackStart; | 733 static uintptr_t s_mainThreadStackStart; |
729 static uintptr_t s_mainThreadUnderestimatedStackSize; | 734 static uintptr_t s_mainThreadUnderestimatedStackSize; |
730 static SafePointBarrier* s_safePointBarrier; | 735 static SafePointBarrier* s_safePointBarrier; |
| 736 #if ENABLE(ASSERT) |
| 737 static int s_selfKeepAliveAllocationsOnMainThread; |
| 738 #endif |
731 | 739 |
732 // We can't create a static member of type ThreadState here | 740 // We can't create a static member of type ThreadState here |
733 // because it will introduce global constructor and destructor. | 741 // because it will introduce global constructor and destructor. |
734 // We would like to manage lifetime of the ThreadState attached | 742 // We would like to manage lifetime of the ThreadState attached |
735 // to the main thread explicitly instead and still use normal | 743 // to the main thread explicitly instead and still use normal |
736 // constructor and destructor for the ThreadState class. | 744 // constructor and destructor for the ThreadState class. |
737 // For this we reserve static storage for the main ThreadState | 745 // For this we reserve static storage for the main ThreadState |
738 // and lazily construct ThreadState in it using placement new. | 746 // and lazily construct ThreadState in it using placement new. |
739 static uint8_t s_mainThreadStateStorage[]; | 747 static uint8_t s_mainThreadStateStorage[]; |
740 | 748 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 }; | 811 }; |
804 | 812 |
805 template<> class ThreadStateFor<AnyThread> { | 813 template<> class ThreadStateFor<AnyThread> { |
806 public: | 814 public: |
807 static ThreadState* state() { return ThreadState::current(); } | 815 static ThreadState* state() { return ThreadState::current(); } |
808 }; | 816 }; |
809 | 817 |
810 } // namespace blink | 818 } // namespace blink |
811 | 819 |
812 #endif // ThreadState_h | 820 #endif // ThreadState_h |
OLD | NEW |