mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-26 11:41:13 +08:00
refactor: 退役 Vm epoch 字段面与 doc epoch 表述
This commit is contained in:
@@ -87,9 +87,9 @@ pub(crate) type SetInner = indexmap::IndexSet<SetKey>;
|
||||
///
|
||||
/// # 调用方维护的安全性契约
|
||||
///
|
||||
/// 指针在 Set `JsObject` 存活期间有效:`JsObject` 分配于当前 `Epoch` arena,
|
||||
/// native builtin 执行期间不会调用 `Epoch::reset()`。持有分配的
|
||||
/// `Box<IndexSet>` 由 `new_set_inner()` 创建,Set 生命周期内不释放。
|
||||
/// 指针在 Set `JsObject` 存活期间有效:`JsObject` 经统一入口分配,session GC
|
||||
/// 回收界定其生命周期,native builtin 执行期间对象被根保持、不被回收。
|
||||
/// 持有分配的 `Box<IndexSet>` 由 `new_set_inner()` 创建,Set 生命周期内不释放。
|
||||
/// native 调用为单线程,同一 Set 对象同时至多存在一个活 `*mut` 别名。
|
||||
fn get_set_inner<H: VmHost>(vm: &mut H, this_val: JsValue) -> Result<*mut SetInner, JsValue> {
|
||||
if !this_val.is_object() {
|
||||
@@ -99,8 +99,8 @@ fn get_set_inner<H: VmHost>(vm: &mut H, this_val: JsValue) -> Result<*mut SetInn
|
||||
if set_ptr.is_null() {
|
||||
return Err(crate::error::create_type_error(vm, "Set internal state invalid"));
|
||||
}
|
||||
// SAFETY: set_ptr 是当前 Epoch bump 分配的 JsObject 的非空、对齐指针,
|
||||
// 本调用期间有效。
|
||||
// SAFETY: set_ptr 是 JsObject 的非空、对齐指针;对象在 native 执行期间
|
||||
// 被根保持、不被回收,指针在本调用内有效。
|
||||
let set_obj = unsafe { &*set_ptr };
|
||||
if !set_obj.is_set() {
|
||||
return Err(crate::error::create_type_error(vm, "Set.prototype.add called on incompatible receiver"));
|
||||
|
||||
Reference in New Issue
Block a user