Commit Graph

45 Commits

Author SHA1 Message Date
pjh123 089179daab refactor: 函数 strict 标志入 IR/编译/缓存链(零行为地基) 2026-08-16 16:46:33 +08:00
pjh123 75153a909d fix: 未声明标识符读取抛 ReferenceError(typeof 特判返回 undefined) 2026-08-16 00:10:08 +08:00
pjh123 78976cad0c feat: 二元幂运算 opcode 支持 number 与 BigInt
- 新增 EXP opcode(0x94)与 emit 层 Exponential 分支,二元 a ** b 不再 compile error
- dispatch_exp 与 dispatch_compound_exp 共享 exp_result:IEEE-754 powf 快路径 +
  BigInt 幂(负/超 u32 指数 RangeError)+ 混合 BigInt/Number TypeError
- 复合 **= 补 BigInt 语义(此前走 f64 近似),与二元 ** 行为一致
2026-08-15 21:17:49 +08:00
pjh123 38a4f20743 perf: CONCAT_N 多操作数拼接单趟精确预分配替代逐次 ADD
新增 CONCAT_N opcode(0x93):连续加号左结合链摊平为单条指令,
字符串模式单趟精确总长预分配,消除 N-2 次中间串分配与逐次整串重拷贝。

- emit 只下钻 left 链、right 括号不拆(a+(b+c) 退化 ADD),求值序与
  f64 结合性保持左结合原义;摊平上限 14 防超长链寄存器压力
- dispatch 两阶段:数值前缀逐项复用 ADD 判定序列(int 溢出升 double、
  BigInt 混合 TypeError、对象 ToPrimitive 副作用序),遇字符串转入
  字符串模式单趟预分配拼接(concat_n_strings)
- RegAlloc graph/rewrite 登记 CONCAT_N ext 操作数(漏收集即错值);
  ic_helper ext_word_count 登记(clear_ic_caches 字节定位)
- contract golden 显式 CONCAT_N 分支(规避 canonical_inst _ 兜底)
2026-08-15 09:08:05 +08:00
pjh123 abeab6f216 fix: finally 体直落进入时置位 finally_active 防完成穿越计数错乱
catch 体正常结束后指令直落入 finally 体,此前 finally_active 未被置位,
finally 内 break/continue/return/throw 触发未进入分支导致 finally 体重复
执行、完成计数错乱。新增无操作数标记指令 TRY_FINALLY_ENTER,在 finally
体入口统一置位栈顶 handler 的 finally_active,覆盖 JMP/直落/unwind/完成
穿越/挂起恢复全部进入路径,并删除 control_flow.rs 中对跳转目标匹配的
脆弱栈顶检测。
2026-08-15 07:47:54 +08:00
pjh123 54b6955f6b perf: IC 多态化 4 槽缓存(FIFO 滚动写回)消除多态场景 miss 重解析
每条 IC 指令扩展字 3→8(4 槽 × [shape_id|proto_depth, slot]),命中槽 0
单态快路径零额外成本,槽 1..3 懒解码遍历,miss 写回 FIFO 滚动(新条目进
槽 0、最老丢弃)。修复原型链 IC 深度解析多走一步与 prop_forge 模板不匹配
不写回两个使缓存恒失效的问题。ic_cache 基准命中率 34.8%→78.9%,
耗时 -29%;单态 prop_access 因扩展字布局膨胀有 ~20% 取指回归(后续
side-table 方案可根除)。
2026-08-15 06:40:19 +08:00
pjh123 0d9004f8e2 perf: 对象字面量批量构造键序预建 shape 2026-08-14 04:47:15 +08:00
pjh123 df23fdff39 feat: compiler/test262 runner 接线 + 模块顶层 this 绑定
- Compiler::compile_module:Emitter::emit_program_module → 统一 IR 管线(DCE/regalloc/lower/flatten)
- CompiledModule.is_es_module:VM run 时模块顶层 this=undefined(脚本仍为全局对象)
- 全局注册 __moduleLinkGet
- test262 runner:Test262ModuleLoader(相对路径解析 + import attributes 判定 json/text/bytes),is_module 走 compile_module
2026-08-12 17:37:33 +08:00
pjh123 f1b7a908f9 fix: class 方法/访问器/constructor/prototype 属性描述符(非枚举/只读),新增 DEFINE_PROP_ATTRS/DEFINE_ACCESSOR_ATTRS
- opcode.rs/inst.rs/contract.rs/vm.rs/vm_dispatch_ctrl.rs:新增两个带 attrs 扩展字的 define 指令
  (attrs bit0=writable, bit1=enumerable, bit2=configurable,与 PropAttributes 一致)
- class/method.rs:方法与非计算访问器改按规范非枚举安装(DefineMethod 语义)
- class/prototype.rs:proto.constructor 非枚举;ctor.prototype 三标志全 false(MakeConstructor)
- 效果:language/statements/class 1782 pass/948 fail -> 1910 pass/716 fail(+128/-232)
2026-08-12 14:11:02 +08:00
pjh123 1824ef0df1 feat: num-bigint 接入任意精度 BigInt(字面量、算术、toString、asIntN/asUintN) 2026-08-12 03:15:18 +08:00
pjh123 b44bc3d7f2 feat: 新增 DEFINE_ACCESSOR_DYNAMIC opcode 支持计算键对象访问器 2026-08-10 23:28:18 +08:00
pjh123 078688070d feat: 实现最小 BigInt 子集(字面量/算术/比较/构造器,Temporal 前置) 2026-08-10 23:02:31 +08:00
pjh123 8a53bfb584 feat: 编译管线/类型层 crate 补全多级日志宏 + 关键路径日志 2026-08-10 17:56:28 +08:00
pjh123 8163a5d25e perf: 子模块树改 Arc 共享,run() 免深拷贝模块树 2026-08-10 17:23:29 +08:00
pjh123 7efb26bc96 perf: 函数调用 bytecode 改 Arc 共享(O(1) 帧切换 + IC 写时复制) 2026-08-10 15:08:51 +08:00
pjh123 03b510b2ef refactor: opcode 语义单张声明式表(def/use/pure/jump/term/ic 六维收敛) 2026-08-10 12:23:19 +08:00
pjh123 80cb1c2feb feat: 循环 let/const 每迭代绑定(MAKE_CELL_FRESH + 解构捕获修复) 2026-08-10 10:18:39 +08:00
pjh123 e03ec0f635 fix: 脚本顶层 var/function 声明落 globalThis(DEFINE_GLOBAL_PROP 非可配置数据属性) 2026-08-10 03:52:17 +08:00
pjh123 a5a910a24e feat: for-await-of + Symbol.asyncIterator + AsyncFromSyncIterator 2026-08-10 03:21:37 +08:00
pjh123 85c192a747 feat: rest 参数(function f(...args)),实参区收集数组 2026-08-10 00:33:25 +08:00
pjh123 fd47cd56d0 feat: async/await 语法支持(AWAIT 帧快照挂起/恢复 + 微任务驱动 + AsyncFunction intrinsics) 2026-08-09 22:02:15 +08:00
pjh123 464712f7ba feat: 实现 yield* 委托语法(内层迭代器 next/return/throw 转发) 2026-08-09 20:00:16 +08:00
pjh123 783e89e4cb feat: 生成器基础支持(YIELD 帧快照挂起/恢复 + GeneratorPrototype next/return/throw)
- 新增 YIELD/SUSPEND_BODY opcode;function* 识别与 yield emit
- GeneratorState 全量快照 VM 执行上下文(regs/pc/bytecode/spill/save/try/cell 栈段/迭代器)
- 调用时参数初始化(默认值/解构副作用与异常在 g() 时刻生效)
- %GeneratorPrototype%/%GeneratorFunction.prototype% 内建对象与 next/return/throw
- session GC trace 生成器状态 JsValues;闭包捕获分析补 yield/赋值目标扫描
2026-08-09 18:02:08 +08:00
pjh123 c8740bfb49 feat: 函数 length 属性(字节码函数/bind 包装器)+ getter/setter name 前缀 2026-08-09 15:38:45 +08:00
pjh123 088b3bc976 fix: opcode IC ext words 计数断言更新(新 opcode 增长) 2026-08-09 09:40:04 +08:00
pjh123 8669f55470 feat: class 公有字段 define 语义 + computed key 类定义期求值一次 2026-08-09 09:35:24 +08:00
pjh123 5611d90ad0 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)
2026-08-09 07:22:46 +08:00
pjh123 cd214069cd fix: try/finally 支持 break/continue/return 穿越 finally(completion 机制) 2026-08-08 12:38:25 +08:00
pjh123 6c29515624 feat: 对象字面量 spread({...obj} 展开可枚举自有属性) 2026-08-08 11:24:09 +08:00
pjh123 ab979dc47b feat: 调用实参 spread(f(...args) / new F(...args) / super(...args)) 2026-08-08 10:33:16 +08:00
pjh123 bfcf132d73 feat: arguments 对象绑定(CREATE_ARGUMENTS + 帧实参 spill 区) 2026-08-08 00:01:22 +08:00
pjh123 de67cc8eee fix: 链式 upvalue 捕获支持多层嵌套函数引用深层变量 2026-08-07 14:56:51 +08:00
pjh123 fd94ff6931 fix: 子模块全局扁平化根治逃逸闭包上下文错位 2026-08-07 10:49:15 +08:00
pjh123 31e28a03a6 docs: 补充注释与格式化 2026-08-06 23:10:27 +08:00
pjh123 c46f7023c6 feat: 新增 MOV/SPILL/UNSPILL opcode 登记 + 构造 API + 契约层(D-06/D-07) 2026-08-06 16:34:25 +08:00
pjh123 224d1347eb refactor: 寄存器号 u8→u32 全链放宽,vreg 化去 checkpoint/reg_overflow 2026-08-06 16:31:16 +08:00
pjh123 263fd255b6 docs: 添加 Rustdoc 注释 2026-08-05 21:46:47 +08:00
pjh123 c58aae4862 feat: 搭建闭包捕获基础设施 2026-06-30 19:58:58 +08:00
pjh123 14f82d2c4d refactor: 用 define_opcodes! 宏统一生成 OpCode 枚举/TryFrom/Display 2026-06-25 18:12:37 +08:00
pjh123 1cab5bde65 perf: 不可变常量改 OnceLock 一次性缓存,删 Constant 死变体并移出 GC 根 2026-06-25 14:32:49 +08:00
pjh123 63737ef74d feat: 增加 CreateRegExp 字节码,正则字面量每次执行创建新对象 2026-06-25 10:28:35 +08:00
pjh123 c378b92d1a feat: 增加 CreateClosure 字节码,函数字面量每次执行创建新闭包 2026-06-25 10:16:32 +08:00
pjh123 94405f50d7 refactor: 移除代码注释中的文档内部编号引用 2026-06-24 16:03:53 +08:00
pjh123 1815958b11 refactor: 清理未使用符号,合并bind_constructor宏,统一init/rebind绑定列表,bind_number改为表驱动 2026-06-24 12:12:44 +08:00
pjh123 be87e4e21b refactor: 拆分 bytecode/cache crate 并模块化 counter 2026-06-23 17:06:39 +08:00