1349 {
1350 ASSERT(thread !=
nullptr);
1351 OSThread* os_thread = thread->os_thread();
1352 ASSERT(os_thread !=
nullptr);
1353 Isolate* isolate = thread->isolate();
1354
1355
1357 counters_.bail_out_unknown_task.fetch_add(1);
1358 return;
1359 }
1360
1362
1363
1364
1365 counters_.bail_out_jump_to_exception_handler.fetch_add(1);
1366 return;
1367 }
1368
1369 const bool in_dart_code = thread->IsExecutingDartCode();
1370
1371 uintptr_t sp = 0;
1373 uintptr_t pc =
state.pc;
1374 uintptr_t lr =
state.lr;
1375#if defined(USING_SIMULATOR)
1376 Simulator* simulator = nullptr;
1377#endif
1378
1379 if (in_dart_code) {
1380
1381#if defined(USING_SIMULATOR)
1382 simulator = isolate->simulator();
1383 sp = simulator->get_register(
SPREG);
1384 fp = simulator->get_register(
FPREG);
1385 pc = simulator->get_pc();
1386 lr = simulator->get_lr();
1387#else
1389#endif
1390 } else {
1391
1393 }
1394
1396 counters_.bail_out_check_isolate.fetch_add(1);
1397 return;
1398 }
1399
1402
1403 return;
1404 }
1405
1406
1408 SetupSample(thread,
false, os_thread->trace_id());
1409 if (sample == nullptr) {
1410
1411 counters_.sample_allocation_failure++;
1412 return;
1413 }
1414
1415 if (thread->IsDartMutatorThread()) {
1416 if (isolate->IsDeoptimizing()) {
1417 counters_.single_frame_sample_deoptimizing.fetch_add(1);
1418 SampleThreadSingleFrame(thread, sample, pc);
1419 return;
1420 }
1421 }
1422
1423 uword stack_lower = 0;
1424 uword stack_upper = 0;
1426 &stack_upper)) {
1427 counters_.single_frame_sample_get_and_validate_stack_bounds.fetch_add(1);
1428
1429 SampleThreadSingleFrame(thread, sample, pc);
1430 return;
1431 }
1432
1433
1434
1435
1436
1437 VMTagCounters*
counters = isolate->vm_tag_counters();
1439 if (thread->IsDartMutatorThread()) {
1440 counters->Increment(sample->vm_tag());
1441 }
1442
1443 ProfilerNativeStackWalker native_stack_walker(
1444 &counters_, (isolate !=
nullptr) ? isolate->main_port() :
ILLEGAL_PORT,
1445 sample, isolate->current_sample_block(), stack_lower, stack_upper, pc,
fp,
1446 sp);
1447 const bool exited_dart_code = thread->HasExitedDartCode();
1448 ProfilerDartStackWalker dart_stack_walker(
1449 thread, sample, isolate->current_sample_block(), pc,
fp, sp, lr,
1450 false);
1451
1452
1453 CollectSample(isolate, exited_dart_code, in_dart_code, sample,
1454 &native_stack_walker, &dart_stack_walker, pc,
fp, sp,
1455 &counters_);
1456}
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)