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 * \note \p event_handler won't get notified of existent code. | |
mnaganov (inactive)
2012/07/30 11:43:36
One more thing worth mentioning here -- because of
Sigurður Ásgeirsson
2012/07/30 13:54:43
Thanks! Added docs regarding overlap and string/ev
| |
3261 */ | |
3262 static void SetJitCodeEventHandler(JitCodeEventHandler event_handler); | |
3263 | |
3264 /** | |
3221 * Adjusts the amount of registered external memory. Used to give | 3265 * Adjusts the amount of registered external memory. Used to give |
3222 * V8 an indication of the amount of externally allocated memory | 3266 * V8 an indication of the amount of externally allocated memory |
3223 * that is kept alive by JavaScript objects. V8 uses this to decide | 3267 * that is kept alive by JavaScript objects. V8 uses this to decide |
3224 * when to perform global garbage collections. Registering | 3268 * when to perform global garbage collections. Registering |
3225 * externally allocated memory will trigger global garbage | 3269 * externally allocated memory will trigger global garbage |
3226 * collections more often than otherwise in an attempt to garbage | 3270 * collections more often than otherwise in an attempt to garbage |
3227 * collect the JavaScript objects keeping the externally allocated | 3271 * collect the JavaScript objects keeping the externally allocated |
3228 * memory alive. | 3272 * memory alive. |
3229 * | 3273 * |
3230 * \param change_in_bytes the change in externally allocated memory | 3274 * \param change_in_bytes the change in externally allocated memory |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4535 | 4579 |
4536 | 4580 |
4537 } // namespace v8 | 4581 } // namespace v8 |
4538 | 4582 |
4539 | 4583 |
4540 #undef V8EXPORT | 4584 #undef V8EXPORT |
4541 #undef TYPE_CHECK | 4585 #undef TYPE_CHECK |
4542 | 4586 |
4543 | 4587 |
4544 #endif // V8_H_ | 4588 #endif // V8_H_ |
OLD | NEW |