Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: Source/platform/heap/ThreadState.h

Issue 383743002: Oilpan: GC profiling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed Profiling.h Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // real machine stack if there is one. 497 // real machine stack if there is one.
494 void visitAsanFakeStackForPointer(Visitor*, Address); 498 void visitAsanFakeStackForPointer(Visitor*, Address);
495 499
496 // Visit all persistents allocated on this thread. 500 // Visit all persistents allocated on this thread.
497 void visitPersistents(Visitor*); 501 void visitPersistents(Visitor*);
498 502
499 // Checks a given address and if a pointer into the oilpan heap marks 503 // Checks a given address and if a pointer into the oilpan heap marks
500 // the object to which it points. 504 // the object to which it points.
501 bool checkAndMarkPointer(Visitor*, Address); 505 bool checkAndMarkPointer(Visitor*, Address);
502 506
503 #if ENABLE(GC_TRACING) 507 #if ENABLE(GC_PROFILE_MARKING)
504 const GCInfo* findGCInfo(Address); 508 const GCInfo* findGCInfo(Address);
505 static const GCInfo* findGCInfoFromAllThreads(Address); 509 static const GCInfo* findGCInfoFromAllThreads(Address);
506 #endif 510 #endif
507 511
512 #if ENABLE(GC_PROFILE_HEAP)
513 struct SnapshotInfo {
514 ThreadState* state;
515
516 size_t liveSize;
517 size_t deadSize;
518 size_t freeSize;
519 size_t pageCount;
520
521 // Map from base-classes to a snapshot class-ids (used as index below).
522 HashMap<const GCInfo*, size_t> classTags;
523
524 // Map from class-id (index) to count.
525 Vector<int> liveCount;
526 Vector<int> deadCount;
527
528 // Map from class-id (index) to a vector of generation counts.
529 // For i < 7, the count is the number of objects that died after survivi ng |i| GCs.
530 // For i == 7, the count is the number of objects that survived at least 7 GCs.
531 Vector<Vector<int, 8> > generations;
532
533 explicit SnapshotInfo(ThreadState* state) : state(state), liveSize(0), d eadSize(0), freeSize(0), pageCount(0) { }
534
535 size_t getClassTag(const GCInfo*);
536 };
537
538 void snapshot();
539 #endif
540
508 void pushWeakObjectPointerCallback(void*, WeakPointerCallback); 541 void pushWeakObjectPointerCallback(void*, WeakPointerCallback);
509 bool popAndInvokeWeakPointerCallback(Visitor*); 542 bool popAndInvokeWeakPointerCallback(Visitor*);
510 543
511 void getStats(HeapStats&); 544 void getStats(HeapStats&);
512 HeapStats& stats() { return m_stats; } 545 HeapStats& stats() { return m_stats; }
513 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; } 546 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; }
514 547
515 void setupHeapsForTermination(); 548 void setupHeapsForTermination();
516 549
517 private: 550 private:
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 // HeapPage header. We use some of the bits to determine 745 // HeapPage header. We use some of the bits to determine
713 // whether the page is part of a terminting thread or 746 // whether the page is part of a terminting thread or
714 // if the page is traced after being terminated (orphaned). 747 // if the page is traced after being terminated (orphaned).
715 uintptr_t m_terminating : 1; 748 uintptr_t m_terminating : 1;
716 uintptr_t m_tracedAfterOrphaned : 1; 749 uintptr_t m_tracedAfterOrphaned : 1;
717 }; 750 };
718 751
719 } 752 }
720 753
721 #endif // ThreadState_h 754 #endif // ThreadState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698