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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 chunk->set_store_buffer_counter(0); | 214 chunk->set_store_buffer_counter(0); |
215 } | 215 } |
216 bool created_new_scan_on_scavenge_pages = false; | 216 bool created_new_scan_on_scavenge_pages = false; |
217 MemoryChunk* previous_chunk = NULL; | 217 MemoryChunk* previous_chunk = NULL; |
218 for (Address* p = old_start_; p < old_top_; p += prime_sample_step) { | 218 for (Address* p = old_start_; p < old_top_; p += prime_sample_step) { |
219 Address addr = *p; | 219 Address addr = *p; |
220 MemoryChunk* containing_chunk = NULL; | 220 MemoryChunk* containing_chunk = NULL; |
221 if (previous_chunk != NULL && previous_chunk->Contains(addr)) { | 221 if (previous_chunk != NULL && previous_chunk->Contains(addr)) { |
222 containing_chunk = previous_chunk; | 222 containing_chunk = previous_chunk; |
223 } else { | 223 } else { |
224 containing_chunk = MemoryChunk::FromAnyPointerAddress(addr); | 224 containing_chunk = MemoryChunk::FromAnyPointerAddress(heap_, addr); |
225 } | 225 } |
226 int old_counter = containing_chunk->store_buffer_counter(); | 226 int old_counter = containing_chunk->store_buffer_counter(); |
227 if (old_counter == threshold) { | 227 if (old_counter == threshold) { |
228 containing_chunk->set_scan_on_scavenge(true); | 228 containing_chunk->set_scan_on_scavenge(true); |
229 created_new_scan_on_scavenge_pages = true; | 229 created_new_scan_on_scavenge_pages = true; |
230 } | 230 } |
231 containing_chunk->set_store_buffer_counter(old_counter + 1); | 231 containing_chunk->set_store_buffer_counter(old_counter + 1); |
232 previous_chunk = containing_chunk; | 232 previous_chunk = containing_chunk; |
233 } | 233 } |
234 if (created_new_scan_on_scavenge_pages) { | 234 if (created_new_scan_on_scavenge_pages) { |
235 Filter(MemoryChunk::SCAN_ON_SCAVENGE); | 235 Filter(MemoryChunk::SCAN_ON_SCAVENGE); |
236 } | 236 } |
237 old_buffer_is_filtered_ = true; | 237 old_buffer_is_filtered_ = true; |
238 } | 238 } |
239 | 239 |
240 | 240 |
241 void StoreBuffer::Filter(int flag) { | 241 void StoreBuffer::Filter(int flag) { |
242 Address* new_top = old_start_; | 242 Address* new_top = old_start_; |
243 MemoryChunk* previous_chunk = NULL; | 243 MemoryChunk* previous_chunk = NULL; |
244 for (Address* p = old_start_; p < old_top_; p++) { | 244 for (Address* p = old_start_; p < old_top_; p++) { |
245 Address addr = *p; | 245 Address addr = *p; |
246 MemoryChunk* containing_chunk = NULL; | 246 MemoryChunk* containing_chunk = NULL; |
247 if (previous_chunk != NULL && previous_chunk->Contains(addr)) { | 247 if (previous_chunk != NULL && previous_chunk->Contains(addr)) { |
248 containing_chunk = previous_chunk; | 248 containing_chunk = previous_chunk; |
249 } else { | 249 } else { |
250 containing_chunk = MemoryChunk::FromAnyPointerAddress(addr); | 250 containing_chunk = MemoryChunk::FromAnyPointerAddress(heap_, addr); |
251 previous_chunk = containing_chunk; | 251 previous_chunk = containing_chunk; |
252 } | 252 } |
253 if (!containing_chunk->IsFlagSet(flag)) { | 253 if (!containing_chunk->IsFlagSet(flag)) { |
254 *new_top++ = addr; | 254 *new_top++ = addr; |
255 } | 255 } |
256 } | 256 } |
257 old_top_ = new_top; | 257 old_top_ = new_top; |
258 | 258 |
259 // Filtering hash sets are inconsistent with the store buffer after this | 259 // Filtering hash sets are inconsistent with the store buffer after this |
260 // operation. | 260 // operation. |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 } | 724 } |
725 old_buffer_is_sorted_ = false; | 725 old_buffer_is_sorted_ = false; |
726 old_buffer_is_filtered_ = false; | 726 old_buffer_is_filtered_ = false; |
727 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 727 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
728 ASSERT(old_top_ <= old_limit_); | 728 ASSERT(old_top_ <= old_limit_); |
729 } | 729 } |
730 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 730 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
731 } | 731 } |
732 | 732 |
733 } } // namespace v8::internal | 733 } } // namespace v8::internal |
OLD | NEW |