Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: runtime/vm/profiler.cc

Issue 1837023003: Collect a single frame sample in the profiler if we can't validate stack boundaries (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/profiler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index 3740c1d98e4c0ed1487c859aa87ffabf669a3443..37b8b73577f7f5426867ceb40c0681440b4a0198 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,17 @@ 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()) {
+ SampleThreadSingleFrame(thread, pc);
return;
}
- if (thread->IsMutatorThread() && isolate->IsDeoptimizing()) {
+ if (!InitialRegisterCheck(pc, fp, sp)) {
+ SampleThreadSingleFrame(thread, pc);
return;
}
@@ -1009,6 +1037,7 @@ void Profiler::SampleThread(Thread* thread,
&stack_lower,
&stack_upper)) {
// Could not get stack boundary.
+ SampleThreadSingleFrame(thread, pc);
return;
}
« no previous file with comments | « runtime/vm/profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698