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/heap/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 int limit = marking_deque->top(); | 788 int limit = marking_deque->top(); |
789 HeapObject** array = marking_deque->array(); | 789 HeapObject** array = marking_deque->array(); |
790 int new_top = current; | 790 int new_top = current; |
791 | 791 |
792 Map* filler_map = heap_->one_pointer_filler_map(); | 792 Map* filler_map = heap_->one_pointer_filler_map(); |
793 | 793 |
794 while (current != limit) { | 794 while (current != limit) { |
795 HeapObject* obj = array[current]; | 795 HeapObject* obj = array[current]; |
796 DCHECK(obj->IsHeapObject()); | 796 DCHECK(obj->IsHeapObject()); |
797 current = ((current + 1) & mask); | 797 current = ((current + 1) & mask); |
798 if (heap_->InNewSpace(obj)) { | 798 // Only pointers to from space have to be updated. |
| 799 if (heap_->InFromSpace(obj)) { |
799 MapWord map_word = obj->map_word(); | 800 MapWord map_word = obj->map_word(); |
| 801 // There may be objects on the marking deque that do not exist anymore, |
| 802 // e.g. left trimmed objects or objects from the root set (frames). |
| 803 // If these object are dead at scavenging time, their marking deque |
| 804 // entries will not point to forwarding addresses. Hence, we can discard |
| 805 // them. |
800 if (map_word.IsForwardingAddress()) { | 806 if (map_word.IsForwardingAddress()) { |
801 HeapObject* dest = map_word.ToForwardingAddress(); | 807 HeapObject* dest = map_word.ToForwardingAddress(); |
802 array[new_top] = dest; | 808 array[new_top] = dest; |
803 new_top = ((new_top + 1) & mask); | 809 new_top = ((new_top + 1) & mask); |
804 DCHECK(new_top != marking_deque->bottom()); | 810 DCHECK(new_top != marking_deque->bottom()); |
805 #ifdef DEBUG | 811 #ifdef DEBUG |
806 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 812 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
807 DCHECK(Marking::IsGrey(mark_bit) || | 813 DCHECK(Marking::IsGrey(mark_bit) || |
808 (obj->IsFiller() && Marking::IsWhite(mark_bit))); | 814 (obj->IsFiller() && Marking::IsWhite(mark_bit))); |
809 #endif | 815 #endif |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1240 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1235 idle_marking_delay_counter_++; | 1241 idle_marking_delay_counter_++; |
1236 } | 1242 } |
1237 | 1243 |
1238 | 1244 |
1239 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1245 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1240 idle_marking_delay_counter_ = 0; | 1246 idle_marking_delay_counter_ = 0; |
1241 } | 1247 } |
1242 } // namespace internal | 1248 } // namespace internal |
1243 } // namespace v8 | 1249 } // namespace v8 |
OLD | NEW |