Chromium Code Reviews| Index: runtime/vm/profiler.cc |
| diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc |
| index 3740c1d98e4c0ed1487c859aa87ffabf669a3443..3df181f110db87aea373ecf779121fd800a585dd 100644 |
| --- a/runtime/vm/profiler.cc |
| +++ b/runtime/vm/profiler.cc |
| @@ -945,6 +945,32 @@ void Profiler::SampleAllocation(Thread* thread, intptr_t cid) { |
| } |
| +void Profiler::SampleThreadSingleFrame(Thread* thread, uintptr_t pc) { |
| + ASSERT(thread != NULL); |
| + OSThread* os_thread = thread->os_thread(); |
| + ASSERT(os_thread != NULL); |
| + Isolate* isolate = thread->isolate(); |
| + |
| + SampleBuffer* sample_buffer = Profiler::sample_buffer(); |
| + if (sample_buffer == NULL) { |
| + // Profiler not initialized. |
| + return; |
| + } |
| + |
| + // Setup sample. |
| + Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); |
| + // Increment counter for vm tag. |
| + VMTagCounters* counters = isolate->vm_tag_counters(); |
| + ASSERT(counters != NULL); |
| + if (thread->IsMutatorThread()) { |
| + counters->Increment(sample->vm_tag()); |
| + } |
| + |
| + // Write the single pc value. |
| + sample->SetAt(0, pc); |
| +} |
| + |
| + |
| void Profiler::SampleThread(Thread* thread, |
| const InterruptedThreadState& state) { |
| ASSERT(thread != NULL); |
| @@ -989,15 +1015,16 @@ void Profiler::SampleThread(Thread* thread, |
| sp = state.csp; |
| } |
| - if (!InitialRegisterCheck(pc, fp, sp)) { |
| + if (!CheckIsolate(isolate)) { |
| return; |
| } |
| - if (!CheckIsolate(isolate)) { |
| + if (thread->IsMutatorThread() && isolate->IsDeoptimizing()) { |
| return; |
|
sra1
2016/03/29 17:22:18
Should this be sampled as a single frame too?
Cutch
2016/03/29 17:43:18
Might as well.
|
| } |
| - if (thread->IsMutatorThread() && isolate->IsDeoptimizing()) { |
| + if (!InitialRegisterCheck(pc, fp, sp)) { |
| + SampleThreadSingleFrame(thread, pc); |
| return; |
| } |
| @@ -1008,6 +1035,7 @@ void Profiler::SampleThread(Thread* thread, |
| sp, |
| &stack_lower, |
| &stack_upper)) { |
| + SampleThreadSingleFrame(thread, pc); |
| // Could not get stack boundary. |
| return; |
| } |