Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 524fcb2b464db14f49786988be29d0818e7a0bba..792f9ed415dd4098cbb7a1af517cd1c67f247acd 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -2858,6 +2858,20 @@ typedef bool (*EntropySource)(unsigned char* buffer, size_t length); |
/** |
+ * ReturnAddressLocationResolver is used as a callback function when v8 is |
+ * resolving the location of a return address on the stack. Profilers that |
+ * change the return address on the stack can use this to resolve the stack |
+ * location to whereever the profiler stashed the original return address. |
+ * When invoked, return_addr_location will point to a location on stack where |
+ * a machine return address resides, this function should return either the |
+ * same pointer, or a pointer to the profiler's copy of the original return |
+ * address. |
+ */ |
+typedef uintptr_t (*ReturnAddressLocationResolver)( |
+ uintptr_t return_addr_location); |
+ |
+ |
+/** |
* Interface for iterating though all external resources in the heap. |
*/ |
class V8EXPORT ExternalResourceVisitor { // NOLINT |
@@ -3111,6 +3125,13 @@ class V8EXPORT V8 { |
static void SetEntropySource(EntropySource source); |
/** |
+ * Allows the host application to provide a callback that allows v8 to |
+ * cooperate with a profiler that rewrites return addresses on stack. |
+ */ |
+ static void SetReturnAddressLocationResolver( |
+ ReturnAddressLocationResolver return_address_resolver); |
+ |
+ /** |
* 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 |