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

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: Updated refs 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
« src/sampler.h ('K') | « src/sampler.h ('k') | no next file » | 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 277462977d2ae68cafca1a0426edf1bdb81eee36..2b62c1a22793bd43aa342b3e87ae9fe0ddcc3690 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"
@@ -641,4 +642,33 @@ void Sampler::SampleStack(TickSample* sample) {
if (++samples_taken_ < 0) samples_taken_ = 0;
}
+//
+// StackTracer implementation
+//
+DISABLE_ASAN void StackTracer::Trace(Isolate* isolate, TickSample* sample) {
+ ASSERT(isolate->IsInitialized());
+
+ // Avoid collecting traces while doing GC.
+ if (sample->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;
+ }
+
+ sample->external_callback = isolate->external_callback();
+
+ SafeStackTraceFrameIterator it(isolate,
+ sample->fp, sample->sp,
+ sample->sp, js_entry_sp);
+ int i = 0;
+ while (!it.done() && i < TickSample::kMaxFramesCount) {
+ sample->stack[i++] = it.frame()->pc();
+ it.Advance();
+ }
+ sample->frames_count = i;
+}
+
} } // namespace v8::internal
« src/sampler.h ('K') | « src/sampler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698