OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/heap/incremental-marking.h" | 7 #include "src/heap/incremental-marking.h" |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 MarkBit mark_bit = Marking::MarkBitFrom(HeapObject::cast(obj)); | 128 MarkBit mark_bit = Marking::MarkBitFrom(HeapObject::cast(obj)); |
129 if (Marking::IsBlack(mark_bit)) { | 129 if (Marking::IsBlack(mark_bit)) { |
130 MemoryChunk::IncrementLiveBytesFromGC(heap_obj->address(), | 130 MemoryChunk::IncrementLiveBytesFromGC(heap_obj->address(), |
131 -heap_obj->Size()); | 131 -heap_obj->Size()); |
132 } | 132 } |
133 Marking::AnyToGrey(mark_bit); | 133 Marking::AnyToGrey(mark_bit); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 | 137 |
| 138 static inline void MarkBlackOrKeepGrey(HeapObject* heap_object, |
| 139 MarkBit mark_bit, int size) { |
| 140 DCHECK(!Marking::IsImpossible(mark_bit)); |
| 141 if (mark_bit.Get()) return; |
| 142 mark_bit.Set(); |
| 143 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), size); |
| 144 DCHECK(Marking::IsBlack(mark_bit)); |
| 145 } |
| 146 |
| 147 |
138 static inline void MarkBlackOrKeepBlack(HeapObject* heap_object, | 148 static inline void MarkBlackOrKeepBlack(HeapObject* heap_object, |
139 MarkBit mark_bit, int size) { | 149 MarkBit mark_bit, int size) { |
140 DCHECK(!Marking::IsImpossible(mark_bit)); | 150 DCHECK(!Marking::IsImpossible(mark_bit)); |
141 if (Marking::IsBlack(mark_bit)) return; | 151 if (Marking::IsBlack(mark_bit)) return; |
142 Marking::MarkBlack(mark_bit); | 152 Marking::MarkBlack(mark_bit); |
143 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), size); | 153 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), size); |
144 DCHECK(Marking::IsBlack(mark_bit)); | 154 DCHECK(Marking::IsBlack(mark_bit)); |
145 } | 155 } |
146 | 156 |
147 | 157 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 NewSpace* space) { | 349 NewSpace* space) { |
340 NewSpacePageIterator it(space); | 350 NewSpacePageIterator it(space); |
341 while (it.has_next()) { | 351 while (it.has_next()) { |
342 NewSpacePage* p = it.next(); | 352 NewSpacePage* p = it.next(); |
343 SetNewSpacePageFlags(p, false); | 353 SetNewSpacePageFlags(p, false); |
344 } | 354 } |
345 } | 355 } |
346 | 356 |
347 | 357 |
348 void IncrementalMarking::DeactivateIncrementalWriteBarrier() { | 358 void IncrementalMarking::DeactivateIncrementalWriteBarrier() { |
349 DeactivateIncrementalWriteBarrierForSpace(heap_->old_space()); | 359 DeactivateIncrementalWriteBarrierForSpace(heap_->old_pointer_space()); |
| 360 DeactivateIncrementalWriteBarrierForSpace(heap_->old_data_space()); |
350 DeactivateIncrementalWriteBarrierForSpace(heap_->cell_space()); | 361 DeactivateIncrementalWriteBarrierForSpace(heap_->cell_space()); |
351 DeactivateIncrementalWriteBarrierForSpace(heap_->map_space()); | 362 DeactivateIncrementalWriteBarrierForSpace(heap_->map_space()); |
352 DeactivateIncrementalWriteBarrierForSpace(heap_->code_space()); | 363 DeactivateIncrementalWriteBarrierForSpace(heap_->code_space()); |
353 DeactivateIncrementalWriteBarrierForSpace(heap_->new_space()); | 364 DeactivateIncrementalWriteBarrierForSpace(heap_->new_space()); |
354 | 365 |
355 LargePage* lop = heap_->lo_space()->first_page(); | 366 LargePage* lop = heap_->lo_space()->first_page(); |
356 while (lop->is_valid()) { | 367 while (lop->is_valid()) { |
357 SetOldSpacePageFlags(lop, false, false); | 368 SetOldSpacePageFlags(lop, false, false); |
358 lop = lop->next_page(); | 369 lop = lop->next_page(); |
359 } | 370 } |
(...skipping 12 matching lines...) Expand all Loading... |
372 void IncrementalMarking::ActivateIncrementalWriteBarrier(NewSpace* space) { | 383 void IncrementalMarking::ActivateIncrementalWriteBarrier(NewSpace* space) { |
373 NewSpacePageIterator it(space->ToSpaceStart(), space->ToSpaceEnd()); | 384 NewSpacePageIterator it(space->ToSpaceStart(), space->ToSpaceEnd()); |
374 while (it.has_next()) { | 385 while (it.has_next()) { |
375 NewSpacePage* p = it.next(); | 386 NewSpacePage* p = it.next(); |
376 SetNewSpacePageFlags(p, true); | 387 SetNewSpacePageFlags(p, true); |
377 } | 388 } |
378 } | 389 } |
379 | 390 |
380 | 391 |
381 void IncrementalMarking::ActivateIncrementalWriteBarrier() { | 392 void IncrementalMarking::ActivateIncrementalWriteBarrier() { |
382 ActivateIncrementalWriteBarrier(heap_->old_space()); | 393 ActivateIncrementalWriteBarrier(heap_->old_pointer_space()); |
| 394 ActivateIncrementalWriteBarrier(heap_->old_data_space()); |
383 ActivateIncrementalWriteBarrier(heap_->cell_space()); | 395 ActivateIncrementalWriteBarrier(heap_->cell_space()); |
384 ActivateIncrementalWriteBarrier(heap_->map_space()); | 396 ActivateIncrementalWriteBarrier(heap_->map_space()); |
385 ActivateIncrementalWriteBarrier(heap_->code_space()); | 397 ActivateIncrementalWriteBarrier(heap_->code_space()); |
386 ActivateIncrementalWriteBarrier(heap_->new_space()); | 398 ActivateIncrementalWriteBarrier(heap_->new_space()); |
387 | 399 |
388 LargePage* lop = heap_->lo_space()->first_page(); | 400 LargePage* lop = heap_->lo_space()->first_page(); |
389 while (lop->is_valid()) { | 401 while (lop->is_valid()) { |
390 SetOldSpacePageFlags(lop, true, is_compacting_); | 402 SetOldSpacePageFlags(lop, true, is_compacting_); |
391 lop = lop->next_page(); | 403 lop = lop->next_page(); |
392 } | 404 } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 (obj->IsFiller() && Marking::IsWhite(mark_bit)) || | 647 (obj->IsFiller() && Marking::IsWhite(mark_bit)) || |
636 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && | 648 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && |
637 Marking::IsBlack(mark_bit))); | 649 Marking::IsBlack(mark_bit))); |
638 #endif | 650 #endif |
639 MarkBlackOrKeepBlack(obj, mark_bit, size); | 651 MarkBlackOrKeepBlack(obj, mark_bit, size); |
640 } | 652 } |
641 | 653 |
642 | 654 |
643 void IncrementalMarking::MarkObject(Heap* heap, HeapObject* obj) { | 655 void IncrementalMarking::MarkObject(Heap* heap, HeapObject* obj) { |
644 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 656 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
645 if (Marking::IsWhite(mark_bit)) { | 657 if (mark_bit.data_only()) { |
| 658 MarkBlackOrKeepGrey(obj, mark_bit, obj->Size()); |
| 659 } else if (Marking::IsWhite(mark_bit)) { |
646 heap->incremental_marking()->WhiteToGreyAndPush(obj, mark_bit); | 660 heap->incremental_marking()->WhiteToGreyAndPush(obj, mark_bit); |
647 } | 661 } |
648 } | 662 } |
649 | 663 |
650 | 664 |
651 intptr_t IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) { | 665 intptr_t IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) { |
652 intptr_t bytes_processed = 0; | 666 intptr_t bytes_processed = 0; |
653 Map* filler_map = heap_->one_pointer_filler_map(); | 667 Map* filler_map = heap_->one_pointer_filler_map(); |
654 MarkingDeque* marking_deque = | 668 MarkingDeque* marking_deque = |
655 heap_->mark_compact_collector()->marking_deque(); | 669 heap_->mark_compact_collector()->marking_deque(); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1025 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1012 idle_marking_delay_counter_++; | 1026 idle_marking_delay_counter_++; |
1013 } | 1027 } |
1014 | 1028 |
1015 | 1029 |
1016 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1030 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1017 idle_marking_delay_counter_ = 0; | 1031 idle_marking_delay_counter_ = 0; |
1018 } | 1032 } |
1019 } | 1033 } |
1020 } // namespace v8::internal | 1034 } // namespace v8::internal |
OLD | NEW |