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 2926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2937 * return address resides. This can be used to identify the caller of | 2937 * return address resides. This can be used to identify the caller of |
2938 * \p function, and/or modified to divert execution when \p function exits. | 2938 * \p function, and/or modified to divert execution when \p function exits. |
2939 * | 2939 * |
2940 * \note the entry hook must not cause garbage collection. | 2940 * \note the entry hook must not cause garbage collection. |
2941 */ | 2941 */ |
2942 typedef void (*FunctionEntryHook)(uintptr_t function, | 2942 typedef void (*FunctionEntryHook)(uintptr_t function, |
2943 uintptr_t return_addr_location); | 2943 uintptr_t return_addr_location); |
2944 | 2944 |
2945 | 2945 |
2946 /** | 2946 /** |
| 2947 * A JIT code event is issued each time code is added, moved or removed. |
| 2948 * |
| 2949 * \note removal events are not currently issued. |
| 2950 */ |
| 2951 struct JitCodeEvent { |
| 2952 enum EventType { |
| 2953 CODE_ADDED, |
| 2954 CODE_MOVED, |
| 2955 CODE_REMOVED |
| 2956 }; |
| 2957 |
| 2958 EventType type; |
| 2959 // Start of the instructions. |
| 2960 void* code_start; |
| 2961 // Size of the instructions. |
| 2962 size_t code_len; |
| 2963 union { |
| 2964 // Name of the object associated with the code. Only valid for CODE_ADDED. |
| 2965 const char* name; |
| 2966 // New location of instructions. Only valid for CODE_MOVED. |
| 2967 void* new_code_start; |
| 2968 }; |
| 2969 }; |
| 2970 |
| 2971 |
| 2972 /** |
| 2973 * Callback function passed to SetJitCodeEventHandler. |
| 2974 * |
| 2975 * \param event code add, move or removal event. |
| 2976 */ |
| 2977 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); |
| 2978 |
| 2979 |
| 2980 /** |
2947 * Interface for iterating though all external resources in the heap. | 2981 * Interface for iterating though all external resources in the heap. |
2948 */ | 2982 */ |
2949 class V8EXPORT ExternalResourceVisitor { // NOLINT | 2983 class V8EXPORT ExternalResourceVisitor { // NOLINT |
2950 public: | 2984 public: |
2951 virtual ~ExternalResourceVisitor() {} | 2985 virtual ~ExternalResourceVisitor() {} |
2952 virtual void VisitExternalString(Handle<String> string) {} | 2986 virtual void VisitExternalString(Handle<String> string) {} |
2953 }; | 2987 }; |
2954 | 2988 |
2955 | 2989 |
2956 /** | 2990 /** |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3211 * | 3245 * |
3212 * \param entry_hook a function that will be invoked on entry to every | 3246 * \param entry_hook a function that will be invoked on entry to every |
3213 * V8-generated function. | 3247 * V8-generated function. |
3214 * \returns true on success on supported platforms, false on failure. | 3248 * \returns true on success on supported platforms, false on failure. |
3215 * \note Setting a new entry hook function when one is already active will | 3249 * \note Setting a new entry hook function when one is already active will |
3216 * fail. | 3250 * fail. |
3217 */ | 3251 */ |
3218 static bool SetFunctionEntryHook(FunctionEntryHook entry_hook); | 3252 static bool SetFunctionEntryHook(FunctionEntryHook entry_hook); |
3219 | 3253 |
3220 /** | 3254 /** |
| 3255 * Allows the host application to provide the address of a function that is |
| 3256 * notified each time code is added, moved or removed. |
| 3257 * |
| 3258 * \param event_handler the JIT code event handler, which will be invoked |
| 3259 * each time code is added, moved or removed. |
| 3260 */ |
| 3261 static void SetJitCodeEventHandler(JitCodeEventHandler event_handler); |
| 3262 |
| 3263 /** |
3221 * Adjusts the amount of registered external memory. Used to give | 3264 * Adjusts the amount of registered external memory. Used to give |
3222 * V8 an indication of the amount of externally allocated memory | 3265 * V8 an indication of the amount of externally allocated memory |
3223 * that is kept alive by JavaScript objects. V8 uses this to decide | 3266 * that is kept alive by JavaScript objects. V8 uses this to decide |
3224 * when to perform global garbage collections. Registering | 3267 * when to perform global garbage collections. Registering |
3225 * externally allocated memory will trigger global garbage | 3268 * externally allocated memory will trigger global garbage |
3226 * collections more often than otherwise in an attempt to garbage | 3269 * collections more often than otherwise in an attempt to garbage |
3227 * collect the JavaScript objects keeping the externally allocated | 3270 * collect the JavaScript objects keeping the externally allocated |
3228 * memory alive. | 3271 * memory alive. |
3229 * | 3272 * |
3230 * \param change_in_bytes the change in externally allocated memory | 3273 * \param change_in_bytes the change in externally allocated memory |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4535 | 4578 |
4536 | 4579 |
4537 } // namespace v8 | 4580 } // namespace v8 |
4538 | 4581 |
4539 | 4582 |
4540 #undef V8EXPORT | 4583 #undef V8EXPORT |
4541 #undef TYPE_CHECK | 4584 #undef TYPE_CHECK |
4542 | 4585 |
4543 | 4586 |
4544 #endif // V8_H_ | 4587 #endif // V8_H_ |
OLD | NEW |