| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 m_state->m_sweepForbidden = false; | 158 m_state->m_sweepForbidden = false; |
| 159 } | 159 } |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 ThreadState* m_state; | 162 ThreadState* m_state; |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 void lockThreadAttachMutex(); | 165 void lockThreadAttachMutex(); |
| 166 void unlockThreadAttachMutex(); | 166 void unlockThreadAttachMutex(); |
| 167 | 167 |
| 168 bool isTerminating() { return m_isTerminating; } | |
| 169 | |
| 170 static void attachMainThread(); | 168 static void attachMainThread(); |
| 171 | 169 |
| 172 // Associate ThreadState object with the current thread. After this | 170 // Associate ThreadState object with the current thread. After this |
| 173 // call thread can start using the garbage collected heap infrastructure. | 171 // call thread can start using the garbage collected heap infrastructure. |
| 174 // It also has to periodically check for safepoints. | 172 // It also has to periodically check for safepoints. |
| 175 static void attachCurrentThread(); | 173 static void attachCurrentThread(); |
| 176 | 174 |
| 177 // Disassociate attached ThreadState from the current thread. The thread | 175 // Disassociate attached ThreadState from the current thread. The thread |
| 178 // can no longer use the garbage collected heap after this call. | 176 // can no longer use the garbage collected heap after this call. |
| 179 static void detachCurrentThread(); | 177 static void detachCurrentThread(); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 602 |
| 605 void eagerSweep(); | 603 void eagerSweep(); |
| 606 | 604 |
| 607 #if defined(ADDRESS_SANITIZER) | 605 #if defined(ADDRESS_SANITIZER) |
| 608 void poisonEagerArena(); | 606 void poisonEagerArena(); |
| 609 void poisonAllHeaps(); | 607 void poisonAllHeaps(); |
| 610 #endif | 608 #endif |
| 611 | 609 |
| 612 void removeAllPages(); | 610 void removeAllPages(); |
| 613 | 611 |
| 614 void prepareForThreadStateTermination(); | |
| 615 | |
| 616 void invokePreFinalizers(); | 612 void invokePreFinalizers(); |
| 617 | 613 |
| 618 void takeSnapshot(SnapshotType); | 614 void takeSnapshot(SnapshotType); |
| 619 void clearArenaAges(); | 615 void clearArenaAges(); |
| 620 int arenaIndexOfVectorArenaLeastRecentlyExpanded(int beginArenaIndex, | 616 int arenaIndexOfVectorArenaLeastRecentlyExpanded(int beginArenaIndex, |
| 621 int endArenaIndex); | 617 int endArenaIndex); |
| 622 | 618 |
| 623 void reportMemoryToV8(); | 619 void reportMemoryToV8(); |
| 624 | 620 |
| 625 // Should only be called under protection of threadAttachMutex(). | 621 // Should only be called under protection of threadAttachMutex(). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 size_t m_noAllocationCount; | 653 size_t m_noAllocationCount; |
| 658 size_t m_gcForbiddenCount; | 654 size_t m_gcForbiddenCount; |
| 659 size_t m_mixinsBeingConstructedCount; | 655 size_t m_mixinsBeingConstructedCount; |
| 660 double m_accumulatedSweepingTime; | 656 double m_accumulatedSweepingTime; |
| 661 | 657 |
| 662 BaseArena* m_arenas[BlinkGC::NumberOfArenas]; | 658 BaseArena* m_arenas[BlinkGC::NumberOfArenas]; |
| 663 int m_vectorBackingArenaIndex; | 659 int m_vectorBackingArenaIndex; |
| 664 size_t m_arenaAges[BlinkGC::NumberOfArenas]; | 660 size_t m_arenaAges[BlinkGC::NumberOfArenas]; |
| 665 size_t m_currentArenaAges; | 661 size_t m_currentArenaAges; |
| 666 | 662 |
| 667 bool m_isTerminating; | |
| 668 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; | 663 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; |
| 669 | 664 |
| 670 bool m_shouldFlushHeapDoesNotContainCache; | 665 bool m_shouldFlushHeapDoesNotContainCache; |
| 671 GCState m_gcState; | 666 GCState m_gcState; |
| 672 | 667 |
| 673 std::unique_ptr<CallbackStack> m_threadLocalWeakCallbackStack; | 668 std::unique_ptr<CallbackStack> m_threadLocalWeakCallbackStack; |
| 674 | 669 |
| 675 using PreFinalizerCallback = bool (*)(void*); | 670 using PreFinalizerCallback = bool (*)(void*); |
| 676 using PreFinalizer = std::pair<void*, PreFinalizerCallback>; | 671 using PreFinalizer = std::pair<void*, PreFinalizerCallback>; |
| 677 | 672 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 class ThreadStateFor<AnyThread> { | 729 class ThreadStateFor<AnyThread> { |
| 735 STATIC_ONLY(ThreadStateFor); | 730 STATIC_ONLY(ThreadStateFor); |
| 736 | 731 |
| 737 public: | 732 public: |
| 738 static ThreadState* state() { return ThreadState::current(); } | 733 static ThreadState* state() { return ThreadState::current(); } |
| 739 }; | 734 }; |
| 740 | 735 |
| 741 } // namespace blink | 736 } // namespace blink |
| 742 | 737 |
| 743 #endif // ThreadState_h | 738 #endif // ThreadState_h |
| OLD | NEW |