mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 18:51:13 +08:00
feat: SharedArrayBuffer 最小构造器与载荷生命周期
This commit is contained in:
@@ -20,7 +20,7 @@ const STUBS: [(&str, *const (), u8); 7] = [
|
||||
),
|
||||
(
|
||||
"SharedArrayBuffer",
|
||||
oxide_builtins::stubs::shared_array_buffer_stub::<crate::vm::Vm> as *const (),
|
||||
oxide_builtins::array_buffer::shared_array_buffer_constructor::<crate::vm::Vm> as *const (),
|
||||
1,
|
||||
),
|
||||
("Atomics", oxide_builtins::stubs::atomics_stub::<crate::vm::Vm> as *const (), 0),
|
||||
|
||||
@@ -882,7 +882,7 @@ fn bind_stub_globals(core: &Arc<KernelCore>, session: &KernelSession, global: &m
|
||||
),
|
||||
(
|
||||
"SharedArrayBuffer",
|
||||
oxide_builtins::stubs::shared_array_buffer_stub::<crate::vm::Vm> as *const (),
|
||||
oxide_builtins::array_buffer::shared_array_buffer_constructor::<crate::vm::Vm> as *const (),
|
||||
1,
|
||||
),
|
||||
("Atomics", oxide_builtins::stubs::atomics_stub::<crate::vm::Vm> as *const (), 0),
|
||||
|
||||
@@ -67,6 +67,9 @@ impl Vm {
|
||||
} else if src_ref.is_array_buffer_obj() {
|
||||
// 字节缓冲深拷贝到新对象:源 Vec 随 epoch 释放,互不共享。
|
||||
array_buffer::clone_array_buffer_native(src_ref, dst_ref);
|
||||
} else if src_ref.is_shared_array_buffer_obj() {
|
||||
// 字节缓冲深拷贝到新对象:源 Vec 随 epoch 释放,互不共享。
|
||||
array_buffer::clone_shared_array_buffer_native(src_ref, dst_ref);
|
||||
} else if src_ref.is_generator_obj() {
|
||||
// 生成器状态盒深拷贝到新对象:源盒随 epoch 释放,互不共享。
|
||||
crate::generator::clone_generator_native_with_rewrite(src_ref, dst_ref, |value| {
|
||||
|
||||
@@ -116,6 +116,7 @@ impl SessionGc {
|
||||
bytes += module::module_ns_native_size(obj);
|
||||
bytes += disposable_stack::disposable_stack_native_size(obj);
|
||||
bytes += array_buffer::array_buffer_native_size(obj);
|
||||
bytes += array_buffer::shared_array_buffer_native_size(obj);
|
||||
bytes += regexp::regexp_native_size(obj);
|
||||
bytes += typed_array::typed_array_native_size(obj);
|
||||
bytes += data_view::data_view_native_size(obj);
|
||||
@@ -537,6 +538,7 @@ impl SessionGc {
|
||||
freed_bytes += module::drop_module_ns_native(obj);
|
||||
freed_bytes += disposable_stack::drop_dispose_native(obj);
|
||||
freed_bytes += array_buffer::drop_array_buffer_native(obj);
|
||||
freed_bytes += array_buffer::drop_shared_array_buffer_native(obj);
|
||||
freed_bytes += regexp::drop_regexp_native(obj);
|
||||
freed_bytes += typed_array::drop_typed_array_native(obj);
|
||||
freed_bytes += data_view::drop_data_view_native(obj);
|
||||
@@ -625,6 +627,8 @@ impl SessionGc {
|
||||
disposable_stack::clone_dispose_native_with_rewrite(old_ref, new_ref, |value| value);
|
||||
} else if old_ref.is_array_buffer_obj() {
|
||||
array_buffer::clone_array_buffer_native(old_ref, new_ref);
|
||||
} else if old_ref.is_shared_array_buffer_obj() {
|
||||
array_buffer::clone_shared_array_buffer_native(old_ref, new_ref);
|
||||
} else if old_ref.is_typed_array_obj() {
|
||||
typed_array::clone_typed_array_native_with_rewrite(old_ref, new_ref, |value| value);
|
||||
} else if old_ref.is_data_view_obj() {
|
||||
|
||||
Reference in New Issue
Block a user