enum class PhaseKind : uint8_t {
  FIRST,
  MUTATOR = FIRST,
  GC_BEGIN,
  MARK_CCWS,
  MARK_STACK,
  MARK_RUNTIME_DATA,
  MARK_EMBEDDING,
  MARK_ROOTS,
  EVICT_NURSERY_FOR_MAJOR_GC,
  WAIT_BACKGROUND_THREAD,
  UNMARK,
  UNMARK_WEAKMAPS,
  MARK_DISCARD_CODE,
  RELAZIFY_FUNCTIONS,
  PURGE,
  PURGE_PROP_MAP_TABLES,
  PURGE_SOURCE_URLS,
  JOIN_PARALLEL_TASKS,
  PREPARE,
  MARK_DELAYED,
  MARK_GRAY_WEAK,
  MARK_WEAK,
  MARK_INCOMING_GRAY,
  MARK_GRAY,
  PARALLEL_MARK_MARK,
  PARALLEL_MARK_WAIT,
  PARALLEL_MARK_OTHER,
  PARALLEL_MARK,
  MARK,
  WEAK_ZONES_CALLBACK,
  WEAK_COMPARTMENT_CALLBACK,
  FINALIZE_START,
  UPDATE_ATOMS_BITMAP,
  SWEEP_ATOMS_TABLE,
  SWEEP_JIT_SCRIPTS,
  SWEEP_INNER_VIEWS,
  SWEEP_CC_WRAPPER,
  SWEEP_BASE_SHAPE,
  SWEEP_INITIAL_SHAPE,
  SWEEP_REGEXP,
  SWEEP_COMPRESSION,
  SWEEP_WEAKMAPS,
  SWEEP_UNIQUEIDS,
  SWEEP_WEAK_POINTERS,
  SWEEP_FINALIZATION_OBSERVERS,
  SWEEP_JIT_DATA,
  SWEEP_WEAK_CACHES,
  SWEEP_MISC,
  SWEEP_COMPARTMENTS,
  SWEEP_PROP_MAP,
  FINALIZE_END,
  DESTROY,
  FIND_DEAD_COMPARTMENTS,
  SWEEP,
  COMPACT_MOVE,
  COMPACT_UPDATE_CELLS,
  COMPACT_UPDATE,
  COMPACT,
  DECOMMIT,
  GC_END,
  MINOR_GC,
  EVICT_NURSERY,
  TRACE_HEAP,
  LIMIT,
  NONE = LIMIT,
  EXPLICIT_SUSPENSION = LIMIT,
  IMPLICIT_SUSPENSION
};

enum class Phase : uint8_t {
  FIRST,
  MUTATOR = FIRST,
  GC_BEGIN,
  EVICT_NURSERY_FOR_MAJOR_GC,
  MARK_ROOTS_1,
  MARK_CCWS_1,
  MARK_STACK_1,
  MARK_RUNTIME_DATA_1,
  MARK_EMBEDDING_1,
  WAIT_BACKGROUND_THREAD,
  PREPARE,
  UNMARK,
  UNMARK_WEAKMAPS,
  MARK_DISCARD_CODE,
  RELAZIFY_FUNCTIONS,
  PURGE,
  PURGE_PROP_MAP_TABLES,
  PURGE_SOURCE_URLS,
  JOIN_PARALLEL_TASKS_1,
  MARK_1,
  MARK_ROOTS_2,
  MARK_CCWS_2,
  MARK_STACK_2,
  MARK_RUNTIME_DATA_2,
  MARK_EMBEDDING_2,
  MARK_DELAYED_1,
  MARK_WEAK_1,
  MARK_DELAYED_2,
  MARK_GRAY_WEAK_1,
  MARK_INCOMING_GRAY_1,
  MARK_GRAY_1,
  PARALLEL_MARK_1,
  JOIN_PARALLEL_TASKS_2,
  PARALLEL_MARK_MARK_1,
  PARALLEL_MARK_WAIT_1,
  PARALLEL_MARK_OTHER_1,
  SWEEP,
  MARK_2,
  MARK_ROOTS_3,
  MARK_CCWS_3,
  MARK_STACK_3,
  MARK_RUNTIME_DATA_3,
  MARK_EMBEDDING_3,
  MARK_DELAYED_3,
  MARK_WEAK_2,
  MARK_DELAYED_4,
  MARK_GRAY_WEAK_2,
  MARK_INCOMING_GRAY_2,
  MARK_GRAY_2,
  PARALLEL_MARK_2,
  JOIN_PARALLEL_TASKS_3,
  PARALLEL_MARK_MARK_2,
  PARALLEL_MARK_WAIT_2,
  PARALLEL_MARK_OTHER_2,
  FINALIZE_START,
  WEAK_ZONES_CALLBACK,
  WEAK_COMPARTMENT_CALLBACK,
  UPDATE_ATOMS_BITMAP,
  SWEEP_ATOMS_TABLE,
  SWEEP_COMPARTMENTS,
  SWEEP_JIT_SCRIPTS,
  SWEEP_INNER_VIEWS,
  SWEEP_CC_WRAPPER,
  SWEEP_BASE_SHAPE,
  SWEEP_INITIAL_SHAPE,
  SWEEP_REGEXP,
  SWEEP_COMPRESSION,
  SWEEP_WEAKMAPS,
  SWEEP_UNIQUEIDS,
  SWEEP_WEAK_POINTERS,
  SWEEP_FINALIZATION_OBSERVERS,
  SWEEP_JIT_DATA,
  SWEEP_WEAK_CACHES,
  SWEEP_MISC,
  JOIN_PARALLEL_TASKS_4,
  SWEEP_PROP_MAP,
  FINALIZE_END,
  DESTROY,
  JOIN_PARALLEL_TASKS_5,
  FIND_DEAD_COMPARTMENTS,
  COMPACT,
  COMPACT_MOVE,
  COMPACT_UPDATE,
  MARK_ROOTS_4,
  MARK_CCWS_4,
  MARK_STACK_4,
  MARK_RUNTIME_DATA_4,
  MARK_EMBEDDING_4,
  COMPACT_UPDATE_CELLS,
  JOIN_PARALLEL_TASKS_6,
  DECOMMIT,
  GC_END,
  MINOR_GC,
  MARK_ROOTS_5,
  MARK_CCWS_5,
  MARK_STACK_5,
  MARK_RUNTIME_DATA_5,
  MARK_EMBEDDING_5,
  EVICT_NURSERY,
  MARK_ROOTS_6,
  MARK_CCWS_6,
  MARK_STACK_6,
  MARK_RUNTIME_DATA_6,
  MARK_EMBEDDING_6,
  TRACE_HEAP,
  MARK_ROOTS_7,
  MARK_CCWS_7,
  MARK_STACK_7,
  MARK_RUNTIME_DATA_7,
  MARK_EMBEDDING_7,
  LIMIT,
  NONE = LIMIT,
  EXPLICIT_SUSPENSION = LIMIT,
  IMPLICIT_SUSPENSION
};

static const size_t MAX_PHASE_NESTING = 4;
