OLD | NEW |
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 // 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 |
80 // 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 |
81 // 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. |
82 void IteratePointersToNewSpace(ObjectSlotCallback callback); | 82 void IteratePointersToNewSpace(ObjectSlotCallback callback); |
83 | 83 |
84 static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2); | 84 static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2); |
85 static const int kStoreBufferSize = kStoreBufferOverflowBit; | 85 static const int kStoreBufferSize = kStoreBufferOverflowBit; |
86 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); | 86 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); |
87 static const int kOldStoreBufferLength = kStoreBufferLength * 16; | 87 static const int kOldStoreBufferLength = kStoreBufferLength * 16; |
88 static const int kHashMapLengthLog2 = 12; | 88 static const int kHashSetLengthLog2 = 12; |
89 static const int kHashMapLength = 1 << kHashMapLengthLog2; | 89 static const int kHashSetLength = 1 << kHashSetLengthLog2; |
90 | 90 |
91 void Compact(); | 91 void Compact(); |
92 | 92 |
93 void GCPrologue(); | 93 void GCPrologue(); |
94 void GCEpilogue(); | 94 void GCEpilogue(); |
95 | 95 |
96 Object*** Limit() { return reinterpret_cast<Object***>(old_limit_); } | 96 Object*** Limit() { return reinterpret_cast<Object***>(old_limit_); } |
97 Object*** Start() { return reinterpret_cast<Object***>(old_start_); } | 97 Object*** Start() { return reinterpret_cast<Object***>(old_start_); } |
98 Object*** Top() { return reinterpret_cast<Object***>(old_top_); } | 98 Object*** Top() { return reinterpret_cast<Object***>(old_top_); } |
99 void SetTop(Object*** top) { | 99 void SetTop(Object*** top) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 bool old_buffer_is_filtered_; | 141 bool old_buffer_is_filtered_; |
142 bool during_gc_; | 142 bool during_gc_; |
143 // The garbage collector iterates over many pointers to new space that are not | 143 // The garbage collector iterates over many pointers to new space that are not |
144 // handled by the store buffer. This flag indicates whether the pointers | 144 // handled by the store buffer. This flag indicates whether the pointers |
145 // found by the callbacks should be added to the store buffer or not. | 145 // found by the callbacks should be added to the store buffer or not. |
146 bool store_buffer_rebuilding_enabled_; | 146 bool store_buffer_rebuilding_enabled_; |
147 StoreBufferCallback callback_; | 147 StoreBufferCallback callback_; |
148 bool may_move_store_buffer_entries_; | 148 bool may_move_store_buffer_entries_; |
149 | 149 |
150 VirtualMemory* virtual_memory_; | 150 VirtualMemory* virtual_memory_; |
151 uintptr_t* hash_map_1_; | 151 |
152 uintptr_t* hash_map_2_; | 152 // Two hash sets used for filtering. |
| 153 // If address is in the hash set then it is guaranteed to be in the |
| 154 // old part of the store buffer. |
| 155 uintptr_t* hash_set_1_; |
| 156 uintptr_t* hash_set_2_; |
| 157 bool hash_sets_are_empty_; |
| 158 |
| 159 void ClearFilteringHashSets(); |
153 | 160 |
154 void CheckForFullBuffer(); | 161 void CheckForFullBuffer(); |
155 void Uniq(); | 162 void Uniq(); |
156 void ZapHashTables(); | |
157 bool HashTablesAreZapped(); | |
158 void ExemptPopularPages(int prime_sample_step, int threshold); | 163 void ExemptPopularPages(int prime_sample_step, int threshold); |
159 | 164 |
160 void FindPointersToNewSpaceInRegion(Address start, | 165 void FindPointersToNewSpaceInRegion(Address start, |
161 Address end, | 166 Address end, |
162 ObjectSlotCallback slot_callback); | 167 ObjectSlotCallback slot_callback); |
163 | 168 |
164 // For each region of pointers on a page in use from an old space call | 169 // For each region of pointers on a page in use from an old space call |
165 // visit_pointer_region callback. | 170 // visit_pointer_region callback. |
166 // If either visit_pointer_region or callback can cause an allocation | 171 // If either visit_pointer_region or callback can cause an allocation |
167 // in old space and changes in allocation watermark then | 172 // in old space and changes in allocation watermark then |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 246 } |
242 | 247 |
243 private: | 248 private: |
244 StoreBuffer* store_buffer_; | 249 StoreBuffer* store_buffer_; |
245 bool stored_state_; | 250 bool stored_state_; |
246 }; | 251 }; |
247 | 252 |
248 } } // namespace v8::internal | 253 } } // namespace v8::internal |
249 | 254 |
250 #endif // V8_STORE_BUFFER_H_ | 255 #endif // V8_STORE_BUFFER_H_ |
OLD | NEW |