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

Unified Diff: src/log.cc

Issue 112082: Fix determining of JS lower stack bottom used in profiler's JS stack tracer to work with Chromium. (Closed)
Patch Set: Created 11 years, 7 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/log.h ('k') | src/top.h » ('j') | src/top.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index c66a422fde35dfdfbd215ab604723c979d6cccc1..c1edf4d1855a27c37272a12052e9bf0fdc70bd3a 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -146,11 +146,18 @@ void StackTracer::Trace(TickSample* sample) {
return;
}
+ const Address js_entry_sp = Top::js_entry_sp(Top::GetCurrentThread());
+ if (js_entry_sp == 0) {
+ // Not executing JS now.
+ sample->frames_count = 0;
+ return;
+ }
+
SafeStackTraceFrameIterator it(
reinterpret_cast<Address>(sample->fp),
reinterpret_cast<Address>(sample->sp),
reinterpret_cast<Address>(sample->sp),
- reinterpret_cast<Address>(low_stack_bound_));
+ js_entry_sp);
int i = 0;
while (!it.done() && i < TickSample::kMaxFramesCount) {
sample->stack[i++] = it.frame()->pc();
@@ -166,14 +173,13 @@ void StackTracer::Trace(TickSample* sample) {
//
class Ticker: public Sampler {
public:
- explicit Ticker(int interval, uintptr_t low_stack_bound):
- Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL),
- stack_tracer_(low_stack_bound) {}
+ explicit Ticker(int interval):
+ Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL) {}
~Ticker() { if (IsActive()) Stop(); }
void Tick(TickSample* sample) {
- if (IsProfiling()) stack_tracer_.Trace(sample);
+ if (IsProfiling()) StackTracer::Trace(sample);
if (profiler_) profiler_->Insert(sample);
if (window_) window_->AddState(sample->state);
}
@@ -201,7 +207,6 @@ class Ticker: public Sampler {
private:
SlidingStateWindow* window_;
Profiler* profiler_;
- StackTracer stack_tracer_;
};
@@ -1002,11 +1007,7 @@ bool Logger::Setup() {
current_state_ = &bottom_state_;
- // as log is initialized early with V8, we can assume that JS execution
- // frames can never reach this point on stack
- int stack_var;
- ticker_ = new Ticker(
- kSamplingIntervalMs, reinterpret_cast<uintptr_t>(&stack_var));
+ ticker_ = new Ticker(kSamplingIntervalMs);
if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
sliding_state_window_ = new SlidingStateWindow();
« no previous file with comments | « src/log.h ('k') | src/top.h » ('j') | src/top.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698