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 23 matching lines...) Expand all Loading... |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/heap/AddressSanitizer.h" | 35 #include "platform/heap/AddressSanitizer.h" |
36 #include "wtf/HashSet.h" | 36 #include "wtf/HashSet.h" |
37 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
39 #include "wtf/ThreadSpecific.h" | 39 #include "wtf/ThreadSpecific.h" |
40 #include "wtf/Threading.h" | 40 #include "wtf/Threading.h" |
41 #include "wtf/ThreadingPrimitives.h" | 41 #include "wtf/ThreadingPrimitives.h" |
42 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
43 | 43 |
| 44 #if ENABLE(GC_PROFILE_HEAP) |
| 45 #include "wtf/HashMap.h" |
| 46 #endif |
| 47 |
44 namespace blink { | 48 namespace blink { |
45 | 49 |
46 class BaseHeap; | 50 class BaseHeap; |
47 class BaseHeapPage; | 51 class BaseHeapPage; |
48 class FinalizedHeapObjectHeader; | 52 class FinalizedHeapObjectHeader; |
49 struct GCInfo; | 53 struct GCInfo; |
50 class HeapContainsCache; | 54 class HeapContainsCache; |
51 class HeapObjectHeader; | 55 class HeapObjectHeader; |
52 class PageMemory; | 56 class PageMemory; |
53 class PersistentNode; | 57 class PersistentNode; |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 // real machine stack if there is one. | 496 // real machine stack if there is one. |
493 void visitAsanFakeStackForPointer(Visitor*, Address); | 497 void visitAsanFakeStackForPointer(Visitor*, Address); |
494 | 498 |
495 // Visit all persistents allocated on this thread. | 499 // Visit all persistents allocated on this thread. |
496 void visitPersistents(Visitor*); | 500 void visitPersistents(Visitor*); |
497 | 501 |
498 // Checks a given address and if a pointer into the oilpan heap marks | 502 // Checks a given address and if a pointer into the oilpan heap marks |
499 // the object to which it points. | 503 // the object to which it points. |
500 bool checkAndMarkPointer(Visitor*, Address); | 504 bool checkAndMarkPointer(Visitor*, Address); |
501 | 505 |
502 #if ENABLE(GC_TRACING) | 506 #if ENABLE(GC_PROFILE_MARKING) |
503 const GCInfo* findGCInfo(Address); | 507 const GCInfo* findGCInfo(Address); |
504 static const GCInfo* findGCInfoFromAllThreads(Address); | 508 static const GCInfo* findGCInfoFromAllThreads(Address); |
505 #endif | 509 #endif |
506 | 510 |
| 511 #if ENABLE(GC_PROFILE_HEAP) |
| 512 struct SnapshotInfo { |
| 513 ThreadState* state; |
| 514 |
| 515 size_t liveSize; |
| 516 size_t deadSize; |
| 517 size_t freeSize; |
| 518 size_t pageCount; |
| 519 |
| 520 // Map from base-classes to a snapshot class-ids (used as index below). |
| 521 HashMap<const GCInfo*, size_t> classTags; |
| 522 |
| 523 // Map from class-id (index) to count. |
| 524 Vector<int> liveCount; |
| 525 Vector<int> deadCount; |
| 526 |
| 527 // Map from class-id (index) to a vector of generation counts. |
| 528 // For i < 7, the count is the number of objects that died after survivi
ng |i| GCs. |
| 529 // For i == 7, the count is the number of objects that survived at least
7 GCs. |
| 530 Vector<Vector<int, 8> > generations; |
| 531 |
| 532 explicit SnapshotInfo(ThreadState* state) : state(state), liveSize(0), d
eadSize(0), freeSize(0), pageCount(0) { } |
| 533 |
| 534 size_t getClassTag(const GCInfo*); |
| 535 }; |
| 536 |
| 537 void snapshot(); |
| 538 #endif |
| 539 |
507 void pushWeakObjectPointerCallback(void*, WeakPointerCallback); | 540 void pushWeakObjectPointerCallback(void*, WeakPointerCallback); |
508 bool popAndInvokeWeakPointerCallback(Visitor*); | 541 bool popAndInvokeWeakPointerCallback(Visitor*); |
509 | 542 |
510 void getStats(HeapStats&); | 543 void getStats(HeapStats&); |
511 HeapStats& stats() { return m_stats; } | 544 HeapStats& stats() { return m_stats; } |
512 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; } | 545 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; } |
513 | 546 |
514 void setupHeapsForTermination(); | 547 void setupHeapsForTermination(); |
515 | 548 |
516 private: | 549 private: |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 // HeapPage header. We use some of the bits to determine | 748 // HeapPage header. We use some of the bits to determine |
716 // whether the page is part of a terminting thread or | 749 // whether the page is part of a terminting thread or |
717 // if the page is traced after being terminated (orphaned). | 750 // if the page is traced after being terminated (orphaned). |
718 uintptr_t m_terminating : 1; | 751 uintptr_t m_terminating : 1; |
719 uintptr_t m_tracedAfterOrphaned : 1; | 752 uintptr_t m_tracedAfterOrphaned : 1; |
720 }; | 753 }; |
721 | 754 |
722 } | 755 } |
723 | 756 |
724 #endif // ThreadState_h | 757 #endif // ThreadState_h |
OLD | NEW |