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 17 matching lines...) Expand all Loading... | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "platform/heap/ThreadState.h" | 32 #include "platform/heap/ThreadState.h" |
33 | 33 |
34 #include "platform/TraceEvent.h" | 34 #include "platform/TraceEvent.h" |
35 #include "platform/heap/AddressSanitizer.h" | 35 #include "platform/heap/AddressSanitizer.h" |
36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
37 #include "platform/heap/Heap.h" | 37 #include "platform/heap/Heap.h" |
38 #include "public/platform/Platform.h" | |
38 #include "wtf/ThreadingPrimitives.h" | 39 #include "wtf/ThreadingPrimitives.h" |
39 | 40 |
40 #if OS(WIN) | 41 #if OS(WIN) |
41 #include <stddef.h> | 42 #include <stddef.h> |
42 #include <windows.h> | 43 #include <windows.h> |
43 #include <winnt.h> | 44 #include <winnt.h> |
44 #elif defined(__GLIBC__) | 45 #elif defined(__GLIBC__) |
45 extern "C" void* __libc_stack_end; // NOLINT | 46 extern "C" void* __libc_stack_end; // NOLINT |
46 #endif | 47 #endif |
47 | 48 |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
812 } | 813 } |
813 } | 814 } |
814 | 815 |
815 void ThreadState::performPendingSweep() | 816 void ThreadState::performPendingSweep() |
816 { | 817 { |
817 if (!sweepRequested()) | 818 if (!sweepRequested()) |
818 return; | 819 return; |
819 | 820 |
820 TRACE_EVENT0("Blink", "ThreadState::performPendingSweep"); | 821 TRACE_EVENT0("Blink", "ThreadState::performPendingSweep"); |
821 const char* samplingState = TRACE_EVENT_GET_SAMPLING_STATE(); | 822 const char* samplingState = TRACE_EVENT_GET_SAMPLING_STATE(); |
822 if (isMainThread()) | 823 double timeStamp = 0; |
824 if (isMainThread()) { | |
823 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "BlinkGCSweeping"); | 825 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "BlinkGCSweeping"); |
826 timeStamp = WTF::currentTimeMS(); | |
Mads Ager (chromium)
2014/05/28 09:35:45
Is histogram collection also not thread safe? It w
haraken
2014/05/28 09:40:15
It's thread-safe.
At first, I thought that if we
haraken
2014/05/28 10:40:26
Done.
| |
827 } | |
824 | 828 |
825 m_sweepInProgress = true; | 829 m_sweepInProgress = true; |
826 // Disallow allocation during weak processing. | 830 // Disallow allocation during weak processing. |
827 enterNoAllocationScope(); | 831 enterNoAllocationScope(); |
828 // Perform thread-specific weak processing. | 832 // Perform thread-specific weak processing. |
829 while (popAndInvokeWeakPointerCallback(Heap::s_markingVisitor)) { } | 833 while (popAndInvokeWeakPointerCallback(Heap::s_markingVisitor)) { } |
830 leaveNoAllocationScope(); | 834 leaveNoAllocationScope(); |
831 // Perform sweeping and finalization. | 835 // Perform sweeping and finalization. |
832 m_stats.clear(); // Sweeping will recalculate the stats | 836 m_stats.clear(); // Sweeping will recalculate the stats |
833 for (int i = 0; i < NumberOfHeaps; i++) | 837 for (int i = 0; i < NumberOfHeaps; i++) |
834 m_heaps[i]->sweep(); | 838 m_heaps[i]->sweep(); |
835 getStats(m_statsAfterLastGC); | 839 getStats(m_statsAfterLastGC); |
836 m_sweepInProgress = false; | 840 m_sweepInProgress = false; |
837 clearGCRequested(); | 841 clearGCRequested(); |
838 clearSweepRequested(); | 842 clearSweepRequested(); |
839 | 843 |
840 if (isMainThread()) | 844 if (isMainThread()) { |
841 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(samplingState); | 845 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(samplingState); |
846 if (blink::Platform::current()) { | |
847 blink::Platform::current()->histogramEnumeration("BlinkGC.PerformPen dingSweep", WTF::currentTimeMS() - timeStamp, 30000); | |
848 } | |
849 } | |
842 } | 850 } |
843 | 851 |
844 void ThreadState::addInterruptor(Interruptor* interruptor) | 852 void ThreadState::addInterruptor(Interruptor* interruptor) |
845 { | 853 { |
846 SafePointScope scope(HeapPointersOnStack, SafePointScope::AllowNesting); | 854 SafePointScope scope(HeapPointersOnStack, SafePointScope::AllowNesting); |
847 | 855 |
848 { | 856 { |
849 MutexLocker locker(threadAttachMutex()); | 857 MutexLocker locker(threadAttachMutex()); |
850 m_interruptors.append(interruptor); | 858 m_interruptors.append(interruptor); |
851 } | 859 } |
(...skipping 19 matching lines...) Expand all Loading... | |
871 state->safePoint(HeapPointersOnStack); | 879 state->safePoint(HeapPointersOnStack); |
872 } | 880 } |
873 | 881 |
874 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads() | 882 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads() |
875 { | 883 { |
876 DEFINE_STATIC_LOCAL(AttachedThreadStateSet, threads, ()); | 884 DEFINE_STATIC_LOCAL(AttachedThreadStateSet, threads, ()); |
877 return threads; | 885 return threads; |
878 } | 886 } |
879 | 887 |
880 } | 888 } |
OLD | NEW |