OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_STORE_BUFFER_H_ | 5 #ifndef V8_STORE_BUFFER_H_ |
6 #define V8_STORE_BUFFER_H_ | 6 #define V8_STORE_BUFFER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
11 #include "src/globals.h" | 11 #include "src/globals.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 class Page; | 16 class Page; |
17 class PagedSpace; | 17 class PagedSpace; |
18 class StoreBuffer; | 18 class StoreBuffer; |
19 | 19 |
20 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); | 20 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); |
21 | 21 |
22 typedef void (StoreBuffer::*RegionCallback)(Address start, Address end, | |
23 ObjectSlotCallback slot_callback); | |
24 | |
25 // Used to implement the write barrier by collecting addresses of pointers | 22 // Used to implement the write barrier by collecting addresses of pointers |
26 // between spaces. | 23 // between spaces. |
27 class StoreBuffer { | 24 class StoreBuffer { |
28 public: | 25 public: |
29 explicit StoreBuffer(Heap* heap); | 26 explicit StoreBuffer(Heap* heap); |
30 | 27 |
31 static void StoreBufferOverflow(Isolate* isolate); | 28 static void StoreBufferOverflow(Isolate* isolate); |
32 | 29 |
33 void SetUp(); | 30 void SetUp(); |
34 void TearDown(); | 31 void TearDown(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 137 |
141 bool SpaceAvailable(intptr_t space_needed); | 138 bool SpaceAvailable(intptr_t space_needed); |
142 void ExemptPopularPages(int prime_sample_step, int threshold); | 139 void ExemptPopularPages(int prime_sample_step, int threshold); |
143 | 140 |
144 void ProcessOldToNewSlot(Address slot_address, | 141 void ProcessOldToNewSlot(Address slot_address, |
145 ObjectSlotCallback slot_callback); | 142 ObjectSlotCallback slot_callback); |
146 | 143 |
147 void FindPointersToNewSpaceInRegion(Address start, Address end, | 144 void FindPointersToNewSpaceInRegion(Address start, Address end, |
148 ObjectSlotCallback slot_callback); | 145 ObjectSlotCallback slot_callback); |
149 | 146 |
150 // For each region of pointers on a page in use from an old space call | |
151 // visit_pointer_region callback. | |
152 // If either visit_pointer_region or callback can cause an allocation | |
153 // in old space and changes in allocation watermark then | |
154 // can_preallocate_during_iteration should be set to true. | |
155 void IteratePointersOnPage(PagedSpace* space, Page* page, | |
156 RegionCallback region_callback, | |
157 ObjectSlotCallback slot_callback); | |
158 | |
159 void IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback); | 147 void IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback); |
160 | 148 |
161 #ifdef VERIFY_HEAP | 149 #ifdef VERIFY_HEAP |
162 void VerifyPointers(LargeObjectSpace* space); | 150 void VerifyPointers(LargeObjectSpace* space); |
163 #endif | 151 #endif |
164 | 152 |
165 friend class DontMoveStoreBufferEntriesScope; | 153 friend class DontMoveStoreBufferEntriesScope; |
166 friend class FindPointersToNewSpaceVisitor; | 154 friend class FindPointersToNewSpaceVisitor; |
167 friend class StoreBufferRebuildScope; | 155 friend class StoreBufferRebuildScope; |
168 }; | 156 }; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 213 } |
226 | 214 |
227 private: | 215 private: |
228 StoreBuffer* store_buffer_; | 216 StoreBuffer* store_buffer_; |
229 bool stored_state_; | 217 bool stored_state_; |
230 }; | 218 }; |
231 } // namespace internal | 219 } // namespace internal |
232 } // namespace v8 | 220 } // namespace v8 |
233 | 221 |
234 #endif // V8_STORE_BUFFER_H_ | 222 #endif // V8_STORE_BUFFER_H_ |
OLD | NEW |