perf: 执行期 GC 收集——扩展 mark 跟随 epoch 臂、活 epoch 对象晋升 session(克隆体置活防同轮原地 sweep 误放)、死 session 对象原地释放出表,for-in 门控(活跃迭代器 + 挂起状态盒)与分配包络水位触发

This commit is contained in:
2026-09-12 00:25:56 +00:00
parent e5538d85d6
commit 390b72e3bd
8 changed files with 536 additions and 52 deletions
+10 -1
View File
@@ -478,11 +478,20 @@ fn async_state_mut(obj: &JsObject) -> Option<&mut AsyncState> {
None
} else {
// SAFETY: native_data 在 create_async_context 中由 Box::into_raw 分配,
// 生命周期与异步上下文对象一致;GC 只在 reset(无执行状态)时运行。
// 生命周期与异步上下文对象一致;GC 路径(mark 边收集、执行期门控扫描)只读状态盒。
Some(unsafe { &mut *ptr })
}
}
/// 异步挂起帧是否持有 for-in 迭代器:执行期收集门控按指针扫描
/// (ForInIter body 分配于 epoch arena,换新 Bump 即时失效在表迭代器)。
pub(crate) fn async_holds_suspended_for_in(obj: &JsObject) -> bool {
let Some(state) = async_state_mut(obj) else {
return false;
};
!state.suspended.for_in_iters.is_empty()
}
/// 异步状态内所有对象引用的扁平列表(GC mark 边)。
pub(crate) fn async_native_edges(obj: &JsObject) -> Vec<JsValue> {
let Some(state) = async_state_mut(obj) else {