mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 19:21:11 +08:00
perf: 执行期 GC 收集——扩展 mark 跟随 epoch 臂、活 epoch 对象晋升 session(克隆体置活防同轮原地 sweep 误放)、死 session 对象原地释放出表,for-in 门控(活跃迭代器 + 挂起状态盒)与分配包络水位触发
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user