feat: with 语句、成员位/移位复合赋值、CALL_NATIVE 无目标修复

with 语句:新增 emit 支持,with 体内自由标识符动态解析(对象属性优先,
回退外层),支持读/写/复合赋值/自增自减/delete/var 初始化动态化,
TO_OBJECT opcode 处理原始值对象,顶层 this 绑定全局对象。

复合赋值:新增 6 个 COMPOUND_MEMBER_BIT_* opcode 支持成员位/移位复合赋值,
修复 computed member 复合赋值覆盖 bug,with 内标识符复合赋值动态化。

CALL_NATIVE:实现全局 isNaN/isFinite 并绑定,用户覆盖 builtin 名时
回退通用调用路径而非报错,局部遮蔽 builtin 名走普通 CALL。

test262: with 34 pass(基线 0),compound-assignment 320 pass(基线 223)
This commit is contained in:
爱特每羊队
2026-08-09 07:22:46 +08:00
parent eefdfc0d2c
commit 2f8f1c3b71
23 changed files with 829 additions and 137 deletions
+18 -2
View File
@@ -30,7 +30,13 @@ impl Inst {
| OpCode::COMPOUND_MEMBER_MUL
| OpCode::COMPOUND_MEMBER_DIV
| OpCode::COMPOUND_MEMBER_MOD
| OpCode::COMPOUND_MEMBER_EXP => reg_of(&self.a),
| OpCode::COMPOUND_MEMBER_EXP
| OpCode::COMPOUND_MEMBER_BIT_AND
| OpCode::COMPOUND_MEMBER_BIT_OR
| OpCode::COMPOUND_MEMBER_BIT_XOR
| OpCode::COMPOUND_MEMBER_SHL
| OpCode::COMPOUND_MEMBER_SHR
| OpCode::COMPOUND_MEMBER_USHR => reg_of(&self.a),
// 无 def:控制流 / 写共享状态 / 纯写对象
OpCode::HALT
| OpCode::RETURN
@@ -139,7 +145,13 @@ impl Inst {
| OpCode::COMPOUND_MEMBER_MUL
| OpCode::COMPOUND_MEMBER_DIV
| OpCode::COMPOUND_MEMBER_MOD
| OpCode::COMPOUND_MEMBER_EXP => {
| OpCode::COMPOUND_MEMBER_EXP
| OpCode::COMPOUND_MEMBER_BIT_AND
| OpCode::COMPOUND_MEMBER_BIT_OR
| OpCode::COMPOUND_MEMBER_BIT_XOR
| OpCode::COMPOUND_MEMBER_SHL
| OpCode::COMPOUND_MEMBER_SHR
| OpCode::COMPOUND_MEMBER_USHR => {
push_operand(&mut uses, &self.rd);
push_operand(&mut uses, &self.a);
push_operand(&mut uses, &self.b);
@@ -290,6 +302,10 @@ impl Inst {
| OpCode::PROFILE_CALL
| OpCode::FORK
| OpCode::JOIN => {}
// TO_OBJECT:rd 原地转换(读且写)
OpCode::TO_OBJECT => {
push_operand(&mut uses, &self.rd);
}
}
uses
}