Commit 9ef762b6 authored by yurys@chromium.org's avatar yurys@chromium.org

Do not store fp and sp values in TickSample

Their values are not used neither by the tick processor nor by CpuProfiler so it is just a waste of space.

TickSample used to be a transport for grabbed register values to TickSample::Trace, now they are passed in a special structure RegisterState which is allocated on the stack for the sampling period.

Some common pieces were moved from platform-dependent code into Sampler::SampleStack and TickSample::Init.

BUG=None
R=jkummerow@chromium.org, loislo@chromium.org

Review URL: https://codereview.chromium.org/18620002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15484 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 91be57a4
......@@ -216,9 +216,10 @@ bool StackTraceFrameIterator::IsValidFrame() {
SafeStackFrameIterator::SafeStackFrameIterator(
Isolate* isolate,
Address fp, Address sp, Address low_bound, Address high_bound) :
StackFrameIteratorBase(isolate, false),
low_bound_(low_bound), high_bound_(high_bound),
Address fp, Address sp, Address js_entry_sp)
: StackFrameIteratorBase(isolate, false),
low_bound_(sp),
high_bound_(js_entry_sp),
top_frame_type_(StackFrame::NONE) {
StackFrame::State state;
StackFrame::Type type;
......
......@@ -881,7 +881,7 @@ class SafeStackFrameIterator: public StackFrameIteratorBase {
public:
SafeStackFrameIterator(Isolate* isolate,
Address fp, Address sp,
Address low_bound, Address high_bound);
Address js_entry_sp);
inline JavaScriptFrame* frame() const;
void Advance();
......
......@@ -1364,8 +1364,6 @@ void Logger::TickEvent(TickSample* sample, bool overflow) {
LogMessageBuilder msg(this);
msg.Append("%s,", kLogEventsNames[TICK_EVENT]);
msg.AppendAddress(sample->pc);
msg.Append(',');
msg.AppendAddress(sample->sp);
msg.Append(",%ld", static_cast<int>(OS::Ticks() - epoch_));
if (sample->has_external_callback) {
msg.Append(",1,");
......
This diff is collapsed.
......@@ -44,22 +44,25 @@ class Isolate;
// (if used for profiling) the program counter and stack pointer for
// the thread that created it.
struct RegisterState {
RegisterState() : pc(NULL), sp(NULL), fp(NULL) {}
Address pc; // Instruction pointer.
Address sp; // Stack pointer.
Address fp; // Frame pointer.
};
// TickSample captures the information collected for each sample.
struct TickSample {
TickSample()
: state(OTHER),
pc(NULL),
sp(NULL),
fp(NULL),
external_callback(NULL),
frames_count(0),
has_external_callback(false),
top_frame_type(StackFrame::NONE) {}
void Trace(Isolate* isolate);
void Init(Isolate* isolate, const RegisterState& state);
StateTag state; // The state of the VM.
Address pc; // Instruction pointer.
Address sp; // Stack pointer.
Address fp; // Frame pointer.
union {
Address tos; // Top stack value (*sp).
Address external_callback;
......@@ -85,11 +88,7 @@ class Sampler {
int interval() const { return interval_; }
// Performs stack sampling.
void SampleStack(TickSample* sample);
// This method is called for each sampling period with the current
// program counter.
virtual void Tick(TickSample* sample) = 0;
void SampleStack(const RegisterState& regs);
// Start and stop sampler.
void Start();
......@@ -110,6 +109,11 @@ class Sampler {
class PlatformData;
PlatformData* platform_data() const { return data_; }
protected:
// This method is called for each sampling period with the current
// program counter.
virtual void Tick(TickSample* sample) = 0;
private:
void SetActive(bool value) { NoBarrier_Store(&active_, value); }
......
......@@ -52,6 +52,7 @@ using v8::internal::Address;
using v8::internal::Handle;
using v8::internal::Isolate;
using v8::internal::JSFunction;
using v8::internal::RegisterState;
using v8::internal::TickSample;
......@@ -66,11 +67,12 @@ static void InitTraceEnv(TickSample* sample) {
static void DoTrace(Address fp) {
trace_env.sample->fp = fp;
RegisterState regs;
regs.fp = fp;
// sp is only used to define stack high bound
trace_env.sample->sp =
regs.sp =
reinterpret_cast<Address>(trace_env.sample) - 10240;
trace_env.sample->Trace(Isolate::Current());
trace_env.sample->Init(Isolate::Current(), regs);
}
......
......@@ -5,7 +5,7 @@ profiler,"begin",1
code-creation,Stub,0,0x424260,348,"CompareStub_GE"
code-creation,LazyCompile,0,0x2a8100,18535,"DrawQube 3d-cube.js:188",0xf43abcac,
code-creation,LazyCompile,0,0x480100,3908,"DrawLine 3d-cube.js:17",0xf43abc50,
tick,0x424284,0xbfffeea0,0,0,0x480600,0,0x2aaaa5
tick,0x42429f,0xbfffed88,0,0,0x480600,0,0x2aacb4
tick,0x48063d,0xbfffec7c,0,0,0x2d0f7c,0,0x2aaec6
tick,0x424284,0,0,0x480600,0,0x2aaaa5
tick,0x42429f,0,0,0x480600,0,0x2aacb4
tick,0x48063d,0,0,0x2d0f7c,0,0x2aaec6
profiler,"end"
......@@ -9,17 +9,17 @@ code-creation,LazyCompile,0,0xf541d120,145,"exp native math.js:41"
function-creation,0xf441d280,0xf541d120
code-creation,LoadIC,0,0xf541d280,117,"j"
code-creation,LoadIC,0,0xf541d360,63,"i"
tick,0x80f82d1,0xffdfe880,0,0,0,0,0xf541ce5c
tick,0x80f89a1,0xffdfecf0,0,0,0,0,0xf541ce5c
tick,0x8123b5c,0xffdff1a0,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0x8123b65,0xffdff1a0,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf541d2be,0xffdff1e4,0,0,0,0
tick,0xf541d320,0xffdff1dc,0,0,0,0
tick,0xf541d384,0xffdff1d8,0,0,0,0
tick,0xf7db94da,0xffdff0ec,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7db951c,0xffdff0f0,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7dbc508,0xffdff14c,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7dbff21,0xffdff198,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7edec90,0xffdff0ec,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xffffe402,0xffdff488,0,0,0,0
tick,0x80f82d1,0,0,0,0,0xf541ce5c
tick,0x80f89a1,0,0,0,0,0xf541ce5c
tick,0x8123b5c,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0x8123b65,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf541d2be,0,0,0,0
tick,0xf541d320,0,0,0,0
tick,0xf541d384,0,0,0,0
tick,0xf7db94da,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7db951c,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7dbc508,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7dbff21,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7edec90,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xffffe402,0,0,0,0
profiler,"end"
......@@ -169,7 +169,7 @@ function TickProcessor(
'snapshot-pos': { parsers: [parseInt, parseInt],
processor: this.processSnapshotPosition },
'tick': {
parsers: [parseInt, parseInt, parseInt, parseInt,
parsers: [parseInt, parseInt, parseInt,
parseInt, parseInt, 'var-args'],
processor: this.processTick },
'heap-sample-begin': { parsers: [null, null, parseInt],
......@@ -365,7 +365,6 @@ TickProcessor.prototype.includeTick = function(vmState) {
};
TickProcessor.prototype.processTick = function(pc,
sp,
ns_since_start,
is_external_callback,
tos_or_external_callback,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment