Reviewers: yurys, loislo,

Description:
CPU profiler: increase the max number of captured frames.

LOG=N

Please review this at https://codereview.chromium.org/357443003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+8, -7 lines):
  M src/log.cc
  M src/sampler.h
  M src/sampler.cc
  M test/cctest/test-cpu-profiler.cc
  M test/cctest/test-log-stack-tracer.cc


Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index 01afa85817d79340a5f91ba67a4ab662c2cc1bd1..b30ac683eaef75221eaadad74c88b6e0bf844cad 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -1713,7 +1713,7 @@ void Logger::TickEvent(TickSample* sample, bool overflow) {
   if (overflow) {
     msg.Append(",overflow");
   }
-  for (int i = 0; i < sample->frames_count; ++i) {
+  for (unsigned i = 0; i < sample->frames_count; ++i) {
     msg.Append(',');
     msg.AppendAddress(sample->stack[i]);
   }
Index: src/sampler.cc
diff --git a/src/sampler.cc b/src/sampler.cc
index aedf75f69abf9df0f68c13d98978579092caa17a..82fe27d861c7787cef8ba03a515e4defc6b140bf 100644
--- a/src/sampler.cc
+++ b/src/sampler.cc
@@ -596,7 +596,7 @@ DISABLE_ASAN void TickSample::Init(Isolate* isolate,

   SafeStackFrameIterator it(isolate, regs.fp, regs.sp, js_entry_sp);
   top_frame_type = it.top_frame_type();
-  int i = 0;
+  unsigned i = 0;
   while (!it.done() && i < TickSample::kMaxFramesCount) {
     stack[i++] = it.frame()->pc();
     it.Advance();
Index: src/sampler.h
diff --git a/src/sampler.h b/src/sampler.h
index fe94a02e9350d1437d5ac63fc22a03f8989f6758..80fe5a978a83018d06951407c02a20116bef1c32 100644
--- a/src/sampler.h
+++ b/src/sampler.h
@@ -44,10 +44,11 @@ struct TickSample {
     Address tos;   // Top stack value (*sp).
     Address external_callback;
   };
-  static const int kMaxFramesCount = 64;
+  static const unsigned kMaxFramesCountLog2 = 8;
+  static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
   Address stack[kMaxFramesCount];  // Call stack.
   TimeTicks timestamp;
-  int frames_count : 8;  // Number of captured frames.
+ unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames.
   bool has_external_callback : 1;
   StackFrame::Type top_frame_type : 4;
 };
Index: test/cctest/test-cpu-profiler.cc
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc index 77b5bd877c7e8d6a688eed341ca18965e6f90163..6f6621fc81521ce63b783f8279955a479f8b9ecf 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -283,7 +283,7 @@ TEST(Issue1398) {
   sample->pc = code->address();
   sample->tos = 0;
   sample->frames_count = i::TickSample::kMaxFramesCount;
-  for (int i = 0; i < sample->frames_count; ++i) {
+  for (unsigned i = 0; i < sample->frames_count; ++i) {
     sample->stack[i] = code->address();
   }
   processor->FinishTickSample();
Index: test/cctest/test-log-stack-tracer.cc
diff --git a/test/cctest/test-log-stack-tracer.cc b/test/cctest/test-log-stack-tracer.cc index 3f9d0b364a5682f0688b18f5ea7f71a97122155a..334a2010532bd3373b7547ede2ff4142ea7988e7 100644
--- a/test/cctest/test-log-stack-tracer.cc
+++ b/test/cctest/test-log-stack-tracer.cc
@@ -172,7 +172,7 @@ TEST(CFromJSStackTrace) {
CHECK_EQ(FUNCTION_ADDR(i::TraceExtension::Trace), sample.external_callback);

// Stack tracing will start from the first JS function, i.e. "JSFuncDoTrace"
-  int base = 0;
+  unsigned base = 0;
   CHECK_GT(sample.frames_count, base + 1);

   CHECK(IsAddressWithinFuncCode(
@@ -225,7 +225,7 @@ TEST(PureJSStackTrace) {
CHECK_EQ(FUNCTION_ADDR(i::TraceExtension::JSTrace), sample.external_callback);

// Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace"
-  int base = 0;
+  unsigned base = 0;
   CHECK_GT(sample.frames_count, base + 1);
CHECK(IsAddressWithinFuncCode(context, "JSTrace", sample.stack[base + 0]));
   CHECK(IsAddressWithinFuncCode(


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to