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

Unified Diff: src/heap/incremental-marking.cc

Issue 1404523002: [heap] inline allocation steps refactor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: generalize the step observer interface Created 5 years, 2 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
Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc
index 3e5e6c0697cd505bf49880d407891ef8f938458a..e900d26d156dcef83a3e659033d1194d88b7e00b 100644
--- a/src/heap/incremental-marking.cc
+++ b/src/heap/incremental-marking.cc
@@ -546,6 +546,12 @@ static void PatchIncrementalMarkingRecordWriteStubs(
}
+static void IncrementalMarkingStepCallback(int bytes_allocated, void* arg) {
+ auto im = static_cast<IncrementalMarking*>(arg);
+ im->Step(bytes_allocated, IncrementalMarking::GC_VIA_STACK_GUARD);
+}
+
+
void IncrementalMarking::Start(const char* reason) {
if (FLAG_trace_incremental_marking) {
PrintF("[IncrementalMarking] Start (%s)\n",
@@ -569,7 +575,9 @@ void IncrementalMarking::Start(const char* reason) {
state_ = SWEEPING;
}
- heap_->LowerInlineAllocationLimit(kAllocatedThreshold);
+ heap_->new_space()->AddInlineAllocationObserver(
+ kAllocatedThreshold, IncrementalMarkingStepCallback, this);
+
incremental_marking_job()->Start(heap_);
}
@@ -821,7 +829,9 @@ void IncrementalMarking::Stop() {
if (FLAG_trace_incremental_marking) {
PrintF("[IncrementalMarking] Stopping.\n");
}
- heap_->ResetInlineAllocationLimit();
+ heap_->new_space()->RemoveInlineAllocationObserver(
+ IncrementalMarkingStepCallback);
+
IncrementalMarking::set_should_hurry(false);
ResetStepCounters();
if (IsMarking()) {
@@ -849,7 +859,8 @@ void IncrementalMarking::Finalize() {
Hurry();
state_ = STOPPED;
is_compacting_ = false;
- heap_->ResetInlineAllocationLimit();
+ heap_->new_space()->RemoveInlineAllocationObserver(
+ IncrementalMarkingStepCallback);
IncrementalMarking::set_should_hurry(false);
ResetStepCounters();
PatchIncrementalMarkingRecordWriteStubs(heap_,
« no previous file with comments | « src/heap/incremental-marking.h ('k') | src/heap/spaces.h » ('j') | src/heap/spaces.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698