| Index: include/v8.h
|
| diff --git a/include/v8.h b/include/v8.h
|
| index 73384946ba7d93594fd5c3d78753dfe01c2726f6..b2a41b97ae60f9ddee7bc4e3b288f0670b26d059 100644
|
| --- a/include/v8.h
|
| +++ b/include/v8.h
|
| @@ -17,6 +17,10 @@
|
|
|
| #include "v8stdint.h"
|
|
|
| +#if V8_OS_WIN || V8_OS_CYGWIN
|
| +#include "src/base/win32-headers.h"
|
| +#endif
|
| +
|
| // We reserve the V8_* prefix for macros defined in V8 public API and
|
| // assume there are no name conflicts with the embedder's code.
|
|
|
| @@ -1298,6 +1302,41 @@ class V8_EXPORT StackFrame {
|
|
|
|
|
| /**
|
| + * Isolate::GetSample collects the current JS execution state as a sample.
|
| + * A collected sample contains program counter values.
|
| + *
|
| + * Example: Printing out the stack frames' addresses, from top to bottom.
|
| + *
|
| + * Isolate* isolate = Isolate::Current();
|
| + * Sample sample;
|
| + * isolate->GetSample(&sample);
|
| + * const void* const* i;
|
| + * for (i = sample.begin(); i != sample.end(); ++i) {
|
| + * printf("%p\n", *i);
|
| + * }
|
| + */
|
| +class V8_EXPORT Sample {
|
| + public:
|
| + enum { kMaxSize = 255u };
|
| +
|
| + Sample() : size_(0) {}
|
| + template <class InputIterator>
|
| + Sample(InputIterator first, InputIterator last) : size_(0) {
|
| + for (; first != last && size_ < kMaxSize; ++first)
|
| + data_[size_++] = *first;
|
| + }
|
| +
|
| + typedef const void* const* const_iterator;
|
| + const_iterator begin() const { return &data_[0]; }
|
| + const_iterator end() const { return &data_[size_]; }
|
| + size_t size() const { return size_; }
|
| +
|
| + private:
|
| + const void* data_[kMaxSize];
|
| + size_t size_;
|
| +};
|
| +
|
| +/**
|
| * A JSON Parser.
|
| */
|
| class V8_EXPORT JSON {
|
| @@ -4217,6 +4256,15 @@ class V8_EXPORT Isolate {
|
| void GetHeapStatistics(HeapStatistics* heap_statistics);
|
|
|
| /**
|
| + * Get a sample from the isolate.
|
| + */
|
| +#if V8_OS_POSIX && !V8_OS_CYGWIN
|
| + void GetSample(Sample* sample);
|
| +#elif V8_OS_WIN || V8_OS_CYGWIN
|
| + void GetSample(const CONTEXT& context, Sample* sample);
|
| +#endif
|
| +
|
| + /**
|
| * Adjusts the amount of registered external memory. Used to give V8 an
|
| * indication of the amount of externally allocated memory that is kept alive
|
| * by JavaScript objects. V8 uses this to decide when to perform global
|
|
|