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

Unified Diff: src/heap/heap.cc

Issue 1374203002: [heap] No leakage of incremental-marking.h outside of heap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 29437396add6b9312cff85f662a98a7bd046f775..dd9dc86d53786fedf3c60dc3d3a453d2826ffd79 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -124,7 +124,7 @@ Heap::Heap()
scavenge_collector_(nullptr),
mark_compact_collector_(nullptr),
store_buffer_(this),
- incremental_marking_(this),
+ incremental_marking_(nullptr),
gc_idle_time_handler_(nullptr),
memory_reducer_(nullptr),
object_stats_(nullptr),
@@ -865,6 +865,32 @@ void Heap::CollectAllAvailableGarbage(const char* gc_reason) {
}
+void Heap::ReportExternalMemoryPressure(const char* gc_reason) {
+ if (incremental_marking()->IsStopped()) {
+ if (incremental_marking()->CanBeActivated()) {
+ StartIncrementalMarking(
+ i::Heap::kNoGCFlags,
+ kGCCallbackFlagSynchronousPhantomCallbackProcessing, gc_reason);
+ } else {
+ CollectAllGarbage(i::Heap::kNoGCFlags, gc_reason,
+ kGCCallbackFlagSynchronousPhantomCallbackProcessing);
+ }
+ } else {
+ // Incremental marking is turned on an has already been started.
+
+ // TODO(mlippautz): Compute the time slice for incremental marking based on
+ // memory pressure.
+ double deadline = MonotonicallyIncreasingTimeInMs() +
+ FLAG_external_allocation_limit_incremental_time;
+ incremental_marking()->AdvanceIncrementalMarking(
+ 0, deadline,
+ IncrementalMarking::StepActions(IncrementalMarking::GC_VIA_STACK_GUARD,
+ IncrementalMarking::FORCE_MARKING,
+ IncrementalMarking::FORCE_COMPLETION));
+ }
+}
+
+
void Heap::EnsureFillerObjectAtTop() {
// There may be an allocation memento behind every object in new space.
// If we evacuate a not full new space or if we are on the last page of
@@ -4111,32 +4137,6 @@ GCIdleTimeHeapState Heap::ComputeHeapState() {
}
-double Heap::AdvanceIncrementalMarking(
- intptr_t step_size_in_bytes, double deadline_in_ms,
- IncrementalMarking::StepActions step_actions) {
- DCHECK(!incremental_marking()->IsStopped());
-
- if (step_size_in_bytes == 0) {
- step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize(
- static_cast<size_t>(GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs),
- static_cast<size_t>(
- tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()));
- }
-
- double remaining_time_in_ms = 0.0;
- do {
- incremental_marking()->Step(
- step_size_in_bytes, step_actions.completion_action,
- step_actions.force_marking, step_actions.force_completion);
- remaining_time_in_ms = deadline_in_ms - MonotonicallyIncreasingTimeInMs();
- } while (remaining_time_in_ms >=
- 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
- !incremental_marking()->IsComplete() &&
- !mark_compact_collector()->marking_deque()->IsEmpty());
- return remaining_time_in_ms;
-}
-
-
bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
GCIdleTimeHeapState heap_state,
double deadline_in_ms) {
@@ -5034,6 +5034,9 @@ bool Heap::SetUp() {
if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize()))
return false;
+ // Initialize incremental marking.
+ incremental_marking_ = new IncrementalMarking(this);
+
// Set up new space.
if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) {
return false;
@@ -5213,6 +5216,9 @@ void Heap::TearDown() {
mark_compact_collector_ = nullptr;
}
+ delete incremental_marking_;
+ incremental_marking_ = nullptr;
+
delete gc_idle_time_handler_;
gc_idle_time_handler_ = nullptr;
« 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