Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index 73384946ba7d93594fd5c3d78753dfe01c2726f6..fbe3dea2a7164ab6e70c2e23d567123206ca4caf 100644 |
| --- a/include/v8.h |
| +++ b/include/v8.h |
| @@ -1297,6 +1297,35 @@ class V8_EXPORT StackFrame { |
| }; |
| +/* TODO(gholap): This should go away and struct Sample should |
| + just use const void* instead of Address. |
| + Currently we need it because of implementation details. */ |
| +typedef unsigned char* Address; |
|
Sven Panne
2014/09/01 08:35:58
Just use void* in sample and do the casting intern
gholap
2014/09/02 07:43:49
Done.
|
| + |
| + |
| +/** |
| + * Isolate::Getsample collects the current JS execution state as a sample. |
| + * A collected sample contains, |
| + * - stack : An array of addresses. |
| + * One address per stack frame. |
| + * The address is the instruction pointer, |
| + * pointing to the instruction which led to the |
| + * creation of the stack frame. |
| + * (for example, a function call) |
| + * - frames_count: Number of stack frames that were captured. |
| + * That is, stack[frames_count+i] might contain meaningless |
| + * addresses for any i >= 0. |
| + */ |
| +struct V8_EXPORT Sample { |
| + Sample() |
| + : frames_count(0) {} |
| + static const unsigned kMaxFramesCount = 255; |
| + |
| + Address stack[kMaxFramesCount]; // Call stack. |
| + unsigned frames_count; // Number of captured frames. |
| +}; |
| + |
| + |
| /** |
| * A JSON Parser. |
| */ |
| @@ -4217,6 +4246,11 @@ class V8_EXPORT Isolate { |
| void GetHeapStatistics(HeapStatistics* heap_statistics); |
| /** |
| + * Get a sample from the isolate. |
| + */ |
| + void GetSample(Sample* sample); |
| + |
| + /** |
| * 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 |