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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
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 #ifndef ThreadState_h | 31 #ifndef ThreadState_h |
32 #define ThreadState_h | 32 #define ThreadState_h |
33 | 33 |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/heap/AddressSanitizer.h" | 35 #include "platform/heap/AddressSanitizer.h" |
| 36 #include "platform/heap/Profiling.h" |
36 #include "wtf/HashSet.h" | 37 #include "wtf/HashSet.h" |
37 #include "wtf/OwnPtr.h" | 38 #include "wtf/OwnPtr.h" |
38 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
39 #include "wtf/ThreadSpecific.h" | 40 #include "wtf/ThreadSpecific.h" |
40 #include "wtf/Threading.h" | 41 #include "wtf/Threading.h" |
41 #include "wtf/ThreadingPrimitives.h" | 42 #include "wtf/ThreadingPrimitives.h" |
42 #include "wtf/Vector.h" | 43 #include "wtf/Vector.h" |
43 | 44 |
| 45 #if GC_PROFILE_HEAP |
| 46 #include "wtf/HashMap.h" |
| 47 #endif |
| 48 |
44 namespace WebCore { | 49 namespace WebCore { |
45 | 50 |
46 class BaseHeap; | 51 class BaseHeap; |
47 class BaseHeapPage; | 52 class BaseHeapPage; |
48 class FinalizedHeapObjectHeader; | 53 class FinalizedHeapObjectHeader; |
49 struct GCInfo; | 54 struct GCInfo; |
50 class HeapContainsCache; | 55 class HeapContainsCache; |
51 class HeapObjectHeader; | 56 class HeapObjectHeader; |
52 class PersistentNode; | 57 class PersistentNode; |
53 class Visitor; | 58 class Visitor; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 // real machine stack if there is one. | 493 // real machine stack if there is one. |
489 void visitAsanFakeStackForPointer(Visitor*, Address); | 494 void visitAsanFakeStackForPointer(Visitor*, Address); |
490 | 495 |
491 // Visit all persistents allocated on this thread. | 496 // Visit all persistents allocated on this thread. |
492 void visitPersistents(Visitor*); | 497 void visitPersistents(Visitor*); |
493 | 498 |
494 // Checks a given address and if a pointer into the oilpan heap marks | 499 // Checks a given address and if a pointer into the oilpan heap marks |
495 // the object to which it points. | 500 // the object to which it points. |
496 bool checkAndMarkPointer(Visitor*, Address); | 501 bool checkAndMarkPointer(Visitor*, Address); |
497 | 502 |
498 #if ENABLE(GC_TRACING) | 503 #if GC_PROFILE_MARKING |
499 const GCInfo* findGCInfo(Address); | 504 const GCInfo* findGCInfo(Address); |
500 static const GCInfo* findGCInfoFromAllThreads(Address); | 505 static const GCInfo* findGCInfoFromAllThreads(Address); |
501 #endif | 506 #endif |
502 | 507 |
| 508 #if GC_PROFILE_HEAP |
| 509 struct SnapshotInfo { |
| 510 ThreadState* state; |
| 511 |
| 512 size_t liveSize; |
| 513 size_t deadSize; |
| 514 size_t freeSize; |
| 515 size_t pageCount; |
| 516 |
| 517 // Map from base-classes to a snapshot class-ids (used as index below). |
| 518 HashMap<const GCInfo*, size_t> classTags; |
| 519 |
| 520 // Map from class-id (index) to count. |
| 521 Vector<int> liveCount; |
| 522 Vector<int> deadCount; |
| 523 |
| 524 // Map from class-id (index) to a vector of generation counts. |
| 525 // For i < 7, the count is the number of objects that died after survivi
ng |i| GCs. |
| 526 // For i == 7, the count is the number of objects that survived at least
7 GCs. |
| 527 Vector<Vector<int, 8> > generations; |
| 528 |
| 529 SnapshotInfo(ThreadState* state) : state(state), liveSize(0), deadSize(0
), freeSize(0), pageCount(0) { } |
| 530 |
| 531 size_t getClassTag(const GCInfo*); |
| 532 }; |
| 533 |
| 534 void snapshot(); |
| 535 #endif |
| 536 |
503 void pushWeakObjectPointerCallback(void*, WeakPointerCallback); | 537 void pushWeakObjectPointerCallback(void*, WeakPointerCallback); |
504 bool popAndInvokeWeakPointerCallback(Visitor*); | 538 bool popAndInvokeWeakPointerCallback(Visitor*); |
505 | 539 |
506 void getStats(HeapStats&); | 540 void getStats(HeapStats&); |
507 HeapStats& stats() { return m_stats; } | 541 HeapStats& stats() { return m_stats; } |
508 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; } | 542 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; } |
509 | 543 |
510 private: | 544 private: |
511 explicit ThreadState(); | 545 explicit ThreadState(); |
512 ~ThreadState(); | 546 ~ThreadState(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 m_locked = false; | 687 m_locked = false; |
654 } | 688 } |
655 | 689 |
656 Mutex& m_mutex; | 690 Mutex& m_mutex; |
657 bool m_locked; | 691 bool m_locked; |
658 }; | 692 }; |
659 | 693 |
660 } | 694 } |
661 | 695 |
662 #endif // ThreadState_h | 696 #endif // ThreadState_h |
OLD | NEW |