mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-26 11:41:13 +08:00
feat: 搭建闭包捕获基础设施
This commit is contained in:
@@ -82,6 +82,16 @@ impl SessionGc {
|
||||
if obj.is_data_view_obj() {
|
||||
edges.extend(data_view::data_view_native_edges(obj));
|
||||
}
|
||||
// Traverse upvalue cells for object references
|
||||
for cell_ptr in obj.upvalues_slice() {
|
||||
if cell_ptr.is_null() {
|
||||
continue;
|
||||
}
|
||||
let cell = unsafe { &**cell_ptr };
|
||||
if cell.value.is_object() {
|
||||
edges.push(cell.value);
|
||||
}
|
||||
}
|
||||
edges
|
||||
}
|
||||
|
||||
@@ -103,6 +113,16 @@ impl SessionGc {
|
||||
if obj.home_object().is_string() {
|
||||
live.insert(obj.home_object().as_string_ptr_mut());
|
||||
}
|
||||
// Scan upvalue cells for string references
|
||||
for cell_ptr in obj.upvalues_slice() {
|
||||
if cell_ptr.is_null() {
|
||||
continue;
|
||||
}
|
||||
let cell = unsafe { &**cell_ptr };
|
||||
if cell.value.is_string() {
|
||||
live.insert(cell.value.as_string_ptr_mut());
|
||||
}
|
||||
}
|
||||
if obj.is_map() {
|
||||
for value in map::map_native_edges(obj) {
|
||||
if value.is_string() {
|
||||
|
||||
Reference in New Issue
Block a user