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