Commit 46563081 authored by ulan's avatar ulan Committed by Commit bot

Pass GC flags to incremental marker and start incremental marking with

reduce memory footprint in idle notification.

BUG=

Review URL: https://codereview.chromium.org/1156463002

Cr-Commit-Position: refs/heads/master@{#28567}
parent 3f162d41
......@@ -957,7 +957,7 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason,
if (!mark_compact_collector()->abort_incremental_marking() &&
incremental_marking()->IsStopped() &&
incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) {
incremental_marking()->Start();
incremental_marking()->Start(kNoGCFlags);
}
return next_gc_likely_to_collect_more;
......@@ -4654,8 +4654,8 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
break;
case DO_INCREMENTAL_MARKING: {
if (incremental_marking()->IsStopped()) {
// TODO(ulan): take reduce_memory into account.
incremental_marking()->Start();
incremental_marking()->Start(
action.reduce_memory ? kReduceMemoryFootprintMask : kNoGCFlags);
}
double remaining_idle_time_in_ms = 0.0;
do {
......
......@@ -467,7 +467,7 @@ static void PatchIncrementalMarkingRecordWriteStubs(
}
void IncrementalMarking::Start() {
void IncrementalMarking::Start(int mark_compact_flags) {
if (FLAG_trace_incremental_marking) {
PrintF("[IncrementalMarking] Start\n");
}
......@@ -482,7 +482,9 @@ void IncrementalMarking::Start() {
was_activated_ = true;
if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
heap_->mark_compact_collector()->SetFlags(mark_compact_flags);
StartMarking();
heap_->mark_compact_collector()->SetFlags(Heap::kNoGCFlags);
} else {
if (FLAG_trace_incremental_marking) {
PrintF("[IncrementalMarking] Start sweeping.\n");
......@@ -831,7 +833,7 @@ void IncrementalMarking::Epilogue() {
void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) {
Start();
Start(Heap::kNoGCFlags);
} else {
Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD);
}
......
......@@ -67,7 +67,7 @@ class IncrementalMarking {
bool WasActivated();
void Start();
void Start(int mark_compact_flags);
void Stop();
......
......@@ -561,7 +561,7 @@ static inline void SimulateIncrementalMarking(i::Heap* heap) {
}
CHECK(marking->IsMarking() || marking->IsStopped());
if (marking->IsStopped()) {
marking->Start();
marking->Start(i::Heap::kNoGCFlags);
}
CHECK(marking->IsMarking());
while (!marking->IsComplete()) {
......
......@@ -2129,7 +2129,7 @@ TEST(InstanceOfStubWriteBarrier) {
IncrementalMarking* marking = CcTest::heap()->incremental_marking();
marking->Abort();
marking->Start();
marking->Start(Heap::kNoGCFlags);
Handle<JSFunction> f =
v8::Utils::OpenHandle(
......@@ -2255,7 +2255,7 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
IncrementalMarking* marking = CcTest::heap()->incremental_marking();
marking->Abort();
marking->Start();
marking->Start(Heap::kNoGCFlags);
// The following calls will increment CcTest::heap()->global_ic_age().
CcTest::isolate()->ContextDisposedNotification();
SimulateIncrementalMarking(CcTest::heap());
......@@ -2313,7 +2313,7 @@ TEST(IdleNotificationFinishMarking) {
SimulateFullSpace(CcTest::heap()->old_space());
IncrementalMarking* marking = CcTest::heap()->incremental_marking();
marking->Abort();
marking->Start();
marking->Start(Heap::kNoGCFlags);
CHECK_EQ(CcTest::heap()->gc_count(), 0);
......@@ -4123,7 +4123,7 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
"};"
"f(10 * 1024 * 1024);");
IncrementalMarking* marking = CcTest::heap()->incremental_marking();
if (marking->IsStopped()) marking->Start();
if (marking->IsStopped()) marking->Start(Heap::kNoGCFlags);
// This big step should be sufficient to mark the whole array.
marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
DCHECK(marking->IsComplete() ||
......@@ -4851,7 +4851,7 @@ TEST(WeakCellsWithIncrementalMarking) {
Handle<WeakCell> weak_cell = factory->NewWeakCell(value);
CHECK(weak_cell->value()->IsFixedArray());
IncrementalMarking* marking = heap->incremental_marking();
if (marking->IsStopped()) marking->Start();
if (marking->IsStopped()) marking->Start(Heap::kNoGCFlags);
marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
heap->CollectGarbage(NEW_SPACE);
CHECK(weak_cell->value()->IsFixedArray());
......@@ -5119,7 +5119,7 @@ TEST(Regress388880) {
// that would cause crash.
IncrementalMarking* marking = CcTest::heap()->incremental_marking();
marking->Abort();
marking->Start();
marking->Start(Heap::kNoGCFlags);
CHECK(marking->IsMarking());
// Now everything is set up for crashing in JSObject::MigrateFastToFast()
......@@ -5145,7 +5145,7 @@ TEST(Regress3631) {
"}"
"weak_map");
if (marking->IsStopped()) {
marking->Start();
marking->Start(Heap::kNoGCFlags);
}
// Incrementally mark the backing store.
Handle<JSObject> obj =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment