| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 bool old_buffer_is_filtered_; | 139 bool old_buffer_is_filtered_; |
| 140 bool during_gc_; | 140 bool during_gc_; |
| 141 // The garbage collector iterates over many pointers to new space that are not | 141 // The garbage collector iterates over many pointers to new space that are not |
| 142 // handled by the store buffer. This flag indicates whether the pointers | 142 // handled by the store buffer. This flag indicates whether the pointers |
| 143 // found by the callbacks should be added to the store buffer or not. | 143 // found by the callbacks should be added to the store buffer or not. |
| 144 bool store_buffer_rebuilding_enabled_; | 144 bool store_buffer_rebuilding_enabled_; |
| 145 StoreBufferCallback callback_; | 145 StoreBufferCallback callback_; |
| 146 bool may_move_store_buffer_entries_; | 146 bool may_move_store_buffer_entries_; |
| 147 | 147 |
| 148 VirtualMemory* virtual_memory_; | 148 VirtualMemory* virtual_memory_; |
| 149 uintptr_t* hash_map_1_; | 149 |
| 150 uintptr_t* hash_map_2_; | 150 // Two hash sets used for filtering. |
| 151 // If address is in the hash set then it is guaranteed to be in the |
| 152 // old part of the store buffer. |
| 153 uintptr_t* hash_set_1_; |
| 154 uintptr_t* hash_set_2_; |
| 155 bool hash_sets_are_empty_; |
| 156 |
| 157 void ClearFilteringHashSets(); |
| 151 | 158 |
| 152 void CheckForFullBuffer(); | 159 void CheckForFullBuffer(); |
| 153 void Uniq(); | 160 void Uniq(); |
| 154 void ZapHashTables(); | |
| 155 bool HashTablesAreZapped(); | |
| 156 void ExemptPopularPages(int prime_sample_step, int threshold); | 161 void ExemptPopularPages(int prime_sample_step, int threshold); |
| 157 | 162 |
| 158 void FindPointersToNewSpaceInRegion(Address start, | 163 void FindPointersToNewSpaceInRegion(Address start, |
| 159 Address end, | 164 Address end, |
| 160 ObjectSlotCallback slot_callback); | 165 ObjectSlotCallback slot_callback); |
| 161 | 166 |
| 162 // For each region of pointers on a page in use from an old space call | 167 // For each region of pointers on a page in use from an old space call |
| 163 // visit_pointer_region callback. | 168 // visit_pointer_region callback. |
| 164 // If either visit_pointer_region or callback can cause an allocation | 169 // If either visit_pointer_region or callback can cause an allocation |
| 165 // in old space and changes in allocation watermark then | 170 // in old space and changes in allocation watermark then |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 244 } |
| 240 | 245 |
| 241 private: | 246 private: |
| 242 StoreBuffer* store_buffer_; | 247 StoreBuffer* store_buffer_; |
| 243 bool stored_state_; | 248 bool stored_state_; |
| 244 }; | 249 }; |
| 245 | 250 |
| 246 } } // namespace v8::internal | 251 } } // namespace v8::internal |
| 247 | 252 |
| 248 #endif // V8_STORE_BUFFER_H_ | 253 #endif // V8_STORE_BUFFER_H_ |
| OLD | NEW |