OLD | NEW |
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 Loading... |
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 * | 2918 * When invoked, return_addr_location will point to a location on stack where |
2919 * \param return_addr_location points to a location on stack where a machine | 2919 * a machine return address resides, this function should return either the |
2920 * return address resides. | 2920 * same pointer, or a pointer to the profiler's copy of the original return |
2921 * \returns either return_addr_location, or else a pointer to the profiler's | 2921 * address. |
2922 * copy of the original return address. | |
2923 * | |
2924 * \note the resolver function must not cause garbage collection. | |
2925 */ | 2922 */ |
2926 typedef uintptr_t (*ReturnAddressLocationResolver)( | 2923 typedef uintptr_t (*ReturnAddressLocationResolver)( |
2927 uintptr_t return_addr_location); | 2924 uintptr_t return_addr_location); |
2928 | 2925 |
2929 | 2926 |
2930 /** | 2927 /** |
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 /** | |
2946 * Interface for iterating though all external resources in the heap. | 2928 * Interface for iterating though all external resources in the heap. |
2947 */ | 2929 */ |
2948 class V8EXPORT ExternalResourceVisitor { // NOLINT | 2930 class V8EXPORT ExternalResourceVisitor { // NOLINT |
2949 public: | 2931 public: |
2950 virtual ~ExternalResourceVisitor() {} | 2932 virtual ~ExternalResourceVisitor() {} |
2951 virtual void VisitExternalString(Handle<String> string) {} | 2933 virtual void VisitExternalString(Handle<String> string) {} |
2952 }; | 2934 }; |
2953 | 2935 |
2954 | 2936 |
2955 /** | 2937 /** |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3196 static void SetEntropySource(EntropySource source); | 3178 static void SetEntropySource(EntropySource source); |
3197 | 3179 |
3198 /** | 3180 /** |
3199 * Allows the host application to provide a callback that allows v8 to | 3181 * Allows the host application to provide a callback that allows v8 to |
3200 * cooperate with a profiler that rewrites return addresses on stack. | 3182 * cooperate with a profiler that rewrites return addresses on stack. |
3201 */ | 3183 */ |
3202 static void SetReturnAddressLocationResolver( | 3184 static void SetReturnAddressLocationResolver( |
3203 ReturnAddressLocationResolver return_address_resolver); | 3185 ReturnAddressLocationResolver return_address_resolver); |
3204 | 3186 |
3205 /** | 3187 /** |
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 /** | |
3220 * Adjusts the amount of registered external memory. Used to give | 3188 * Adjusts the amount of registered external memory. Used to give |
3221 * V8 an indication of the amount of externally allocated memory | 3189 * V8 an indication of the amount of externally allocated memory |
3222 * that is kept alive by JavaScript objects. V8 uses this to decide | 3190 * that is kept alive by JavaScript objects. V8 uses this to decide |
3223 * when to perform global garbage collections. Registering | 3191 * when to perform global garbage collections. Registering |
3224 * externally allocated memory will trigger global garbage | 3192 * externally allocated memory will trigger global garbage |
3225 * collections more often than otherwise in an attempt to garbage | 3193 * collections more often than otherwise in an attempt to garbage |
3226 * collect the JavaScript objects keeping the externally allocated | 3194 * collect the JavaScript objects keeping the externally allocated |
3227 * memory alive. | 3195 * memory alive. |
3228 * | 3196 * |
3229 * \param change_in_bytes the change in externally allocated memory | 3197 * \param change_in_bytes the change in externally allocated memory |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4534 | 4502 |
4535 | 4503 |
4536 } // namespace v8 | 4504 } // namespace v8 |
4537 | 4505 |
4538 | 4506 |
4539 #undef V8EXPORT | 4507 #undef V8EXPORT |
4540 #undef TYPE_CHECK | 4508 #undef TYPE_CHECK |
4541 | 4509 |
4542 | 4510 |
4543 #endif // V8_H_ | 4511 #endif // V8_H_ |
OLD | NEW |