1355 {
1356 ASSERT(thread !=
nullptr);
1357 OSThread* os_thread = thread->os_thread();
1358 ASSERT(os_thread !=
nullptr);
1359 Isolate* isolate = thread->isolate();
1360
1361
1363 counters_.bail_out_unknown_task.fetch_add(1);
1364 return;
1365 }
1366
1368
1369
1370
1371 counters_.bail_out_jump_to_exception_handler.fetch_add(1);
1372 return;
1373 }
1374
1375 const bool in_dart_code = thread->IsExecutingDartCode();
1376
1377 uintptr_t sp = 0;
1379 uintptr_t pc =
state.pc;
1380 uintptr_t lr =
state.lr;
1381#if defined(USING_SIMULATOR)
1382 Simulator* simulator = nullptr;
1383#endif
1384
1385 if (in_dart_code) {
1386
1387#if defined(USING_SIMULATOR)
1388 simulator = isolate->simulator();
1389 sp = simulator->get_register(
SPREG);
1390 fp = simulator->get_register(
FPREG);
1391 pc = simulator->get_pc();
1392 lr = simulator->get_lr();
1393#else
1395#endif
1396 } else {
1397
1399 }
1400
1402 counters_.bail_out_check_isolate.fetch_add(1);
1403 return;
1404 }
1405
1408
1409 return;
1410 }
1411
1412
1414 SetupSample(thread,
false, os_thread->trace_id());
1415 if (sample == nullptr) {
1416
1417 counters_.sample_allocation_failure++;
1418 return;
1419 }
1420
1421 if (thread->IsDartMutatorThread()) {
1422 if (isolate->IsDeoptimizing()) {
1423 counters_.single_frame_sample_deoptimizing.fetch_add(1);
1424 SampleThreadSingleFrame(thread, sample, pc);
1425 return;
1426 }
1427 }
1428
1429 uword stack_lower = 0;
1430 uword stack_upper = 0;
1432 &stack_upper)) {
1433 counters_.single_frame_sample_get_and_validate_stack_bounds.fetch_add(1);
1434
1435 SampleThreadSingleFrame(thread, sample, pc);
1436 return;
1437 }
1438
1439
1440
1441
1442
1443 VMTagCounters*
counters = isolate->vm_tag_counters();
1445 if (thread->IsDartMutatorThread()) {
1446 counters->Increment(sample->vm_tag());
1447 }
1448
1449 ProfilerNativeStackWalker native_stack_walker(
1450 &counters_, (isolate !=
nullptr) ? isolate->main_port() :
ILLEGAL_PORT,
1451 sample, isolate->current_sample_block(), stack_lower, stack_upper, pc,
fp,
1452 sp);
1453 const bool exited_dart_code = thread->HasExitedDartCode();
1454 ProfilerDartStackWalker dart_stack_walker(
1455 thread, sample, isolate->current_sample_block(), pc,
fp, sp, lr,
1456 false);
1457
1458
1459 CollectSample(isolate, exited_dart_code, in_dart_code, sample,
1460 &native_stack_walker, &dart_stack_walker, pc,
fp, sp,
1461 &counters_);
1462}
static ProfilerCounters counters()
static bool HasBeenInitialized()
static bool InJumpToFrameStub(uword pc)
static void CollectSample(Isolate *isolate, bool exited_dart_code, bool in_dart_code, Sample *sample, ProfilerNativeStackWalker *native_stack_walker, ProfilerDartStackWalker *dart_stack_walker, uword pc, uword fp, uword sp, ProfilerCounters *counters)