Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: src/heap/heap.cc

Issue 2304123003: [heap] Refactor incremental marking step. (Closed)
Patch Set: small fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/ast/context-slot-cache.h" 9 #include "src/ast/context-slot-cache.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 kGCCallbackFlagSynchronousPhantomCallbackProcessing); 916 kGCCallbackFlagSynchronousPhantomCallbackProcessing);
917 } 917 }
918 } else { 918 } else {
919 // Incremental marking is turned on an has already been started. 919 // Incremental marking is turned on an has already been started.
920 920
921 // TODO(mlippautz): Compute the time slice for incremental marking based on 921 // TODO(mlippautz): Compute the time slice for incremental marking based on
922 // memory pressure. 922 // memory pressure.
923 double deadline = MonotonicallyIncreasingTimeInMs() + 923 double deadline = MonotonicallyIncreasingTimeInMs() +
924 FLAG_external_allocation_limit_incremental_time; 924 FLAG_external_allocation_limit_incremental_time;
925 incremental_marking()->AdvanceIncrementalMarking( 925 incremental_marking()->AdvanceIncrementalMarking(
926 deadline, 926 deadline, IncrementalMarking::GC_VIA_STACK_GUARD,
927 IncrementalMarking::StepActions(IncrementalMarking::GC_VIA_STACK_GUARD, 927 IncrementalMarking::FORCE_COMPLETION);
928 IncrementalMarking::FORCE_MARKING,
929 IncrementalMarking::FORCE_COMPLETION));
930 } 928 }
931 } 929 }
932 930
933 931
934 void Heap::EnsureFillerObjectAtTop() { 932 void Heap::EnsureFillerObjectAtTop() {
935 // There may be an allocation memento behind objects in new space. Upon 933 // There may be an allocation memento behind objects in new space. Upon
936 // evacuation of a non-full new space (or if we are on the last page) there 934 // evacuation of a non-full new space (or if we are on the last page) there
937 // may be uninitialized memory behind top. We fill the remainder of the page 935 // may be uninitialized memory behind top. We fill the remainder of the page
938 // with a filler. 936 // with a filler.
939 Address to_top = new_space_.top(); 937 Address to_top = new_space_.top();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 } 1034 }
1037 1035
1038 if (collector == MARK_COMPACTOR && 1036 if (collector == MARK_COMPACTOR &&
1039 (gc_callback_flags & (kGCCallbackFlagForced | 1037 (gc_callback_flags & (kGCCallbackFlagForced |
1040 kGCCallbackFlagCollectAllAvailableGarbage)) != 0) { 1038 kGCCallbackFlagCollectAllAvailableGarbage)) != 0) {
1041 isolate()->CountUsage(v8::Isolate::kForcedGC); 1039 isolate()->CountUsage(v8::Isolate::kForcedGC);
1042 } 1040 }
1043 1041
1044 // Start incremental marking for the next cycle. The heap snapshot 1042 // Start incremental marking for the next cycle. The heap snapshot
1045 // generator needs incremental marking to stay off after it aborted. 1043 // generator needs incremental marking to stay off after it aborted.
1046 if (!ShouldAbortIncrementalMarking() && incremental_marking()->IsStopped() && 1044 if (!ShouldAbortIncrementalMarking()) {
1047 incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) { 1045 StartIncrementalMarkingIfNeeded(kNoGCFlags, kNoGCCallbackFlags,
1048 StartIncrementalMarking(kNoGCFlags, kNoGCCallbackFlags, "GC epilogue"); 1046 "GC epilogue");
1049 } 1047 }
1050 1048
1051 return next_gc_likely_to_collect_more; 1049 return next_gc_likely_to_collect_more;
1052 } 1050 }
1053 1051
1054 1052
1055 int Heap::NotifyContextDisposed(bool dependant_context) { 1053 int Heap::NotifyContextDisposed(bool dependant_context) {
1056 if (!dependant_context) { 1054 if (!dependant_context) {
1057 tracer()->ResetSurvivalEvents(); 1055 tracer()->ResetSurvivalEvents();
1058 old_generation_size_configured_ = false; 1056 old_generation_size_configured_ = false;
(...skipping 15 matching lines...) Expand all
1074 1072
1075 void Heap::StartIncrementalMarking(int gc_flags, 1073 void Heap::StartIncrementalMarking(int gc_flags,
1076 const GCCallbackFlags gc_callback_flags, 1074 const GCCallbackFlags gc_callback_flags,
1077 const char* reason) { 1075 const char* reason) {
1078 DCHECK(incremental_marking()->IsStopped()); 1076 DCHECK(incremental_marking()->IsStopped());
1079 set_current_gc_flags(gc_flags); 1077 set_current_gc_flags(gc_flags);
1080 current_gc_callback_flags_ = gc_callback_flags; 1078 current_gc_callback_flags_ = gc_callback_flags;
1081 incremental_marking()->Start(reason); 1079 incremental_marking()->Start(reason);
1082 } 1080 }
1083 1081
1082 void Heap::StartIncrementalMarkingIfNeeded(
1083 int gc_flags, const GCCallbackFlags gc_callback_flags, const char* reason) {
1084 if (incremental_marking()->IsStopped() &&
1085 incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) {
1086 StartIncrementalMarking(gc_flags, gc_callback_flags, reason);
1087 }
1088 }
1084 1089
1085 void Heap::StartIdleIncrementalMarking() { 1090 void Heap::StartIdleIncrementalMarking() {
1086 gc_idle_time_handler_->ResetNoProgressCounter(); 1091 gc_idle_time_handler_->ResetNoProgressCounter();
1087 StartIncrementalMarking(kReduceMemoryFootprintMask, kNoGCCallbackFlags, 1092 StartIncrementalMarking(kReduceMemoryFootprintMask, kNoGCCallbackFlags,
1088 "idle"); 1093 "idle");
1089 } 1094 }
1090 1095
1091 1096
1092 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, 1097 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index,
1093 int len) { 1098 int len) {
(...skipping 5416 matching lines...) Expand 10 before | Expand all | Expand 10 after
6510 } 6515 }
6511 6516
6512 6517
6513 // static 6518 // static
6514 int Heap::GetStaticVisitorIdForMap(Map* map) { 6519 int Heap::GetStaticVisitorIdForMap(Map* map) {
6515 return StaticVisitorBase::GetVisitorId(map); 6520 return StaticVisitorBase::GetVisitorId(map);
6516 } 6521 }
6517 6522
6518 } // namespace internal 6523 } // namespace internal
6519 } // namespace v8 6524 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.h » ('j') | src/heap/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698