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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // | 137 // |
138 // To create a new typed heap add a H(<ClassName>) to the | 138 // To create a new typed heap add a H(<ClassName>) to the |
139 // FOR_EACH_TYPED_HEAP macro below. | 139 // FOR_EACH_TYPED_HEAP macro below. |
140 #define FOR_EACH_TYPED_HEAP(H) \ | 140 #define FOR_EACH_TYPED_HEAP(H) \ |
141 H(Node) \ | 141 H(Node) \ |
142 H(CSSValue) | 142 H(CSSValue) |
143 | 143 |
144 #define TypedHeapEnumName(Type) Type##HeapIndex, | 144 #define TypedHeapEnumName(Type) Type##HeapIndex, |
145 | 145 |
146 enum HeapIndices { | 146 enum HeapIndices { |
147 NormalPage1HeapIndex = 0, | 147 EagerSweepHeapIndex = 0, |
| 148 NormalPage1HeapIndex, |
148 NormalPage2HeapIndex, | 149 NormalPage2HeapIndex, |
149 NormalPage3HeapIndex, | 150 NormalPage3HeapIndex, |
150 NormalPage4HeapIndex, | 151 NormalPage4HeapIndex, |
151 EagerSweepHeapIndex, | |
152 Vector1HeapIndex, | 152 Vector1HeapIndex, |
153 Vector2HeapIndex, | 153 Vector2HeapIndex, |
154 Vector3HeapIndex, | 154 Vector3HeapIndex, |
155 Vector4HeapIndex, | 155 Vector4HeapIndex, |
156 InlineVectorHeapIndex, | 156 InlineVectorHeapIndex, |
157 HashTableHeapIndex, | 157 HashTableHeapIndex, |
158 FOR_EACH_TYPED_HEAP(TypedHeapEnumName) | 158 FOR_EACH_TYPED_HEAP(TypedHeapEnumName) |
159 LargeObjectHeapIndex, | 159 LargeObjectHeapIndex, |
160 // Values used for iteration of heap segments. | 160 // Values used for iteration of heap segments. |
161 NumberOfHeaps, | 161 NumberOfHeaps, |
162 }; | 162 }; |
163 | 163 |
| 164 #if defined(ADDRESS_SANITIZER) |
| 165 // Heaps can have their object payloads be poisoned, or cleared |
| 166 // of their poisoning. |
| 167 enum Poisoning { |
| 168 SetPoison, |
| 169 ClearPoison, |
| 170 }; |
| 171 |
| 172 enum ObjectsToPoison { |
| 173 UnmarkedOnly, |
| 174 MarkedAndUnmarked, |
| 175 }; |
| 176 #endif |
| 177 |
164 #if ENABLE(GC_PROFILING) | 178 #if ENABLE(GC_PROFILING) |
165 const size_t numberOfGenerationsToTrack = 8; | 179 const size_t numberOfGenerationsToTrack = 8; |
166 const size_t maxHeapObjectAge = numberOfGenerationsToTrack - 1; | 180 const size_t maxHeapObjectAge = numberOfGenerationsToTrack - 1; |
167 | 181 |
168 struct AgeCounts { | 182 struct AgeCounts { |
169 int ages[numberOfGenerationsToTrack]; | 183 int ages[numberOfGenerationsToTrack]; |
170 AgeCounts() { std::fill(ages, ages + numberOfGenerationsToTrack, 0); } | 184 AgeCounts() { std::fill(ages, ages + numberOfGenerationsToTrack, 0); } |
171 }; | 185 }; |
172 typedef HashMap<String, AgeCounts> ClassAgeCountsMap; | 186 typedef HashMap<String, AgeCounts> ClassAgeCountsMap; |
173 #endif | 187 #endif |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 // record that we should garbage collect the next time we return | 653 // record that we should garbage collect the next time we return |
640 // to the event loop. If both return false, we don't need to | 654 // to the event loop. If both return false, we don't need to |
641 // collect garbage at this point. | 655 // collect garbage at this point. |
642 bool shouldScheduleIdleGC(); | 656 bool shouldScheduleIdleGC(); |
643 bool shouldSchedulePreciseGC(); | 657 bool shouldSchedulePreciseGC(); |
644 bool shouldForceConservativeGC(); | 658 bool shouldForceConservativeGC(); |
645 void runScheduledGC(StackState); | 659 void runScheduledGC(StackState); |
646 | 660 |
647 void eagerSweep(); | 661 void eagerSweep(); |
648 | 662 |
| 663 #if defined(ADDRESS_SANITIZER) |
| 664 void poisonEagerHeap(Poisoning); |
| 665 void poisonAllHeaps(); |
| 666 #endif |
| 667 |
649 // When ThreadState is detaching from non-main thread its | 668 // When ThreadState is detaching from non-main thread its |
650 // heap is expected to be empty (because it is going away). | 669 // heap is expected to be empty (because it is going away). |
651 // Perform registered cleanup tasks and garbage collection | 670 // Perform registered cleanup tasks and garbage collection |
652 // to sweep away any objects that are left on this heap. | 671 // to sweep away any objects that are left on this heap. |
653 // We assert that nothing must remain after this cleanup. | 672 // We assert that nothing must remain after this cleanup. |
654 // If assertion does not hold we crash as we are potentially | 673 // If assertion does not hold we crash as we are potentially |
655 // in the dangling pointer situation. | 674 // in the dangling pointer situation. |
656 void cleanup(); | 675 void cleanup(); |
657 void cleanupPages(); | 676 void cleanupPages(); |
658 | 677 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 }; | 763 }; |
745 | 764 |
746 template<> class ThreadStateFor<AnyThread> { | 765 template<> class ThreadStateFor<AnyThread> { |
747 public: | 766 public: |
748 static ThreadState* state() { return ThreadState::current(); } | 767 static ThreadState* state() { return ThreadState::current(); } |
749 }; | 768 }; |
750 | 769 |
751 } // namespace blink | 770 } // namespace blink |
752 | 771 |
753 #endif // ThreadState_h | 772 #endif // ThreadState_h |
OLD | NEW |