| 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 24 matching lines...) Expand all Loading... |
| 35 #include "platform/heap/AddressSanitizer.h" | 35 #include "platform/heap/AddressSanitizer.h" |
| 36 #include "public/platform/WebThread.h" | 36 #include "public/platform/WebThread.h" |
| 37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
| 38 #include "wtf/HashSet.h" | 38 #include "wtf/HashSet.h" |
| 39 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
| 40 #include "wtf/PassOwnPtr.h" | 40 #include "wtf/PassOwnPtr.h" |
| 41 #include "wtf/ThreadSpecific.h" | 41 #include "wtf/ThreadSpecific.h" |
| 42 #include "wtf/Threading.h" | 42 #include "wtf/Threading.h" |
| 43 #include "wtf/ThreadingPrimitives.h" | 43 #include "wtf/ThreadingPrimitives.h" |
| 44 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
| 45 #include "wtf/text/StringHash.h" |
| 46 #include "wtf/text/WTFString.h" |
| 45 | 47 |
| 46 namespace v8 { | 48 namespace v8 { |
| 47 class Isolate; | 49 class Isolate; |
| 48 }; | 50 }; |
| 49 | 51 |
| 50 namespace blink { | 52 namespace blink { |
| 51 | 53 |
| 52 class BaseHeap; | 54 class BaseHeap; |
| 53 class BaseHeapPage; | 55 class BaseHeapPage; |
| 54 class CallbackStack; | 56 class CallbackStack; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 InlineVectorBackingHeap, | 186 InlineVectorBackingHeap, |
| 185 HashTableBackingHeap, | 187 HashTableBackingHeap, |
| 186 FOR_EACH_TYPED_HEAP(TypedHeapEnumName) | 188 FOR_EACH_TYPED_HEAP(TypedHeapEnumName) |
| 187 // Values used for iteration of heap segments. | 189 // Values used for iteration of heap segments. |
| 188 NumberOfHeaps, | 190 NumberOfHeaps, |
| 189 }; | 191 }; |
| 190 | 192 |
| 191 #if ENABLE(GC_PROFILING) | 193 #if ENABLE(GC_PROFILING) |
| 192 const size_t numberOfGenerationsToTrack = 8; | 194 const size_t numberOfGenerationsToTrack = 8; |
| 193 const size_t maxHeapObjectAge = numberOfGenerationsToTrack - 1; | 195 const size_t maxHeapObjectAge = numberOfGenerationsToTrack - 1; |
| 196 |
| 197 struct AgeCounts { |
| 198 int ages[numberOfGenerationsToTrack]; |
| 199 AgeCounts() { std::fill(ages, ages + numberOfGenerationsToTrack, 0); } |
| 200 }; |
| 201 typedef HashMap<String, AgeCounts> ClassAgeCountsMap; |
| 194 #endif | 202 #endif |
| 195 | 203 |
| 196 class PLATFORM_EXPORT ThreadState { | 204 class PLATFORM_EXPORT ThreadState { |
| 197 WTF_MAKE_NONCOPYABLE(ThreadState); | 205 WTF_MAKE_NONCOPYABLE(ThreadState); |
| 198 public: | 206 public: |
| 199 // When garbage collecting we need to know whether or not there | 207 // When garbage collecting we need to know whether or not there |
| 200 // can be pointers to Blink GC managed objects on the stack for | 208 // can be pointers to Blink GC managed objects on the stack for |
| 201 // each thread. When threads reach a safe point they record | 209 // each thread. When threads reach a safe point they record |
| 202 // whether or not they have pointers on the stack. | 210 // whether or not they have pointers on the stack. |
| 203 enum StackState { | 211 enum StackState { |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // For i == 7, the count is the number of objects that survived at least
7 GCs. | 534 // For i == 7, the count is the number of objects that survived at least
7 GCs. |
| 527 using GenerationCountsVector = Vector<int, numberOfGenerationsToTrack>; | 535 using GenerationCountsVector = Vector<int, numberOfGenerationsToTrack>; |
| 528 Vector<GenerationCountsVector> generations; | 536 Vector<GenerationCountsVector> generations; |
| 529 | 537 |
| 530 explicit SnapshotInfo(ThreadState* state) : state(state), freeSize(0), p
ageCount(0) { } | 538 explicit SnapshotInfo(ThreadState* state) : state(state), freeSize(0), p
ageCount(0) { } |
| 531 | 539 |
| 532 size_t getClassTag(const GCInfo*); | 540 size_t getClassTag(const GCInfo*); |
| 533 }; | 541 }; |
| 534 | 542 |
| 535 void snapshot(); | 543 void snapshot(); |
| 544 void incrementMarkedObjectsAge(); |
| 536 | 545 |
| 537 void snapshotFreeListIfNecessary(); | 546 void snapshotFreeListIfNecessary(); |
| 547 |
| 548 void collectAndReportMarkSweepStats() const; |
| 549 void reportMarkSweepStats(const char* statsName, const ClassAgeCountsMap&) c
onst; |
| 538 #endif | 550 #endif |
| 539 | 551 |
| 540 void pushWeakPointerCallback(void*, WeakPointerCallback); | 552 void pushWeakPointerCallback(void*, WeakPointerCallback); |
| 541 bool popAndInvokeWeakPointerCallback(Visitor*); | 553 bool popAndInvokeWeakPointerCallback(Visitor*); |
| 542 | 554 |
| 543 size_t objectPayloadSizeForTesting(); | 555 size_t objectPayloadSizeForTesting(); |
| 544 | 556 |
| 545 void postGCProcessing(); | 557 void postGCProcessing(); |
| 546 void prepareHeapForTermination(); | 558 void prepareHeapForTermination(); |
| 547 | 559 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 m_locked = false; | 760 m_locked = false; |
| 749 } | 761 } |
| 750 | 762 |
| 751 MutexBase& m_mutex; | 763 MutexBase& m_mutex; |
| 752 bool m_locked; | 764 bool m_locked; |
| 753 }; | 765 }; |
| 754 | 766 |
| 755 } // namespace blink | 767 } // namespace blink |
| 756 | 768 |
| 757 #endif // ThreadState_h | 769 #endif // ThreadState_h |
| OLD | NEW |