1291 {
1294 }
1295
1296 Prologue();
1297 {
1299 const int num_tasks = FLAG_marker_tasks;
1300 if (num_tasks == 0) {
1303
1305 isolate_group_, page_space, &old_marking_stack_, &new_marking_stack_,
1306 &tlab_deferred_marking_stack_, &deferred_marking_stack_);
1307 visitor.set_concurrent(false);
1308 ResetSlices();
1309 IterateRoots(&visitor);
1310 visitor.FinishedRoots();
1311 visitor.ProcessDeferredMarking();
1312 visitor.DrainMarkingStack();
1313 visitor.ProcessDeferredMarking();
1314 visitor.FinalizeMarking();
1315 visitor.MournWeakProperties();
1316 visitor.MournWeakReferences();
1317 visitor.MournWeakArrays();
1318 visitor.MournFinalizerEntries();
1319 thread->ReleaseStoreBuffer();
1320 IterateWeakRoots(thread);
1321
1323 visitor.AddMicros(stop - start);
1324 marked_bytes_ += visitor.marked_bytes();
1325 marked_micros_ += visitor.marked_micros();
1326 } else {
1327 ThreadBarrier* barrier = new ThreadBarrier(num_tasks, 1);
1328
1329 ResetSlices();
1330
1331 RelaxedAtomic<uintptr_t> num_busy = 0;
1332
1333
1334 for (intptr_t
i = 0;
i < num_tasks; ++
i) {
1336
1337
1338 if (visitor == nullptr) {
1340 isolate_group_, page_space, &old_marking_stack_,
1341 &new_marking_stack_, &tlab_deferred_marking_stack_,
1342 &deferred_marking_stack_);
1343 visitors_[
i] = visitor;
1344 }
1345
1346
1347
1348
1349
1350 visitor->
Flush(&global_list_);
1351
1352
1353 if (
i < (num_tasks - 1)) {
1354
1356 this, isolate_group_, &old_marking_stack_, barrier, visitor,
1357 &num_busy);
1359 } else {
1360
1361 visitor->Adopt(&global_list_);
1363 barrier, visitor, &num_busy);
1364 task.RunEnteredIsolateGroup();
1365 barrier->Sync();
1366 barrier->Release();
1367 }
1368 }
1369
1370 for (intptr_t
i = 0;
i < num_tasks;
i++) {
1373 marked_bytes_ += visitor->marked_bytes();
1374 marked_micros_ += visitor->marked_micros();
1375 delete visitor;
1376 visitors_[
i] =
nullptr;
1377 }
1378
1380 }
1381 }
1382
1383
1384
1385 if (FLAG_verify_after_marking) {
1386 VerifyAfterMarkingVisitor visitor;
1387 heap_->VisitObjects(&visitor);
1388 if (visitor.failed()) {
1389 FATAL(
"verify after marking");
1390 }
1391 }
1392
1393 Epilogue();
1394}
static ThreadPool * thread_pool()
friend class ParallelMarkTask
void Flush(GCLinkedLists *global_list)
bool Run(Args &&... args)
MarkingVisitorBase< false > UnsyncMarkingVisitor