Index: src/sampler.h |
diff --git a/src/sampler.h b/src/sampler.h |
index 3875a29e663e1bb8c797553515e820f56eb7ff14..63e6cfe15af6457e5405ba0761b845ad3c2dbdff 100644 |
--- a/src/sampler.h |
+++ b/src/sampler.h |
@@ -43,22 +43,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; |
@@ -84,11 +87,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(); |
@@ -109,6 +108,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); } |