mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-26 19:51:11 +08:00
docs: 改写虚拟机调度与属性域注释
vm/mod.rs:补模块头,说明基于寄存器的执行状态、寄存器文件、调用栈 与 session 内存及子模块职责;为 MAX_PROTO_CHAIN_DEPTH、 format_error_message、is_object_prototype 补文档。 vm/call.rs:为 is_session_ptr、alloc_object 补文档;为 call_function_sync、push_bytecode_frame 补五段式文档,写清 native/字节码 统一同步调用与统一压帧的步骤、边界和副作用。 vm/gc_hooks.rs:为 for_each_root、maybe_collect_session_gc 补文档。 vm/props.rs:property_key_si 首现展开字符串 intern id;为 array_index_from_property_key、resolve_property、get_own_property_slot 补文档。
This commit is contained in:
@@ -168,11 +168,15 @@ impl Vm {
|
||||
}
|
||||
}
|
||||
|
||||
/// GC 根统一枚举入口:遍历的字段清单与 `rewrite_values` 一一对应。
|
||||
pub(crate) fn for_each_root(&self, f: impl FnMut(JsValue)) {
|
||||
// 统一遍历:根收集与指针重写共用同一字段清单。
|
||||
self.for_each_value(f);
|
||||
}
|
||||
|
||||
/// 执行一次 session GC(是否真正回收由 `SessionGc` 的水位门控决定)。
|
||||
///
|
||||
/// `session_gc` 经 `mem::take` 借出后再放回:收集需要 `&mut Vm`,而
|
||||
/// `SessionGc` 是 `Vm` 的内部字段,借出以避开借用冲突。
|
||||
pub(crate) fn maybe_collect_session_gc(&mut self) {
|
||||
let mut session_gc = std::mem::take(&mut self.gc_state.session_gc);
|
||||
session_gc.maybe_collect(self);
|
||||
|
||||
Reference in New Issue
Block a user