| 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" | |
| 10 #include "src/counters.h" | 9 #include "src/counters.h" |
| 11 #include "src/heap/store-buffer-inl.h" | 10 #include "src/heap/store-buffer-inl.h" |
| 12 | 11 |
| 13 namespace v8 { | 12 namespace v8 { |
| 14 namespace internal { | 13 namespace internal { |
| 15 | 14 |
| 16 StoreBuffer::StoreBuffer(Heap* heap) | 15 StoreBuffer::StoreBuffer(Heap* heap) |
| 17 : heap_(heap), | 16 : heap_(heap), |
| 18 start_(NULL), | 17 start_(NULL), |
| 19 limit_(NULL), | 18 limit_(NULL), |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } | 355 } |
| 357 } | 356 } |
| 358 | 357 |
| 359 | 358 |
| 360 void StoreBuffer::ClearInvalidStoreBufferEntries() { | 359 void StoreBuffer::ClearInvalidStoreBufferEntries() { |
| 361 Compact(); | 360 Compact(); |
| 362 Address* new_top = old_start_; | 361 Address* new_top = old_start_; |
| 363 for (Address* current = old_start_; current < old_top_; current++) { | 362 for (Address* current = old_start_; current < old_top_; current++) { |
| 364 Address addr = *current; | 363 Address addr = *current; |
| 365 Object** slot = reinterpret_cast<Object**>(*current); | 364 Object** slot = reinterpret_cast<Object**>(*current); |
| 366 // Use a NoBarrier_Load here since the slot can be in a dead object | 365 Object* object = *slot; |
| 367 // which may be touched by the concurrent sweeper thread. | |
| 368 Object* object = reinterpret_cast<Object*>( | |
| 369 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); | |
| 370 if (heap_->InNewSpace(object)) { | 366 if (heap_->InNewSpace(object)) { |
| 371 if (heap_->mark_compact_collector()->IsSlotInLiveObject( | 367 if (heap_->mark_compact_collector()->IsSlotInLiveObject( |
| 372 reinterpret_cast<HeapObject**>(slot), | 368 reinterpret_cast<HeapObject**>(slot), |
| 373 reinterpret_cast<HeapObject*>(object))) { | 369 reinterpret_cast<HeapObject*>(object))) { |
| 374 *new_top++ = addr; | 370 *new_top++ = addr; |
| 375 } | 371 } |
| 376 } | 372 } |
| 377 } | 373 } |
| 378 old_top_ = new_top; | 374 old_top_ = new_top; |
| 379 ClearFilteringHashSets(); | 375 ClearFilteringHashSets(); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 } | 562 } |
| 567 old_buffer_is_sorted_ = false; | 563 old_buffer_is_sorted_ = false; |
| 568 old_buffer_is_filtered_ = false; | 564 old_buffer_is_filtered_ = false; |
| 569 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 565 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
| 570 DCHECK(old_top_ <= old_limit_); | 566 DCHECK(old_top_ <= old_limit_); |
| 571 } | 567 } |
| 572 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 568 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
| 573 } | 569 } |
| 574 } | 570 } |
| 575 } // namespace v8::internal | 571 } // namespace v8::internal |
| OLD | NEW |