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 UnmarkedOrMarked, |
| 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 // record that we should garbage collect the next time we return | 651 // record that we should garbage collect the next time we return |
638 // to the event loop. If both return false, we don't need to | 652 // to the event loop. If both return false, we don't need to |
639 // collect garbage at this point. | 653 // collect garbage at this point. |
640 bool shouldScheduleIdleGC(); | 654 bool shouldScheduleIdleGC(); |
641 bool shouldSchedulePreciseGC(); | 655 bool shouldSchedulePreciseGC(); |
642 bool shouldForceConservativeGC(); | 656 bool shouldForceConservativeGC(); |
643 void runScheduledGC(StackState); | 657 void runScheduledGC(StackState); |
644 | 658 |
645 void eagerSweep(); | 659 void eagerSweep(); |
646 | 660 |
| 661 #if defined(ADDRESS_SANITIZER) |
| 662 void poisonEagerHeap(Poisoning); |
| 663 void poisonAllHeaps(); |
| 664 #endif |
| 665 |
647 // When ThreadState is detaching from non-main thread its | 666 // When ThreadState is detaching from non-main thread its |
648 // heap is expected to be empty (because it is going away). | 667 // heap is expected to be empty (because it is going away). |
649 // Perform registered cleanup tasks and garbage collection | 668 // Perform registered cleanup tasks and garbage collection |
650 // to sweep away any objects that are left on this heap. | 669 // to sweep away any objects that are left on this heap. |
651 // We assert that nothing must remain after this cleanup. | 670 // We assert that nothing must remain after this cleanup. |
652 // If assertion does not hold we crash as we are potentially | 671 // If assertion does not hold we crash as we are potentially |
653 // in the dangling pointer situation. | 672 // in the dangling pointer situation. |
654 void cleanup(); | 673 void cleanup(); |
655 void cleanupPages(); | 674 void cleanupPages(); |
656 | 675 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 }; | 761 }; |
743 | 762 |
744 template<> class ThreadStateFor<AnyThread> { | 763 template<> class ThreadStateFor<AnyThread> { |
745 public: | 764 public: |
746 static ThreadState* state() { return ThreadState::current(); } | 765 static ThreadState* state() { return ThreadState::current(); } |
747 }; | 766 }; |
748 | 767 |
749 } // namespace blink | 768 } // namespace blink |
750 | 769 |
751 #endif // ThreadState_h | 770 #endif // ThreadState_h |
OLD | NEW |