Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: include/v8.h

Issue 10706002: Implements a new API to set a function entry hook for profiling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make test non-threaded as it manipulates process-global state, and thus can't deterministically run… Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 * of entropy. 2908 * of entropy.
2909 */ 2909 */
2910 typedef bool (*EntropySource)(unsigned char* buffer, size_t length); 2910 typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
2911 2911
2912 2912
2913 /** 2913 /**
2914 * ReturnAddressLocationResolver is used as a callback function when v8 is 2914 * ReturnAddressLocationResolver is used as a callback function when v8 is
2915 * resolving the location of a return address on the stack. Profilers that 2915 * resolving the location of a return address on the stack. Profilers that
2916 * change the return address on the stack can use this to resolve the stack 2916 * change the return address on the stack can use this to resolve the stack
2917 * location to whereever the profiler stashed the original return address. 2917 * location to whereever the profiler stashed the original return address.
2918 * When invoked, return_addr_location will point to a location on stack where 2918 *
2919 * a machine return address resides, this function should return either the 2919 * \param return_addr_location points to a location on stack where a machine
2920 * same pointer, or a pointer to the profiler's copy of the original return 2920 * return address resides.
2921 * address. 2921 * \returns either return_addr_location, or else a pointer to the profiler's
2922 * copy of the original return address.
2923 *
2924 * \note the resolver function must not cause garbage collection.
2922 */ 2925 */
2923 typedef uintptr_t (*ReturnAddressLocationResolver)( 2926 typedef uintptr_t (*ReturnAddressLocationResolver)(
2924 uintptr_t return_addr_location); 2927 uintptr_t return_addr_location);
2925 2928
2926 2929
2927 /** 2930 /**
2931 * FunctionEntryHook is the type of the profile entry hook called at entry to
2932 * any generated function when function-level profiling is enabled.
2933 *
2934 * \param function the address of the function that's being entered.
2935 * \param return_addr_location points to a location on stack where the machine
2936 * return address resides. This can be used to identify the caller of
2937 * \p function, and/or modified to divert execution when \p function exits.
2938 *
2939 * \note the entry hook must not cause garbage collection.
2940 */
2941 typedef void (*FunctionEntryHook)(uintptr_t function,
2942 uintptr_t return_addr_location);
2943
2944
2945 /**
2928 * Interface for iterating though all external resources in the heap. 2946 * Interface for iterating though all external resources in the heap.
2929 */ 2947 */
2930 class V8EXPORT ExternalResourceVisitor { // NOLINT 2948 class V8EXPORT ExternalResourceVisitor { // NOLINT
2931 public: 2949 public:
2932 virtual ~ExternalResourceVisitor() {} 2950 virtual ~ExternalResourceVisitor() {}
2933 virtual void VisitExternalString(Handle<String> string) {} 2951 virtual void VisitExternalString(Handle<String> string) {}
2934 }; 2952 };
2935 2953
2936 2954
2937 /** 2955 /**
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 static void SetEntropySource(EntropySource source); 3196 static void SetEntropySource(EntropySource source);
3179 3197
3180 /** 3198 /**
3181 * Allows the host application to provide a callback that allows v8 to 3199 * Allows the host application to provide a callback that allows v8 to
3182 * cooperate with a profiler that rewrites return addresses on stack. 3200 * cooperate with a profiler that rewrites return addresses on stack.
3183 */ 3201 */
3184 static void SetReturnAddressLocationResolver( 3202 static void SetReturnAddressLocationResolver(
3185 ReturnAddressLocationResolver return_address_resolver); 3203 ReturnAddressLocationResolver return_address_resolver);
3186 3204
3187 /** 3205 /**
3206 * Allows the host application to provide the address of a function that's
3207 * invoked on entry to every V8-generated function.
3208 * Note that \p entry_hook is invoked at the very start of each
3209 * generated function.
3210 *
3211 * \param entry_hook a function that will be invoked on entry to every
3212 * V8-generated function.
3213 * \returns true on success on supported platforms, false on failure.
3214 * \note Setting a new entry hook function when one is already active will
3215 * fail.
3216 */
3217 static bool SetFunctionEntryHook(FunctionEntryHook entry_hook);
3218
3219 /**
3188 * Adjusts the amount of registered external memory. Used to give 3220 * Adjusts the amount of registered external memory. Used to give
3189 * V8 an indication of the amount of externally allocated memory 3221 * V8 an indication of the amount of externally allocated memory
3190 * that is kept alive by JavaScript objects. V8 uses this to decide 3222 * that is kept alive by JavaScript objects. V8 uses this to decide
3191 * when to perform global garbage collections. Registering 3223 * when to perform global garbage collections. Registering
3192 * externally allocated memory will trigger global garbage 3224 * externally allocated memory will trigger global garbage
3193 * collections more often than otherwise in an attempt to garbage 3225 * collections more often than otherwise in an attempt to garbage
3194 * collect the JavaScript objects keeping the externally allocated 3226 * collect the JavaScript objects keeping the externally allocated
3195 * memory alive. 3227 * memory alive.
3196 * 3228 *
3197 * \param change_in_bytes the change in externally allocated memory 3229 * \param change_in_bytes the change in externally allocated memory
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
4502 4534
4503 4535
4504 } // namespace v8 4536 } // namespace v8
4505 4537
4506 4538
4507 #undef V8EXPORT 4539 #undef V8EXPORT
4508 #undef TYPE_CHECK 4540 #undef TYPE_CHECK
4509 4541
4510 4542
4511 #endif // V8_H_ 4543 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698