Bug 1721549 - Provide some GC reasons for embedders to use r=sfink

Differential Revision: https://phabricator.services.mozilla.com/D120455
This commit is contained in:
Jon Coppeard 2021-07-21 17:01:54 +00:00
Родитель edc181cd0f
Коммит 67edae11b1
1 изменённых файлов: 75 добавлений и 60 удалений

Просмотреть файл

@ -504,66 +504,81 @@ struct JSExternalStringCallbacks {
namespace JS {
#define GCREASONS(D) \
/* Reasons internal to the JS engine */ \
D(API, 0) \
D(EAGER_ALLOC_TRIGGER, 1) \
D(DESTROY_RUNTIME, 2) \
D(ROOTS_REMOVED, 3) \
D(LAST_DITCH, 4) \
D(TOO_MUCH_MALLOC, 5) \
D(ALLOC_TRIGGER, 6) \
D(DEBUG_GC, 7) \
D(COMPARTMENT_REVIVED, 8) \
D(RESET, 9) \
D(OUT_OF_NURSERY, 10) \
D(EVICT_NURSERY, 11) \
D(DELAYED_ATOMS_GC, 12) \
D(SHARED_MEMORY_LIMIT, 13) \
D(IDLE_TIME_COLLECTION, 14) \
D(BG_TASK_FINISHED, 15) \
D(ABORT_GC, 16) \
D(FULL_WHOLE_CELL_BUFFER, 17) \
D(FULL_GENERIC_BUFFER, 18) \
D(FULL_VALUE_BUFFER, 19) \
D(FULL_CELL_PTR_OBJ_BUFFER, 20) \
D(FULL_SLOT_BUFFER, 21) \
D(FULL_SHAPE_BUFFER, 22) \
D(TOO_MUCH_WASM_MEMORY, 23) \
D(DISABLE_GENERATIONAL_GC, 24) \
D(FINISH_GC, 25) \
D(PREPARE_FOR_TRACING, 26) \
D(UNUSED4, 27) \
D(FULL_CELL_PTR_STR_BUFFER, 28) \
D(TOO_MUCH_JIT_CODE, 29) \
D(FULL_CELL_PTR_BIGINT_BUFFER, 30) \
D(INIT_SELF_HOSTING, 31) \
D(NURSERY_MALLOC_BUFFERS, 32) \
\
/* Reasons from Firefox */ \
D(DOM_WINDOW_UTILS, FIRST_FIREFOX_REASON) \
D(COMPONENT_UTILS, 34) \
D(MEM_PRESSURE, 35) \
D(CC_FINISHED, 36) \
D(CC_FORCED, 37) \
D(LOAD_END, 38) \
D(UNUSED3, 39) \
D(PAGE_HIDE, 40) \
D(NSJSCONTEXT_DESTROY, 41) \
D(WORKER_SHUTDOWN, 42) \
D(SET_DOC_SHELL, 43) \
D(DOM_UTILS, 44) \
D(DOM_IPC, 45) \
D(DOM_WORKER, 46) \
D(INTER_SLICE_GC, 47) \
D(UNUSED1, 48) \
D(FULL_GC_TIMER, 49) \
D(SHUTDOWN_CC, 50) \
D(UNUSED2, 51) \
D(USER_INACTIVE, 52) \
D(XPCONNECT_SHUTDOWN, 53) \
D(DOCSHELL, 54) \
D(HTML_PARSER, 55)
#define GCREASONS(D) \
/* Reasons internal to the JS engine. */ \
D(API, 0) \
D(EAGER_ALLOC_TRIGGER, 1) \
D(DESTROY_RUNTIME, 2) \
D(ROOTS_REMOVED, 3) \
D(LAST_DITCH, 4) \
D(TOO_MUCH_MALLOC, 5) \
D(ALLOC_TRIGGER, 6) \
D(DEBUG_GC, 7) \
D(COMPARTMENT_REVIVED, 8) \
D(RESET, 9) \
D(OUT_OF_NURSERY, 10) \
D(EVICT_NURSERY, 11) \
D(DELAYED_ATOMS_GC, 12) \
D(SHARED_MEMORY_LIMIT, 13) \
D(IDLE_TIME_COLLECTION, 14) \
D(BG_TASK_FINISHED, 15) \
D(ABORT_GC, 16) \
D(FULL_WHOLE_CELL_BUFFER, 17) \
D(FULL_GENERIC_BUFFER, 18) \
D(FULL_VALUE_BUFFER, 19) \
D(FULL_CELL_PTR_OBJ_BUFFER, 20) \
D(FULL_SLOT_BUFFER, 21) \
D(FULL_SHAPE_BUFFER, 22) \
D(TOO_MUCH_WASM_MEMORY, 23) \
D(DISABLE_GENERATIONAL_GC, 24) \
D(FINISH_GC, 25) \
D(PREPARE_FOR_TRACING, 26) \
D(UNUSED4, 27) \
D(FULL_CELL_PTR_STR_BUFFER, 28) \
D(TOO_MUCH_JIT_CODE, 29) \
D(FULL_CELL_PTR_BIGINT_BUFFER, 30) \
D(INIT_SELF_HOSTING, 31) \
D(NURSERY_MALLOC_BUFFERS, 32) \
\
/* \
* Reasons from Firefox. \
* \
* The JS engine attaches special meanings to some of these reasons. \
*/ \
D(DOM_WINDOW_UTILS, FIRST_FIREFOX_REASON) \
D(COMPONENT_UTILS, 34) \
D(MEM_PRESSURE, 35) \
D(CC_FINISHED, 36) \
D(CC_FORCED, 37) \
D(LOAD_END, 38) \
D(UNUSED3, 39) \
D(PAGE_HIDE, 40) \
D(NSJSCONTEXT_DESTROY, 41) \
D(WORKER_SHUTDOWN, 42) \
D(SET_DOC_SHELL, 43) \
D(DOM_UTILS, 44) \
D(DOM_IPC, 45) \
D(DOM_WORKER, 46) \
D(INTER_SLICE_GC, 47) \
D(UNUSED1, 48) \
D(FULL_GC_TIMER, 49) \
D(SHUTDOWN_CC, 50) \
D(UNUSED2, 51) \
D(USER_INACTIVE, 52) \
D(XPCONNECT_SHUTDOWN, 53) \
D(DOCSHELL, 54) \
D(HTML_PARSER, 55) \
\
/* Reasons reserved for embeddings. */ \
D(RESERVED1, 90) \
D(RESERVED2, 91) \
D(RESERVED3, 92) \
D(RESERVED4, 93) \
D(RESERVED5, 94) \
D(RESERVED6, 95) \
D(RESERVED7, 96) \
D(RESERVED8, 97) \
D(RESERVED9, 98)
enum class GCReason {
FIRST_FIREFOX_REASON = 33,