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

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

Issue 1255173002: Add regression test for 507979. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: GC: Refactor incremental marking w/ deadline into a separate call Created 5 years, 4 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') | no next file » | 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/v8.h" 5 #include "src/v8.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 4868 matching lines...) Expand 10 before | Expand all | Expand 10 after
4879 heap_state.scavenge_speed_in_bytes_per_ms = 4879 heap_state.scavenge_speed_in_bytes_per_ms =
4880 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); 4880 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond());
4881 heap_state.used_new_space_size = new_space_.Size(); 4881 heap_state.used_new_space_size = new_space_.Size();
4882 heap_state.new_space_capacity = new_space_.Capacity(); 4882 heap_state.new_space_capacity = new_space_.Capacity();
4883 heap_state.new_space_allocation_throughput_in_bytes_per_ms = 4883 heap_state.new_space_allocation_throughput_in_bytes_per_ms =
4884 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond(); 4884 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond();
4885 return heap_state; 4885 return heap_state;
4886 } 4886 }
4887 4887
4888 4888
4889 double Heap::AdvanceIncrementalMarking(
4890 double step_size_in_bytes, double deadline_in_ms,
4891 IncrementalMarking::ForceCompletionAction completion) {
4892 DCHECK(!incremental_marking()->IsStopped());
4893 double remaining_time_in_ms = 0.0;
4894 do {
4895 incremental_marking()->Step(step_size_in_bytes,
4896 IncrementalMarking::NO_GC_VIA_STACK_GUARD,
4897 IncrementalMarking::FORCE_MARKING, completion);
4898 remaining_time_in_ms = deadline_in_ms - MonotonicallyIncreasingTimeInMs();
4899 } while (remaining_time_in_ms >=
4900 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
4901 !incremental_marking()->IsComplete() &&
4902 !mark_compact_collector_.marking_deque()->IsEmpty());
4903 return remaining_time_in_ms;
4904 }
4905
4906
4889 bool Heap::PerformIdleTimeAction(GCIdleTimeAction action, 4907 bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
4890 GCIdleTimeHandler::HeapState heap_state, 4908 GCIdleTimeHandler::HeapState heap_state,
4891 double deadline_in_ms) { 4909 double deadline_in_ms) {
4892 bool result = false; 4910 bool result = false;
4893 switch (action.type) { 4911 switch (action.type) {
4894 case DONE: 4912 case DONE:
4895 result = true; 4913 result = true;
4896 break; 4914 break;
4897 case DO_INCREMENTAL_MARKING: { 4915 case DO_INCREMENTAL_MARKING: {
4898 DCHECK(!incremental_marking()->IsStopped()); 4916 const double remaining_idle_time_in_ms = AdvanceIncrementalMarking(
4899 double remaining_idle_time_in_ms = 0.0; 4917 action.parameter, deadline_in_ms,
4900 do { 4918 IncrementalMarking::DO_NOT_FORCE_COMPLETION);
4901 incremental_marking()->Step(
4902 action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
4903 IncrementalMarking::FORCE_MARKING,
4904 IncrementalMarking::DO_NOT_FORCE_COMPLETION);
4905 remaining_idle_time_in_ms =
4906 deadline_in_ms - MonotonicallyIncreasingTimeInMs();
4907 } while (remaining_idle_time_in_ms >=
4908 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
4909 !incremental_marking()->IsComplete() &&
4910 !mark_compact_collector_.marking_deque()->IsEmpty());
4911 if (remaining_idle_time_in_ms > 0.0) { 4919 if (remaining_idle_time_in_ms > 0.0) {
4912 action.additional_work = TryFinalizeIdleIncrementalMarking( 4920 action.additional_work = TryFinalizeIdleIncrementalMarking(
4913 remaining_idle_time_in_ms, heap_state.size_of_objects, 4921 remaining_idle_time_in_ms, heap_state.size_of_objects,
4914 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms); 4922 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms);
4915 } 4923 }
4916 break; 4924 break;
4917 } 4925 }
4918 case DO_FULL_GC: { 4926 case DO_FULL_GC: {
4919 DCHECK(contexts_disposed_ > 0); 4927 DCHECK(contexts_disposed_ > 0);
4920 HistogramTimerScope scope(isolate_->counters()->gc_context()); 4928 HistogramTimerScope scope(isolate_->counters()->gc_context());
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
6948 *object_type = "CODE_TYPE"; \ 6956 *object_type = "CODE_TYPE"; \
6949 *object_sub_type = "CODE_AGE/" #name; \ 6957 *object_sub_type = "CODE_AGE/" #name; \
6950 return true; 6958 return true;
6951 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6959 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6952 #undef COMPARE_AND_RETURN_NAME 6960 #undef COMPARE_AND_RETURN_NAME
6953 } 6961 }
6954 return false; 6962 return false;
6955 } 6963 }
6956 } // namespace internal 6964 } // namespace internal
6957 } // namespace v8 6965 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698