fix: Object.prototype.toString tags for Math/JSON/Arguments

This commit is contained in:
爱特每羊队
2026-08-12 02:29:40 +08:00
parent 28477a3e47
commit ca293a57e9
3 changed files with 16 additions and 6 deletions
+3 -6
View File
@@ -168,6 +168,7 @@ impl Vm {
let proto_ptr = &*self.object_prototype as *const JsObject as *mut JsObject;
let obj_ptr = self.alloc_object(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::from_js_object(proto_ptr)));
let obj = unsafe { &mut *obj_ptr };
obj.type_tag = JsObject::OBJ_TYPE_ARGUMENTS;
// 索引属性:按实参下标写入 shape 槽,属性描述符为默认(可写/可枚举/可配置)。
for i in 0..count as usize {
@@ -216,12 +217,8 @@ impl Vm {
let rest_len = n.saturating_sub(fixed_count);
let proto_ptr = self.session.builtin_world().array_proto.as_ptr() as *mut JsObject;
let bump = self.epoch.bump();
let obj_ptr = self.alloc_object(JsObject::new_array(
EMPTY_SHAPE_ID,
JsValue::from_js_object(proto_ptr),
rest_len,
bump,
));
let obj_ptr =
self.alloc_object(JsObject::new_array(EMPTY_SHAPE_ID, JsValue::from_js_object(proto_ptr), rest_len, bump));
let obj = unsafe { &mut *obj_ptr };
for i in 0..rest_len {
let val = self