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 #include <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 #include "src/heap/store-buffer-inl.h" | 10 #include "src/heap/store-buffer-inl.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } | 354 } |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 | 358 |
359 void StoreBuffer::ClearInvalidStoreBufferEntries() { | 359 void StoreBuffer::ClearInvalidStoreBufferEntries() { |
360 Compact(); | 360 Compact(); |
361 Address* new_top = old_start_; | 361 Address* new_top = old_start_; |
362 for (Address* current = old_start_; current < old_top_; current++) { | 362 for (Address* current = old_start_; current < old_top_; current++) { |
363 Address addr = *current; | 363 Address addr = *current; |
364 Object** slot = reinterpret_cast<Object**>(addr); | 364 Object** slot = reinterpret_cast<Object**>(*current); |
365 Object* object = *slot; | 365 Object* object = *slot; |
366 if (heap_->InNewSpace(object) && object->IsHeapObject()) { | 366 if (heap_->InNewSpace(object)) { |
367 // If the target object is not black, the source slot must be part | 367 if (heap_->mark_compact_collector()->IsSlotInLiveObject( |
368 // of a non-black (dead) object. | 368 reinterpret_cast<HeapObject**>(slot), |
369 HeapObject* heap_object = HeapObject::cast(object); | 369 reinterpret_cast<HeapObject*>(object))) { |
370 if (Marking::IsBlack(Marking::MarkBitFrom(heap_object)) && | |
371 heap_->mark_compact_collector()->IsSlotInLiveObject(addr)) { | |
372 *new_top++ = addr; | 370 *new_top++ = addr; |
373 } | 371 } |
374 } | 372 } |
375 } | 373 } |
376 old_top_ = new_top; | 374 old_top_ = new_top; |
377 ClearFilteringHashSets(); | 375 ClearFilteringHashSets(); |
378 | 376 |
379 // Don't scan on scavenge dead large objects. | 377 // Don't scan on scavenge dead large objects. |
380 LargeObjectIterator it(heap_->lo_space()); | 378 LargeObjectIterator it(heap_->lo_space()); |
381 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { | 379 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { |
382 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); | 380 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); |
383 if (chunk->scan_on_scavenge() && !Marking::MarkBitFrom(object).Get()) { | 381 if (chunk->scan_on_scavenge() && !Marking::MarkBitFrom(object).Get()) { |
384 chunk->set_scan_on_scavenge(false); | 382 chunk->set_scan_on_scavenge(false); |
385 } | 383 } |
386 } | 384 } |
387 } | 385 } |
388 | 386 |
389 | 387 |
390 void StoreBuffer::VerifyValidStoreBufferEntries() { | 388 void StoreBuffer::VerifyValidStoreBufferEntries() { |
391 for (Address* current = old_start_; current < old_top_; current++) { | 389 for (Address* current = old_start_; current < old_top_; current++) { |
392 Object** slot = reinterpret_cast<Object**>(*current); | 390 Object** slot = reinterpret_cast<Object**>(*current); |
393 Object* object = *slot; | 391 Object* object = *slot; |
394 CHECK(object->IsHeapObject()); | |
395 CHECK(heap_->InNewSpace(object)); | 392 CHECK(heap_->InNewSpace(object)); |
396 heap_->mark_compact_collector()->VerifyIsSlotInLiveObject( | 393 heap_->mark_compact_collector()->VerifyIsSlotInLiveObject( |
397 reinterpret_cast<Address>(slot), HeapObject::cast(object)); | 394 reinterpret_cast<HeapObject**>(slot), |
| 395 reinterpret_cast<HeapObject*>(object)); |
398 } | 396 } |
399 } | 397 } |
400 | 398 |
401 | 399 |
402 void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback) { | 400 void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback) { |
403 // We do not sort or remove duplicated entries from the store buffer because | 401 // We do not sort or remove duplicated entries from the store buffer because |
404 // we expect that callback will rebuild the store buffer thus removing | 402 // we expect that callback will rebuild the store buffer thus removing |
405 // all duplicates and pointers to old space. | 403 // all duplicates and pointers to old space. |
406 bool some_pages_to_scan = PrepareForIteration(); | 404 bool some_pages_to_scan = PrepareForIteration(); |
407 | 405 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 } | 562 } |
565 old_buffer_is_sorted_ = false; | 563 old_buffer_is_sorted_ = false; |
566 old_buffer_is_filtered_ = false; | 564 old_buffer_is_filtered_ = false; |
567 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 565 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
568 DCHECK(old_top_ <= old_limit_); | 566 DCHECK(old_top_ <= old_limit_); |
569 } | 567 } |
570 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 568 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
571 } | 569 } |
572 } | 570 } |
573 } // namespace v8::internal | 571 } // namespace v8::internal |
OLD | NEW |