mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 11:11:11 +08:00
refactor: 绑定与 kernel 符号键改经 realm 维度编码
This commit is contained in:
@@ -8,7 +8,10 @@ use oxide_kernel::kernel::{KernelCore, KernelSession};
|
||||
use oxide_types::object::{JsObject, PropAttributes};
|
||||
|
||||
/// 把 ArrayBuffer 构造器与原型方法绑定到 global。
|
||||
pub fn bind_array_buffer(core: &Arc<KernelCore>, session: &KernelSession, global: &mut JsObject) {
|
||||
///
|
||||
/// `realm_id` 是目标所属 realm 的编号:`@@species` 符号键按 (realm 编号, 局部
|
||||
/// 下标) 编码,realm 编号为 0 时与旧编码逐字节一致。
|
||||
pub fn bind_array_buffer(core: &Arc<KernelCore>, session: &KernelSession, global: &mut JsObject, realm_id: u32) {
|
||||
let ctor_ptr = session.builtin_world().array_buffer_constructor.as_ptr() as *mut JsObject;
|
||||
let ctor = unsafe { &mut *ctor_ptr };
|
||||
let proto_ptr = session.builtin_world().array_buffer_proto.as_ptr() as *mut JsObject;
|
||||
@@ -37,7 +40,7 @@ pub fn bind_array_buffer(core: &Arc<KernelCore>, session: &KernelSession, global
|
||||
core,
|
||||
session,
|
||||
ctor,
|
||||
oxide_types::private_key::make_well_known_symbol_key(oxide_types::private_key::WELL_KNOWN_SYMBOL_SPECIES),
|
||||
oxide_types::private_key::encode_symbol_key(realm_id, oxide_types::private_key::WELL_KNOWN_SYMBOL_SPECIES),
|
||||
"get [Symbol.species]",
|
||||
oxide_builtins::array::array_species_get::<crate::vm::Vm> as *const (),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user