| Index: src/sampler.h
|
| diff --git a/src/sampler.h b/src/sampler.h
|
| index c3dce4ed7c2fec7e353cb06d1641f63e82092a84..3ea862ead58dfe3ccd9e27dee74c3f2bbd693f85 100644
|
| --- a/src/sampler.h
|
| +++ b/src/sampler.h
|
| @@ -5,6 +5,8 @@
|
| #ifndef V8_SAMPLER_H_
|
| #define V8_SAMPLER_H_
|
|
|
| +#include "include/v8.h"
|
| +
|
| #include "src/base/atomicops.h"
|
| #include "src/frames.h"
|
| #include "src/globals.h"
|
| @@ -14,6 +16,15 @@ namespace internal {
|
|
|
| class Isolate;
|
|
|
| +class ScopedSemaphore {
|
| + public:
|
| + explicit ScopedSemaphore(base::Semaphore* sem) {semaphore_ = sem;}
|
| + ~ScopedSemaphore() {semaphore_->Signal();}
|
| + private:
|
| + base::Semaphore* semaphore_;
|
| +};
|
| +
|
| +
|
| // ----------------------------------------------------------------------------
|
| // Sampler
|
| //
|
| @@ -29,26 +40,22 @@ struct RegisterState {
|
| };
|
|
|
| // TickSample captures the information collected for each sample.
|
| -struct TickSample {
|
| +struct TickSample : v8::Sample {
|
| TickSample()
|
| : state(OTHER),
|
| pc(NULL),
|
| external_callback(NULL),
|
| - frames_count(0),
|
| has_external_callback(false),
|
| top_frame_type(StackFrame::NONE) {}
|
| - void Init(Isolate* isolate, const RegisterState& state);
|
| + void Init(Isolate* isolate,
|
| + const RegisterState& state);
|
| StateTag state; // The state of the VM.
|
| Address pc; // Instruction pointer.
|
| union {
|
| Address tos; // Top stack value (*sp).
|
| Address external_callback;
|
| };
|
| - static const unsigned kMaxFramesCountLog2 = 8;
|
| - static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
|
| - Address stack[kMaxFramesCount]; // Call stack.
|
| base::TimeTicks timestamp;
|
| - unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames.
|
| bool has_external_callback : 1;
|
| StackFrame::Type top_frame_type : 4;
|
| };
|
| @@ -85,6 +92,7 @@ class Sampler {
|
| bool IsActive() const { return base::NoBarrier_Load(&active_); }
|
|
|
| void DoSample();
|
| + void GetSample(v8::Sample* sample);
|
| // If true next sample must be initiated on the profiler event processor
|
| // thread right after latest sample is processed.
|
| void SetHasProcessingThread(bool value) {
|
| @@ -120,6 +128,9 @@ class Sampler {
|
| bool is_counting_samples_;
|
| // Counts stack samples taken in JS VM state.
|
| unsigned js_and_external_sample_count_;
|
| + void* GetSampleHelper();
|
| + static void CopyTickSampleToSample(TickSample* tick_sample,
|
| + v8::Sample* sample);
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler);
|
| };
|
|
|
|
|