Chromium Code Reviews| 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 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3005 | 3005 |
| 3006 /** | 3006 /** |
| 3007 * A JIT code event is issued each time code is added, moved or removed. | 3007 * A JIT code event is issued each time code is added, moved or removed. |
| 3008 * | 3008 * |
| 3009 * \note removal events are not currently issued. | 3009 * \note removal events are not currently issued. |
| 3010 */ | 3010 */ |
| 3011 struct JitCodeEvent { | 3011 struct JitCodeEvent { |
| 3012 enum EventType { | 3012 enum EventType { |
| 3013 CODE_ADDED, | 3013 CODE_ADDED, |
| 3014 CODE_MOVED, | 3014 CODE_MOVED, |
| 3015 CODE_REMOVED | 3015 CODE_REMOVED, |
| 3016 CODE_ADD_LINE_POS_INFO, | |
| 3017 CODE_START_LINE_INFO_RECORDING, | |
| 3018 CODE_END_LINE_INFO_RECORDING | |
| 3019 }; | |
| 3020 // Definition of the code position type. See comment for | |
| 3021 // RelocInfo::kNoPosition field. | |
| 3022 enum PositionType { | |
| 3023 POSITION, | |
| 3024 STATEMENT_POSITION | |
| 3016 }; | 3025 }; |
| 3017 | 3026 |
| 3018 // Type of event. | 3027 // Type of event. |
| 3019 EventType type; | 3028 EventType type; |
| 3020 // Start of the instructions. | 3029 // Start of the instructions. |
| 3021 void* code_start; | 3030 void* code_start; |
| 3022 // Size of the instructions. | 3031 // Size of the instructions. |
| 3023 size_t code_len; | 3032 size_t code_len; |
| 3033 // Script info for CODE_ADDED event. | |
| 3034 Handle<Script> script; | |
| 3035 // User-defined data for other events. For example, the line_info_struct | |
| 3036 // for CODE_ADD_LINE_POS_INFO and CODE_END_LINE_INFO_RECORDING event | |
| 3037 void* user_data; | |
| 3024 | 3038 |
| 3025 union { | 3039 union { |
| 3026 // Only valid for CODE_ADDED. | 3040 // Only valid for CODE_ADDED. |
| 3027 struct { | 3041 struct { |
| 3028 // Name of the object associated with the code, note that the string is | 3042 // Name of the object associated with the code, note that the string is |
| 3029 // not zero-terminated. | 3043 // not zero-terminated. |
| 3030 const char* str; | 3044 const char* str; |
| 3031 // Number of chars in str. | 3045 // Number of chars in str. |
| 3032 size_t len; | 3046 size_t len; |
| 3033 } name; | 3047 } name; |
| 3048 | |
| 3049 // Only valid for CODE_ADD_LINE_POS_INFO | |
| 3050 struct { | |
| 3051 // PC offset | |
| 3052 size_t offset; | |
| 3053 // Code postion | |
| 3054 size_t pos; | |
| 3055 // The position type. | |
| 3056 PositionType position_type; | |
| 3057 } line_info; | |
| 3058 | |
| 3034 // New location of instructions. Only valid for CODE_MOVED. | 3059 // New location of instructions. Only valid for CODE_MOVED. |
| 3035 void* new_code_start; | 3060 void* new_code_start; |
| 3036 }; | 3061 }; |
| 3037 }; | 3062 }; |
| 3038 | 3063 |
| 3039 /** | 3064 /** |
| 3040 * Option flags passed to the SetJitCodeEventHandler function. | 3065 * Option flags passed to the SetJitCodeEventHandler function. |
| 3041 */ | 3066 */ |
| 3042 enum JitCodeEventOptions { | 3067 enum JitCodeEventOptions { |
| 3043 kJitCodeEventDefault = 0, | 3068 kJitCodeEventDefault = 0, |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3339 */ | 3364 */ |
| 3340 static bool SetFunctionEntryHook(FunctionEntryHook entry_hook); | 3365 static bool SetFunctionEntryHook(FunctionEntryHook entry_hook); |
| 3341 | 3366 |
| 3342 /** | 3367 /** |
| 3343 * Allows the host application to provide the address of a function that is | 3368 * Allows the host application to provide the address of a function that is |
| 3344 * notified each time code is added, moved or removed. | 3369 * notified each time code is added, moved or removed. |
| 3345 * | 3370 * |
| 3346 * \param options options for the JIT code event handler. | 3371 * \param options options for the JIT code event handler. |
| 3347 * \param event_handler the JIT code event handler, which will be invoked | 3372 * \param event_handler the JIT code event handler, which will be invoked |
| 3348 * each time code is added, moved or removed. | 3373 * each time code is added, moved or removed. |
| 3374 * \param support_moved_code the code move event is support or not. If it's | |
| 3375 * not enabled, the code will NOT be compacted during GC. | |
| 3349 * \note \p event_handler won't get notified of existent code. | 3376 * \note \p event_handler won't get notified of existent code. |
| 3350 * \note since code removal notifications are not currently issued, the | 3377 * \note since code removal notifications are not currently issued, the |
| 3351 * \p event_handler may get notifications of code that overlaps earlier | 3378 * \p event_handler may get notifications of code that overlaps earlier |
| 3352 * code notifications. This happens when code areas are reused, and the | 3379 * code notifications. This happens when code areas are reused, and the |
| 3353 * earlier overlapping code areas should therefore be discarded. | 3380 * earlier overlapping code areas should therefore be discarded. |
| 3354 * \note the events passed to \p event_handler and the strings they point to | 3381 * \note the events passed to \p event_handler and the strings they point to |
| 3355 * are not guaranteed to live past each call. The \p event_handler must | 3382 * are not guaranteed to live past each call. The \p event_handler must |
| 3356 * copy strings and other parameters it needs to keep around. | 3383 * copy strings and other parameters it needs to keep around. |
| 3357 * \note the set of events declared in JitCodeEvent::EventType is expected to | 3384 * \note the set of events declared in JitCodeEvent::EventType is expected to |
| 3358 * grow over time, and the JitCodeEvent structure is expected to accrue | 3385 * grow over time, and the JitCodeEvent structure is expected to accrue |
| 3359 * new members. The \p event_handler function must ignore event codes | 3386 * new members. The \p event_handler function must ignore event codes |
| 3360 * it does not recognize to maintain future compatibility. | 3387 * it does not recognize to maintain future compatibility. |
| 3361 */ | 3388 */ |
| 3362 static void SetJitCodeEventHandler(JitCodeEventOptions options, | 3389 static void SetJitCodeEventHandler(JitCodeEventOptions options, |
| 3363 JitCodeEventHandler event_handler); | 3390 JitCodeEventHandler event_handler, |
| 3391 bool support_moved_code); | |
|
danno
2013/02/01 13:43:10
Id like to avoid baking this into an API. Instead,
| |
| 3364 | 3392 |
| 3365 /** | 3393 /** |
| 3366 * Adjusts the amount of registered external memory. Used to give | 3394 * Adjusts the amount of registered external memory. Used to give |
| 3367 * V8 an indication of the amount of externally allocated memory | 3395 * V8 an indication of the amount of externally allocated memory |
| 3368 * that is kept alive by JavaScript objects. V8 uses this to decide | 3396 * that is kept alive by JavaScript objects. V8 uses this to decide |
| 3369 * when to perform global garbage collections. Registering | 3397 * when to perform global garbage collections. Registering |
| 3370 * externally allocated memory will trigger global garbage | 3398 * externally allocated memory will trigger global garbage |
| 3371 * collections more often than otherwise in an attempt to garbage | 3399 * collections more often than otherwise in an attempt to garbage |
| 3372 * collect the JavaScript objects keeping the externally allocated | 3400 * collect the JavaScript objects keeping the externally allocated |
| 3373 * memory alive. | 3401 * memory alive. |
| (...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4849 | 4877 |
| 4850 | 4878 |
| 4851 } // namespace v8 | 4879 } // namespace v8 |
| 4852 | 4880 |
| 4853 | 4881 |
| 4854 #undef V8EXPORT | 4882 #undef V8EXPORT |
| 4855 #undef TYPE_CHECK | 4883 #undef TYPE_CHECK |
| 4856 | 4884 |
| 4857 | 4885 |
| 4858 #endif // V8_H_ | 4886 #endif // V8_H_ |
| OLD | NEW |