Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::ConcurrentSweeperTask Class Reference
Inheritance diagram for dart::ConcurrentSweeperTask:
dart::ThreadPool::Task dart::IntrusiveDListEntry< Task >

Public Member Functions

 ConcurrentSweeperTask (IsolateGroup *isolate_group)
 
virtual void Run ()
 
- Public Member Functions inherited from dart::ThreadPool::Task
virtual ~Task ()
 
- Public Member Functions inherited from dart::IntrusiveDListEntry< Task >
 IntrusiveDListEntry ()
 
 ~IntrusiveDListEntry ()
 

Additional Inherited Members

- Protected Member Functions inherited from dart::ThreadPool::Task
 Task ()
 

Detailed Description

Definition at line 165 of file sweeper.cc.

Constructor & Destructor Documentation

◆ ConcurrentSweeperTask()

dart::ConcurrentSweeperTask::ConcurrentSweeperTask ( IsolateGroup isolate_group)
inlineexplicit

Definition at line 167 of file sweeper.cc.

168 : isolate_group_(isolate_group) {
169 ASSERT(isolate_group != nullptr);
170 PageSpace* old_space = isolate_group->heap()->old_space();
171 MonitorLocker ml(old_space->tasks_lock());
172 old_space->set_tasks(old_space->tasks() + 1);
173 old_space->set_phase(PageSpace::kSweepingLarge);
174 }
#define ASSERT(E)

Member Function Documentation

◆ Run()

virtual void dart::ConcurrentSweeperTask::Run ( )
inlinevirtual

Implements dart::ThreadPool::Task.

Definition at line 176 of file sweeper.cc.

176 {
177 bool result = Thread::EnterIsolateGroupAsNonMutator(isolate_group_,
179 ASSERT(result);
180 PageSpace* old_space = isolate_group_->heap()->old_space();
181 {
182 Thread* thread = Thread::Current();
183 ASSERT(thread->BypassSafepoints()); // Or we should be checking in.
184 TIMELINE_FUNCTION_GC_DURATION(thread, "ConcurrentSweep");
185
186 old_space->SweepLarge();
187
188 {
189 MonitorLocker ml(old_space->tasks_lock());
190 ASSERT(old_space->phase() == PageSpace::kSweepingLarge);
191 old_space->set_phase(PageSpace::kSweepingRegular);
192 ml.NotifyAll();
193 }
194
195 old_space->Sweep(/*exclusive*/ false);
196 }
197 // Exit isolate cleanly *before* notifying it, to avoid shutdown race.
199 // This sweeper task is done. Notify the original isolate.
200 {
201 MonitorLocker ml(old_space->tasks_lock());
202 old_space->set_tasks(old_space->tasks() - 1);
203 ASSERT(old_space->phase() == PageSpace::kSweepingRegular);
204 old_space->set_phase(PageSpace::kDone);
205 ml.NotifyAll();
206 }
207 }
PageSpace * old_space()
Definition heap.h:63
Heap * heap() const
Definition isolate.h:295
static Thread * Current()
Definition thread.h:361
static void ExitIsolateGroupAsNonMutator()
Definition thread.cc:521
static bool EnterIsolateGroupAsNonMutator(IsolateGroup *isolate_group, TaskKind kind)
Definition thread.cc:506
GAsyncResult * result
#define TIMELINE_FUNCTION_GC_DURATION(thread, name)
Definition timeline.h:41

The documentation for this class was generated from the following file: