Flutter Engine
The Flutter Engine
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 ()
 
virtual void Run ()=0
 
- 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 167 of file sweeper.cc.

Constructor & Destructor Documentation

◆ ConcurrentSweeperTask()

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

Definition at line 169 of file sweeper.cc.

170 : isolate_group_(isolate_group) {
171 ASSERT(isolate_group != nullptr);
172 PageSpace* old_space = isolate_group->heap()->old_space();
173 MonitorLocker ml(old_space->tasks_lock());
174 old_space->set_tasks(old_space->tasks() + 1);
175 old_space->set_phase(PageSpace::kSweepingLarge);
176 }
@ kSweepingLarge
Definition: pages.h:134
#define ASSERT(E)

Member Function Documentation

◆ Run()

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

Implements dart::ThreadPool::Task.

Definition at line 178 of file sweeper.cc.

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

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