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

Side by Side Diff: src/store-buffer.h

Issue 7248006: Revert 3899 because it tanked V8 benchmark suite. We need an (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 6 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
« src/heap.h ('K') | « src/heap.h ('k') | src/store-buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 23 matching lines...) Expand all
34 #include "platform.h" 34 #include "platform.h"
35 #include "v8globals.h" 35 #include "v8globals.h"
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 class StoreBuffer; 40 class StoreBuffer;
41 41
42 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); 42 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to);
43 43
44 typedef void RegionCallback( 44 typedef void (StoreBuffer::*RegionCallback)(
45 StoreBuffer* store_buffer, 45 Address start, Address end, ObjectSlotCallback slot_callback);
46 Address start,
47 Address end,
48 ObjectSlotCallback slot_callback);
49 46
50 // Used to implement the write barrier by collecting addresses of pointers 47 // Used to implement the write barrier by collecting addresses of pointers
51 // between spaces. 48 // between spaces.
52 class StoreBuffer { 49 class StoreBuffer {
53 public: 50 public:
54 explicit StoreBuffer(Heap* heap); 51 explicit StoreBuffer(Heap* heap);
55 52
56 static void StoreBufferOverflow(Isolate* isolate); 53 static void StoreBufferOverflow(Isolate* isolate);
57 54
58 inline Address TopAddress(); 55 inline Address TopAddress();
(...skipping 18 matching lines...) Expand all
77 // exempt from the store buffer and process the promotion queue. These steps 74 // exempt from the store buffer and process the promotion queue. These steps
78 // can overflow this buffer. We check for this and on overflow we call the 75 // can overflow this buffer. We check for this and on overflow we call the
79 // callback set up with the StoreBufferRebuildScope object. 76 // callback set up with the StoreBufferRebuildScope object.
80 inline void EnterDirectlyIntoStoreBuffer(Address addr); 77 inline void EnterDirectlyIntoStoreBuffer(Address addr);
81 78
82 // Iterates over all pointers that go from old space to new space. It will 79 // Iterates over all pointers that go from old space to new space. It will
83 // delete the store buffer as it starts so the callback should reenter 80 // delete the store buffer as it starts so the callback should reenter
84 // surviving old-to-new pointers into the store buffer to rebuild it. 81 // surviving old-to-new pointers into the store buffer to rebuild it.
85 void IteratePointersToNewSpace(ObjectSlotCallback callback); 82 void IteratePointersToNewSpace(ObjectSlotCallback callback);
86 83
87 static const int kStoreBufferOverflowBit = 1 << 12; 84 static const int kStoreBufferOverflowBit = 1 << 16;
88 static const int kStoreBufferSize = kStoreBufferOverflowBit; 85 static const int kStoreBufferSize = kStoreBufferOverflowBit;
89 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); 86 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address);
90 static const int kOldStoreBufferLength = kStoreBufferLength * 64; 87 static const int kOldStoreBufferLength = kStoreBufferLength * 64;
91 static const int kHashMapLengthLog2 = 12; 88 static const int kHashMapLengthLog2 = 12;
92 static const int kHashMapLength = 1 << kHashMapLengthLog2; 89 static const int kHashMapLength = 1 << kHashMapLengthLog2;
93 90
94 void Compact(); 91 void Compact();
95 static void GCPrologue(GCType type, GCCallbackFlags flags); 92 static void GCPrologue(GCType type, GCCallbackFlags flags);
96 static void GCEpilogue(GCType type, GCCallbackFlags flags); 93 static void GCEpilogue(GCType type, GCCallbackFlags flags);
97 94
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 VirtualMemory* virtual_memory_; 147 VirtualMemory* virtual_memory_;
151 uintptr_t* hash_map_1_; 148 uintptr_t* hash_map_1_;
152 uintptr_t* hash_map_2_; 149 uintptr_t* hash_map_2_;
153 150
154 void CheckForFullBuffer(); 151 void CheckForFullBuffer();
155 void Uniq(); 152 void Uniq();
156 void ZapHashTables(); 153 void ZapHashTables();
157 bool HashTablesAreZapped(); 154 bool HashTablesAreZapped();
158 void ExemptPopularPages(int prime_sample_step, int threshold); 155 void ExemptPopularPages(int prime_sample_step, int threshold);
159 156
160 enum RecordNewSpacePointers { 157 void FindPointersToNewSpaceInRegion(Address start,
161 kDontRecord, 158 Address end,
162 kRecord 159 ObjectSlotCallback slot_callback);
163 };
164
165 template<RecordNewSpacePointers record>
166 inline void FindPointersToNewSpaceInRegion(Address start,
167 Address end,
168 ObjectSlotCallback slot_callback);
169
170 // It seems gcc doesn't want to take the address of a templated method,
171 // so we create a new method so that we can give the address. Also,
172 // pointers to methods tend to have gnarly implementations.
173 static void FindPointersToNewSpaceInRegionRecord(
174 StoreBuffer* store_buffer,
175 Address start,
176 Address end,
177 ObjectSlotCallback slot_callback);
178
179 static void FindPointersToNewSpaceInRegionDontRecord(
180 StoreBuffer* store_buffer,
181 Address start,
182 Address end,
183 ObjectSlotCallback slot_callback);
184 160
185 // For each region of pointers on a page in use from an old space call 161 // For each region of pointers on a page in use from an old space call
186 // visit_pointer_region callback. 162 // visit_pointer_region callback.
187 // If either visit_pointer_region or callback can cause an allocation 163 // If either visit_pointer_region or callback can cause an allocation
188 // in old space and changes in allocation watermark then 164 // in old space and changes in allocation watermark then
189 // can_preallocate_during_iteration should be set to true. 165 // can_preallocate_during_iteration should be set to true.
190 void IteratePointersOnPage( 166 void IteratePointersOnPage(
191 PagedSpace* space, 167 PagedSpace* space,
192 Page* page, 168 Page* page,
193 RegionCallback region_callback, 169 RegionCallback region_callback,
194 ObjectSlotCallback slot_callback); 170 ObjectSlotCallback slot_callback);
195 171
196 void FindPointersToNewSpaceInMaps( 172 void FindPointersToNewSpaceInMaps(
197 Address start, 173 Address start,
198 Address end, 174 Address end,
199 ObjectSlotCallback slot_callback); 175 ObjectSlotCallback slot_callback);
200 176
201 static void FindPointersToNewSpaceInMapsRegion( 177 void FindPointersToNewSpaceInMapsRegion(
202 StoreBuffer* store_buffer,
203 Address start, 178 Address start,
204 Address end, 179 Address end,
205 ObjectSlotCallback slot_callback); 180 ObjectSlotCallback slot_callback);
206 181
207 void FindPointersToNewSpaceOnPage( 182 void FindPointersToNewSpaceOnPage(
208 PagedSpace* space, 183 PagedSpace* space,
209 Page* page, 184 Page* page,
210 RegionCallback region_callback, 185 RegionCallback region_callback,
211 ObjectSlotCallback slot_callback); 186 ObjectSlotCallback slot_callback);
212 187
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 238 }
264 239
265 private: 240 private:
266 StoreBuffer* store_buffer_; 241 StoreBuffer* store_buffer_;
267 bool stored_state_; 242 bool stored_state_;
268 }; 243 };
269 244
270 } } // namespace v8::internal 245 } } // namespace v8::internal
271 246
272 #endif // V8_STORE_BUFFER_H_ 247 #endif // V8_STORE_BUFFER_H_
OLDNEW
« src/heap.h ('K') | « src/heap.h ('k') | src/store-buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698