| 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/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
| 10 #include "src/counters.h" | 10 #include "src/counters.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 #ifdef DEBUG | 427 #ifdef DEBUG |
| 428 Address* saved_top = old_top_; | 428 Address* saved_top = old_top_; |
| 429 #endif | 429 #endif |
| 430 ProcessOldToNewSlot(*current, slot_callback, clear_maps); | 430 ProcessOldToNewSlot(*current, slot_callback, clear_maps); |
| 431 DCHECK(old_top_ == saved_top + 1 || old_top_ == saved_top); | 431 DCHECK(old_top_ == saved_top + 1 || old_top_ == saved_top); |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 | 435 |
| 436 | 436 |
| 437 void StoreBuffer::ClearInvalidStoreBufferEntries() { |
| 438 Compact(); |
| 439 Address* new_top = old_start_; |
| 440 for (Address* current = old_start_; current < old_top_; current++) { |
| 441 Address addr = *current; |
| 442 Object** slot = reinterpret_cast<Object**>(*current); |
| 443 Object* object = reinterpret_cast<Object*>( |
| 444 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); |
| 445 if (heap_->InNewSpace(object)) { |
| 446 if (heap_->mark_compact_collector()->IsSlotInLiveObject( |
| 447 reinterpret_cast<HeapObject**>(slot), |
| 448 reinterpret_cast<HeapObject*>(object))) { |
| 449 *new_top++ = addr; |
| 450 } |
| 451 } |
| 452 } |
| 453 old_top_ = new_top; |
| 454 ClearFilteringHashSets(); |
| 455 } |
| 456 |
| 457 |
| 458 void StoreBuffer::VerifyValidStoreBufferEntries() { |
| 459 for (Address* current = old_start_; current < old_top_; current++) { |
| 460 Object** slot = reinterpret_cast<Object**>(*current); |
| 461 Object* object = reinterpret_cast<Object*>( |
| 462 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); |
| 463 CHECK(heap_->InNewSpace(object)); |
| 464 heap_->mark_compact_collector()->VerifyIsSlotInLiveObject( |
| 465 reinterpret_cast<HeapObject**>(slot), |
| 466 reinterpret_cast<HeapObject*>(object)); |
| 467 } |
| 468 } |
| 469 |
| 470 |
| 437 void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback) { | 471 void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback) { |
| 438 IteratePointersToNewSpace(slot_callback, false); | 472 IteratePointersToNewSpace(slot_callback, false); |
| 439 } | 473 } |
| 440 | 474 |
| 441 | 475 |
| 442 void StoreBuffer::IteratePointersToNewSpaceAndClearMaps( | 476 void StoreBuffer::IteratePointersToNewSpaceAndClearMaps( |
| 443 ObjectSlotCallback slot_callback) { | 477 ObjectSlotCallback slot_callback) { |
| 444 IteratePointersToNewSpace(slot_callback, true); | 478 IteratePointersToNewSpace(slot_callback, true); |
| 445 } | 479 } |
| 446 | 480 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 } | 646 } |
| 613 old_buffer_is_sorted_ = false; | 647 old_buffer_is_sorted_ = false; |
| 614 old_buffer_is_filtered_ = false; | 648 old_buffer_is_filtered_ = false; |
| 615 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 649 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
| 616 DCHECK(old_top_ <= old_limit_); | 650 DCHECK(old_top_ <= old_limit_); |
| 617 } | 651 } |
| 618 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 652 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
| 619 } | 653 } |
| 620 } | 654 } |
| 621 } // namespace v8::internal | 655 } // namespace v8::internal |
| OLD | NEW |