feat: 增加 CreateClosure 字节码,函数字面量每次执行创建新闭包

This commit is contained in:
2026-06-25 10:16:32 +08:00
parent d7bc6a9b4e
commit c378b92d1a
8 changed files with 29 additions and 13 deletions
+3
View File
@@ -90,6 +90,7 @@ pub enum OpCode {
SUPER_STATIC_GET_PROP = 0x46,
SET_HOME_OBJECT = 0x47,
DEFINE_ACCESSOR = 0x48,
CREATE_CLOSURE = 0x4A,
// ── Object Property (0x50-0x5F) ──
IC_GET_PROP = 0x50,
@@ -238,6 +239,7 @@ impl TryFrom<u8> for OpCode {
0x46 => Ok(OpCode::SUPER_STATIC_GET_PROP),
0x47 => Ok(OpCode::SET_HOME_OBJECT),
0x48 => Ok(OpCode::DEFINE_ACCESSOR),
0x4A => Ok(OpCode::CREATE_CLOSURE),
0x50 => Ok(OpCode::IC_GET_PROP),
0x51 => Ok(OpCode::IC_SET_PROP),
0x52 => Ok(OpCode::GET_PROP),
@@ -357,6 +359,7 @@ impl fmt::Display for OpCode {
OpCode::SUPER_STATIC_GET_PROP => "SUPER_STATIC_GET_PROP",
OpCode::SET_HOME_OBJECT => "SET_HOME_OBJECT",
OpCode::DEFINE_ACCESSOR => "DEFINE_ACCESSOR",
OpCode::CREATE_CLOSURE => "CREATE_CLOSURE",
OpCode::IC_GET_PROP => "IC_GET_PROP",
OpCode::IC_SET_PROP => "IC_SET_PROP",
OpCode::GET_PROP => "GET_PROP",