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

Unified Diff: src/sampler.cc

Issue 14208012: Move StackTracer to sampler.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 years, 8 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 | « src/sampler.h ('k') | test/cctest/test-log-stack-tracer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sampler.cc
diff --git a/src/sampler.cc b/src/sampler.cc
index 79c871b391008eb6eeea8e008ba62f939b257caf..948b0540736d629a1d861b9db6371c0711590a96 100644
--- a/src/sampler.cc
+++ b/src/sampler.cc
@@ -59,6 +59,7 @@
#include "v8.h"
+#include "frames-inl.h"
#include "log.h"
#include "platform.h"
#include "simulator.h"
@@ -619,6 +620,34 @@ Mutex* SamplerThread::mutex_ = NULL;
SamplerThread* SamplerThread::instance_ = NULL;
+//
+// StackTracer implementation
+//
+DISABLE_ASAN void TickSample::Trace(Isolate* isolate) {
+ ASSERT(isolate->IsInitialized());
+
+ // Avoid collecting traces while doing GC.
+ if (state == GC) return;
+
+ const Address js_entry_sp =
+ Isolate::js_entry_sp(isolate->thread_local_top());
+ if (js_entry_sp == 0) {
+ // Not executing JS now.
+ return;
+ }
+
+ external_callback = isolate->external_callback();
+
+ SafeStackTraceFrameIterator it(isolate, fp, sp, sp, js_entry_sp);
+ int i = 0;
+ while (!it.done() && i < TickSample::kMaxFramesCount) {
+ stack[i++] = it.frame()->pc();
+ it.Advance();
+ }
+ frames_count = i;
+}
+
+
void Sampler::SetUp() {
SamplerThread::SetUp();
}
@@ -658,7 +687,7 @@ void Sampler::Stop() {
}
void Sampler::SampleStack(TickSample* sample) {
- StackTracer::Trace(isolate_, sample);
+ sample->Trace(isolate_);
if (++samples_taken_ < 0) samples_taken_ = 0;
}
« no previous file with comments | « src/sampler.h ('k') | test/cctest/test-log-stack-tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698