mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-26 19:51:11 +08:00
fix: RegExp source/flags 原型访问器与 GC 根追踪
This commit is contained in:
@@ -222,6 +222,11 @@ impl SessionGc {
|
||||
Self::mark_string_live(live_strings, ptr);
|
||||
}
|
||||
}
|
||||
// RegExp 实例 source/flags 字段持有字符串边。
|
||||
if obj.is_regexp_obj() {
|
||||
Self::process_edge(obj.get_regexp_source(), vm, stack, live_strings, live_bigints);
|
||||
Self::process_edge(obj.get_regexp_flags(), vm, stack, live_strings, live_bigints);
|
||||
}
|
||||
// 遍历 upvalue cell 中的引用。
|
||||
for cell_ptr in obj.upvalues_slice() {
|
||||
if cell_ptr.is_null() {
|
||||
@@ -393,6 +398,15 @@ impl SessionGc {
|
||||
Self::mark_string_live(live, ptr);
|
||||
}
|
||||
}
|
||||
// RegExp 实例 source/flags 字段持有字符串边。
|
||||
if obj.is_regexp_obj() {
|
||||
if obj.get_regexp_source().is_string() {
|
||||
Self::mark_string_live(live, obj.get_regexp_source().as_string_ptr_mut());
|
||||
}
|
||||
if obj.get_regexp_flags().is_string() {
|
||||
Self::mark_string_live(live, obj.get_regexp_flags().as_string_ptr_mut());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 从 VM roots 标记存活的 session/epoch 对象、字符串与 BigInt,供 `sweep` 判定。
|
||||
|
||||
Reference in New Issue
Block a user