Chromium Code Reviews| 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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 939 PrintF("[IncrementalMarking] Stopping.\n"); | 939 PrintF("[IncrementalMarking] Stopping.\n"); |
| 940 } | 940 } |
| 941 | 941 |
| 942 heap_->new_space()->RemoveInlineAllocationObserver(&observer_); | 942 heap_->new_space()->RemoveInlineAllocationObserver(&observer_); |
| 943 IncrementalMarking::set_should_hurry(false); | 943 IncrementalMarking::set_should_hurry(false); |
| 944 ResetStepCounters(); | 944 ResetStepCounters(); |
| 945 if (IsMarking()) { | 945 if (IsMarking()) { |
| 946 PatchIncrementalMarkingRecordWriteStubs(heap_, | 946 PatchIncrementalMarkingRecordWriteStubs(heap_, |
| 947 RecordWriteStub::STORE_BUFFER_ONLY); | 947 RecordWriteStub::STORE_BUFFER_ONLY); |
| 948 DeactivateIncrementalWriteBarrier(); | 948 DeactivateIncrementalWriteBarrier(); |
| 949 | |
| 950 if (is_compacting_) { | |
| 951 LargeObjectIterator it(heap_->lo_space()); | |
| 952 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | |
| 953 Page* p = Page::FromAddress(obj->address()); | |
| 954 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { | |
| 955 p->ClearFlag(Page::RESCAN_ON_EVACUATION); | |
|
ulan
2016/01/28 16:41:24
Without this code, the flag becomes sticky, i.e. l
| |
| 956 } | |
| 957 } | |
| 958 } | |
| 959 } | 949 } |
| 960 heap_->isolate()->stack_guard()->ClearGC(); | 950 heap_->isolate()->stack_guard()->ClearGC(); |
| 961 state_ = STOPPED; | 951 state_ = STOPPED; |
| 962 is_compacting_ = false; | 952 is_compacting_ = false; |
| 963 } | 953 } |
| 964 | 954 |
| 965 | 955 |
| 966 void IncrementalMarking::Finalize() { | 956 void IncrementalMarking::Finalize() { |
| 967 Hurry(); | 957 Hurry(); |
| 968 state_ = STOPPED; | 958 Stop(); |
| 969 is_compacting_ = false; | |
| 970 | |
| 971 heap_->new_space()->RemoveInlineAllocationObserver(&observer_); | |
| 972 IncrementalMarking::set_should_hurry(false); | |
| 973 ResetStepCounters(); | |
| 974 PatchIncrementalMarkingRecordWriteStubs(heap_, | |
| 975 RecordWriteStub::STORE_BUFFER_ONLY); | |
| 976 DeactivateIncrementalWriteBarrier(); | |
| 977 DCHECK(heap_->mark_compact_collector()->marking_deque()->IsEmpty()); | |
| 978 heap_->isolate()->stack_guard()->ClearGC(); | |
| 979 } | 959 } |
| 980 | 960 |
| 981 | 961 |
| 982 void IncrementalMarking::FinalizeMarking(CompletionAction action) { | 962 void IncrementalMarking::FinalizeMarking(CompletionAction action) { |
| 983 DCHECK(!finalize_marking_completed_); | 963 DCHECK(!finalize_marking_completed_); |
| 984 if (FLAG_trace_incremental_marking) { | 964 if (FLAG_trace_incremental_marking) { |
| 985 PrintF( | 965 PrintF( |
| 986 "[IncrementalMarking] requesting finalization of incremental " | 966 "[IncrementalMarking] requesting finalization of incremental " |
| 987 "marking.\n"); | 967 "marking.\n"); |
| 988 } | 968 } |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1246 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1226 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1247 idle_marking_delay_counter_++; | 1227 idle_marking_delay_counter_++; |
| 1248 } | 1228 } |
| 1249 | 1229 |
| 1250 | 1230 |
| 1251 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1231 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1252 idle_marking_delay_counter_ = 0; | 1232 idle_marking_delay_counter_ = 0; |
| 1253 } | 1233 } |
| 1254 } // namespace internal | 1234 } // namespace internal |
| 1255 } // namespace v8 | 1235 } // namespace v8 |
| OLD | NEW |