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

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

Issue 1314853002: [heap] Make the current GCCallbackFlags are part of {Heap}. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 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
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 new_space_allocation_counter_(0), 126 new_space_allocation_counter_(0),
127 old_generation_allocation_counter_(0), 127 old_generation_allocation_counter_(0),
128 old_generation_size_at_last_gc_(0), 128 old_generation_size_at_last_gc_(0),
129 gcs_since_last_deopt_(0), 129 gcs_since_last_deopt_(0),
130 allocation_sites_scratchpad_length_(0), 130 allocation_sites_scratchpad_length_(0),
131 ring_buffer_full_(false), 131 ring_buffer_full_(false),
132 ring_buffer_end_(0), 132 ring_buffer_end_(0),
133 promotion_queue_(this), 133 promotion_queue_(this),
134 configured_(false), 134 configured_(false),
135 current_gc_flags_(Heap::kNoGCFlags), 135 current_gc_flags_(Heap::kNoGCFlags),
136 current_gc_callback_flags_(GCCallbackFlags::kNoGCCallbackFlags),
136 external_string_table_(this), 137 external_string_table_(this),
137 chunks_queued_for_free_(NULL), 138 chunks_queued_for_free_(NULL),
138 pending_unmap_job_semaphore_(0), 139 pending_unmap_job_semaphore_(0),
139 gc_callbacks_depth_(0), 140 gc_callbacks_depth_(0),
140 deserialization_complete_(false), 141 deserialization_complete_(false),
141 concurrent_sweeping_enabled_(false), 142 concurrent_sweeping_enabled_(false),
142 strong_roots_list_(NULL) { 143 strong_roots_list_(NULL) {
143 // Allow build-time customization of the max semispace size. Building 144 // Allow build-time customization of the max semispace size. Building
144 // V8 with snapshots and a non-default max semispace size is much 145 // V8 with snapshots and a non-default max semispace size is much
145 // easier if you can define it as part of the build environment. 146 // easier if you can define it as part of the build environment.
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 } 735 }
735 // We must not compact the weak fixed list here, as we may be in the middle 736 // We must not compact the weak fixed list here, as we may be in the middle
736 // of writing to it, when the GC triggered. Instead, we reset the root value. 737 // of writing to it, when the GC triggered. Instead, we reset the root value.
737 set_weak_stack_trace_list(Smi::FromInt(0)); 738 set_weak_stack_trace_list(Smi::FromInt(0));
738 } 739 }
739 740
740 741
741 void Heap::HandleGCRequest() { 742 void Heap::HandleGCRequest() {
742 if (incremental_marking()->request_type() == 743 if (incremental_marking()->request_type() ==
743 IncrementalMarking::COMPLETE_MARKING) { 744 IncrementalMarking::COMPLETE_MARKING) {
744 CollectAllGarbage(current_gc_flags(), "GC interrupt", 745 CollectAllGarbage(current_gc_flags_, "GC interrupt",
745 incremental_marking()->CallbackFlags()); 746 current_gc_callback_flags_);
746 return; 747 return;
747 } 748 }
748 DCHECK(FLAG_overapproximate_weak_closure); 749 DCHECK(FLAG_overapproximate_weak_closure);
749 if (!incremental_marking()->weak_closure_was_overapproximated()) { 750 if (!incremental_marking()->weak_closure_was_overapproximated()) {
750 OverApproximateWeakClosure("GC interrupt"); 751 OverApproximateWeakClosure("GC interrupt");
751 } 752 }
752 } 753 }
753 754
754 755
755 void Heap::OverApproximateWeakClosure(const char* gc_reason) { 756 void Heap::OverApproximateWeakClosure(const char* gc_reason) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 941
941 if (collector == MARK_COMPACTOR && 942 if (collector == MARK_COMPACTOR &&
942 (gc_callback_flags & kGCCallbackFlagForced) != 0) { 943 (gc_callback_flags & kGCCallbackFlagForced) != 0) {
943 isolate()->CountUsage(v8::Isolate::kForcedGC); 944 isolate()->CountUsage(v8::Isolate::kForcedGC);
944 } 945 }
945 946
946 // Start incremental marking for the next cycle. The heap snapshot 947 // Start incremental marking for the next cycle. The heap snapshot
947 // generator needs incremental marking to stay off after it aborted. 948 // generator needs incremental marking to stay off after it aborted.
948 if (!ShouldAbortIncrementalMarking() && incremental_marking()->IsStopped() && 949 if (!ShouldAbortIncrementalMarking() && incremental_marking()->IsStopped() &&
949 incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) { 950 incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) {
950 incremental_marking()->Start(kNoGCFlags, kNoGCCallbackFlags, "GC epilogue"); 951 StartIncrementalMarking(kNoGCFlags, kNoGCCallbackFlags, "GC epilogue");
951 } 952 }
952 953
953 return next_gc_likely_to_collect_more; 954 return next_gc_likely_to_collect_more;
954 } 955 }
955 956
956 957
957 int Heap::NotifyContextDisposed(bool dependant_context) { 958 int Heap::NotifyContextDisposed(bool dependant_context) {
958 if (!dependant_context) { 959 if (!dependant_context) {
959 tracer()->ResetSurvivalEvents(); 960 tracer()->ResetSurvivalEvents();
960 old_generation_size_configured_ = false; 961 old_generation_size_configured_ = false;
(...skipping 10 matching lines...) Expand all
971 event.time_ms = MonotonicallyIncreasingTimeInMs(); 972 event.time_ms = MonotonicallyIncreasingTimeInMs();
972 memory_reducer_->NotifyContextDisposed(event); 973 memory_reducer_->NotifyContextDisposed(event);
973 return ++contexts_disposed_; 974 return ++contexts_disposed_;
974 } 975 }
975 976
976 977
977 void Heap::StartIncrementalMarking(int gc_flags, 978 void Heap::StartIncrementalMarking(int gc_flags,
978 const GCCallbackFlags gc_callback_flags, 979 const GCCallbackFlags gc_callback_flags,
979 const char* reason) { 980 const char* reason) {
980 DCHECK(incremental_marking()->IsStopped()); 981 DCHECK(incremental_marking()->IsStopped());
981 incremental_marking()->Start(gc_flags, gc_callback_flags, reason); 982 set_current_gc_flags(gc_flags);
983 current_gc_callback_flags_ = gc_callback_flags;
984 incremental_marking()->Start(reason);
982 } 985 }
983 986
984 987
985 void Heap::StartIdleIncrementalMarking() { 988 void Heap::StartIdleIncrementalMarking() {
986 gc_idle_time_handler_.ResetNoProgressCounter(); 989 gc_idle_time_handler_.ResetNoProgressCounter();
987 StartIncrementalMarking(kReduceMemoryFootprintMask, kNoGCCallbackFlags, 990 StartIncrementalMarking(kReduceMemoryFootprintMask, kNoGCCallbackFlags,
988 "idle"); 991 "idle");
989 } 992 }
990 993
991 994
(...skipping 3637 matching lines...) Expand 10 before | Expand all | Expand 10 after
4629 gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure( 4632 gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure(
4630 static_cast<size_t>(idle_time_in_ms))))) { 4633 static_cast<size_t>(idle_time_in_ms))))) {
4631 OverApproximateWeakClosure( 4634 OverApproximateWeakClosure(
4632 "Idle notification: overapproximate weak closure"); 4635 "Idle notification: overapproximate weak closure");
4633 return true; 4636 return true;
4634 } else if (incremental_marking()->IsComplete() || 4637 } else if (incremental_marking()->IsComplete() ||
4635 (mark_compact_collector_.marking_deque()->IsEmpty() && 4638 (mark_compact_collector_.marking_deque()->IsEmpty() &&
4636 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( 4639 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact(
4637 static_cast<size_t>(idle_time_in_ms), size_of_objects, 4640 static_cast<size_t>(idle_time_in_ms), size_of_objects,
4638 final_incremental_mark_compact_speed_in_bytes_per_ms))) { 4641 final_incremental_mark_compact_speed_in_bytes_per_ms))) {
4639 CollectAllGarbage(current_gc_flags(), 4642 CollectAllGarbage(current_gc_flags_,
4640 "idle notification: finalize incremental"); 4643 "idle notification: finalize incremental");
4641 return true; 4644 return true;
4642 } 4645 }
4643 return false; 4646 return false;
4644 } 4647 }
4645 4648
4646 4649
4647 GCIdleTimeHandler::HeapState Heap::ComputeHeapState() { 4650 GCIdleTimeHandler::HeapState Heap::ComputeHeapState() {
4648 GCIdleTimeHandler::HeapState heap_state; 4651 GCIdleTimeHandler::HeapState heap_state;
4649 heap_state.contexts_disposed = contexts_disposed_; 4652 heap_state.contexts_disposed = contexts_disposed_;
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
6772 *object_type = "CODE_TYPE"; \ 6775 *object_type = "CODE_TYPE"; \
6773 *object_sub_type = "CODE_AGE/" #name; \ 6776 *object_sub_type = "CODE_AGE/" #name; \
6774 return true; 6777 return true;
6775 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6778 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6776 #undef COMPARE_AND_RETURN_NAME 6779 #undef COMPARE_AND_RETURN_NAME
6777 } 6780 }
6778 return false; 6781 return false;
6779 } 6782 }
6780 } // namespace internal 6783 } // namespace internal
6781 } // namespace v8 6784 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698