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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 } | 425 } |
427 | 426 |
428 | 427 |
429 void StoreBuffer::ClearInvalidStoreBufferEntries() { | 428 void StoreBuffer::ClearInvalidStoreBufferEntries() { |
430 Compact(); | 429 Compact(); |
431 Address* new_top = old_start_; | 430 Address* new_top = old_start_; |
432 for (Address* current = old_start_; current < old_top_; current++) { | 431 for (Address* current = old_start_; current < old_top_; current++) { |
433 Address addr = *current; | 432 Address addr = *current; |
434 Object** slot = reinterpret_cast<Object**>(*current); | 433 Object** slot = reinterpret_cast<Object**>(*current); |
435 // Use a NoBarrier_Load here since the slot can be in a dead object | 434 // Use a NoBarrier_Load here since the slot can be in a dead object |
436 // which may be touched by the concurrent sweeper thread. | 435 // which may be touched by the concurrent sweeper thread. |
Jarin
2015/03/16 11:32:59
Update (or remove?) the comment, please.
Hannes Payer (out of office)
2015/03/16 11:55:42
Done.
| |
437 Object* object = reinterpret_cast<Object*>( | 436 Object* object = *slot; |
438 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); | |
439 if (heap_->InNewSpace(object)) { | 437 if (heap_->InNewSpace(object)) { |
440 if (heap_->mark_compact_collector()->IsSlotInLiveObject( | 438 if (heap_->mark_compact_collector()->IsSlotInLiveObject( |
441 reinterpret_cast<HeapObject**>(slot), | 439 reinterpret_cast<HeapObject**>(slot), |
442 reinterpret_cast<HeapObject*>(object))) { | 440 reinterpret_cast<HeapObject*>(object))) { |
443 *new_top++ = addr; | 441 *new_top++ = addr; |
444 } | 442 } |
445 } | 443 } |
446 } | 444 } |
447 old_top_ = new_top; | 445 old_top_ = new_top; |
448 ClearFilteringHashSets(); | 446 ClearFilteringHashSets(); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 } | 633 } |
636 old_buffer_is_sorted_ = false; | 634 old_buffer_is_sorted_ = false; |
637 old_buffer_is_filtered_ = false; | 635 old_buffer_is_filtered_ = false; |
638 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 636 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
639 DCHECK(old_top_ <= old_limit_); | 637 DCHECK(old_top_ <= old_limit_); |
640 } | 638 } |
641 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 639 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
642 } | 640 } |
643 } | 641 } |
644 } // namespace v8::internal | 642 } // namespace v8::internal |
OLD | NEW |