| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // between spaces. | 26 // between spaces. |
| 27 class StoreBuffer { | 27 class StoreBuffer { |
| 28 public: | 28 public: |
| 29 explicit StoreBuffer(Heap* heap); | 29 explicit StoreBuffer(Heap* heap); |
| 30 | 30 |
| 31 static void StoreBufferOverflow(Isolate* isolate); | 31 static void StoreBufferOverflow(Isolate* isolate); |
| 32 | 32 |
| 33 void SetUp(); | 33 void SetUp(); |
| 34 void TearDown(); | 34 void TearDown(); |
| 35 | 35 |
| 36 // This is used by the mutator to enter addresses into the store buffer. | 36 // This is used to add addresses to the store buffer non-concurrently. |
| 37 inline void Mark(Address addr); | 37 inline void Mark(Address addr); |
| 38 | 38 |
| 39 // This is used to add addresses to the store buffer when multiple threads |
| 40 // may operate on the store buffer. |
| 41 inline void MarkSynchronized(Address addr); |
| 42 |
| 39 // This is used by the heap traversal to enter the addresses into the store | 43 // This is used by the heap traversal to enter the addresses into the store |
| 40 // buffer that should still be in the store buffer after GC. It enters | 44 // buffer that should still be in the store buffer after GC. It enters |
| 41 // addresses directly into the old buffer because the GC starts by wiping the | 45 // addresses directly into the old buffer because the GC starts by wiping the |
| 42 // old buffer and thereafter only visits each cell once so there is no need | 46 // old buffer and thereafter only visits each cell once so there is no need |
| 43 // to attempt to remove any dupes. During the first part of a GC we | 47 // to attempt to remove any dupes. During the first part of a GC we |
| 44 // are using the store buffer to access the old spaces and at the same time | 48 // are using the store buffer to access the old spaces and at the same time |
| 45 // we are rebuilding the store buffer using this function. There is, however | 49 // we are rebuilding the store buffer using this function. There is, however |
| 46 // no issue of overwriting the buffer we are iterating over, because this | 50 // no issue of overwriting the buffer we are iterating over, because this |
| 47 // stage of the scavenge can only reduce the number of addresses in the store | 51 // stage of the scavenge can only reduce the number of addresses in the store |
| 48 // buffer (some objects are promoted so pointers to them do not need to be in | 52 // buffer (some objects are promoted so pointers to them do not need to be in |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 126 |
| 123 base::VirtualMemory* virtual_memory_; | 127 base::VirtualMemory* virtual_memory_; |
| 124 | 128 |
| 125 // Two hash sets used for filtering. | 129 // Two hash sets used for filtering. |
| 126 // If address is in the hash set then it is guaranteed to be in the | 130 // If address is in the hash set then it is guaranteed to be in the |
| 127 // old part of the store buffer. | 131 // old part of the store buffer. |
| 128 uintptr_t* hash_set_1_; | 132 uintptr_t* hash_set_1_; |
| 129 uintptr_t* hash_set_2_; | 133 uintptr_t* hash_set_2_; |
| 130 bool hash_sets_are_empty_; | 134 bool hash_sets_are_empty_; |
| 131 | 135 |
| 136 // Used for synchronization of concurrent store buffer access. |
| 137 base::Mutex mutex_; |
| 138 |
| 132 void ClearFilteringHashSets(); | 139 void ClearFilteringHashSets(); |
| 133 | 140 |
| 134 bool SpaceAvailable(intptr_t space_needed); | 141 bool SpaceAvailable(intptr_t space_needed); |
| 135 void ExemptPopularPages(int prime_sample_step, int threshold); | 142 void ExemptPopularPages(int prime_sample_step, int threshold); |
| 136 | 143 |
| 137 void ProcessOldToNewSlot(Address slot_address, | 144 void ProcessOldToNewSlot(Address slot_address, |
| 138 ObjectSlotCallback slot_callback); | 145 ObjectSlotCallback slot_callback); |
| 139 | 146 |
| 140 void FindPointersToNewSpaceInRegion(Address start, Address end, | 147 void FindPointersToNewSpaceInRegion(Address start, Address end, |
| 141 ObjectSlotCallback slot_callback); | 148 ObjectSlotCallback slot_callback); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 224 } |
| 218 | 225 |
| 219 private: | 226 private: |
| 220 StoreBuffer* store_buffer_; | 227 StoreBuffer* store_buffer_; |
| 221 bool stored_state_; | 228 bool stored_state_; |
| 222 }; | 229 }; |
| 223 } | 230 } |
| 224 } // namespace v8::internal | 231 } // namespace v8::internal |
| 225 | 232 |
| 226 #endif // V8_STORE_BUFFER_H_ | 233 #endif // V8_STORE_BUFFER_H_ |
| OLD | NEW |