mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
feat: 共享 ThrowTypeError 对象并拆分 arguments callee 四象限
This commit is contained in:
@@ -560,10 +560,13 @@ impl BuiltinWorld {
|
||||
let async_disposable_stack_proto = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
|
||||
// 默认迭代器指针初值空(绑定层随后经 bind_string 捕获写入)。
|
||||
let string_default_iterator = std::cell::Cell::new(std::ptr::null());
|
||||
// %ThrowTypeError% 指针初值空(绑定层随后经 bind_function 捕获写入)。
|
||||
let throw_type_error = std::cell::Cell::new(std::ptr::null());
|
||||
|
||||
let world = Self {
|
||||
object_proto,
|
||||
string_default_iterator,
|
||||
throw_type_error,
|
||||
array_proto,
|
||||
function_proto,
|
||||
string_proto,
|
||||
|
||||
@@ -494,6 +494,13 @@ impl BuiltinWorld {
|
||||
} else {
|
||||
current.string_default_iterator.get()
|
||||
}),
|
||||
// %ThrowTypeError% 原型链挂 Function.prototype:function 家族脏时
|
||||
// 置空由绑定层重建,未脏沿用旧对象(跨重建恒等)。
|
||||
throw_type_error: std::cell::Cell::new(if dirty.function {
|
||||
std::ptr::null()
|
||||
} else {
|
||||
current.throw_type_error.get()
|
||||
}),
|
||||
array_proto,
|
||||
function_proto,
|
||||
string_proto,
|
||||
|
||||
@@ -132,6 +132,11 @@ pub struct BuiltinWorld {
|
||||
/// 同一对象),无法像集合迭代器那样复用"与迭代器原型槽比较"的判法,
|
||||
/// 故独立存一份指针。`Cell` 供绑定层经 `&Arc<BuiltinWorld>` 共享引用写入。
|
||||
pub string_default_iterator: std::cell::Cell<*const JsObject>,
|
||||
/// `%ThrowTypeError%` 函数对象裸指针:Function.prototype 的 caller/arguments
|
||||
/// 受限访问器与 unmapped arguments.callee 访问器共享同一对象(跨形态恒等)。
|
||||
/// 绑定层安装访问器时写入,运行期创建 arguments 对象时读取;wrapper 本体归
|
||||
/// `leaked_objects` 释放登记表所有,session 收尾统一释放。
|
||||
pub throw_type_error: std::cell::Cell<*const JsObject>,
|
||||
/// `%RegExpStringIteratorPrototype%`:matchAll 返回的迭代器。
|
||||
pub regexp_string_iterator_proto: P<JsObject>,
|
||||
/// `%AsyncIteratorPrototype%`:异步迭代器原型(链到 Object.prototype),
|
||||
|
||||
Reference in New Issue
Block a user