Commit Graph

94 Commits

Author SHA1 Message Date
pjh123 c7b238e518 feat: eval 全局注册与最小执行(间接 eval) 2026-08-16 22:25:33 +08:00
pjh123 e100bfb8b4 feat: SuppressedError 内置错误实现(三字段属性序 + 构造器接线) 2026-08-16 19:04:09 +08:00
pjh123 089179daab refactor: 函数 strict 标志入 IR/编译/缓存链(零行为地基) 2026-08-16 16:46:33 +08:00
pjh123 277429e3ea fix: 绑定模式内嵌默认值表达式补捕获扫描,嵌套函数引用外层绑定防 LOAD_GLOBAL 回归 2026-08-16 14:53:57 +08:00
pjh123 c5c4916a8f fix: 绑定侧解构计算键参与闭包捕获遍历防静默错值 2026-08-16 14:30:20 +08:00
pjh123 ef3882ac55 feat: 解构计算键通用 fallback 支持任意键表达式 2026-08-16 13:49:17 +08:00
pjh123 ce0f865004 fix: for-in/for-of 头名仅 var 提升入入口初始化名单,排除 let/const 2026-08-16 13:32:25 +08:00
pjh123 9002a1aa77 fix: 类表达式真实名 cell 按声明路径门控,不再覆盖外层同名绑定 2026-08-16 13:32:25 +08:00
pjh123 fe8892079e chore: 全仓 rustfmt 格式化归拢 2026-08-16 12:50:36 +08:00
pjh123 648842fd82 feat: new.target MetaProperty emit 支持(LOAD_VAR NewTarget) 2026-08-16 12:43:50 +08:00
pjh123 1229924af6 fix: var 捕获绑定函数与程序入口统一初始化为 undefined 消除 TDZ 误报 2026-08-16 12:34:10 +08:00
pjh123 5086e15b66 fix: class 声明名纳入闭包捕获,嵌套函数经 cell 读取类绑定 2026-08-16 12:34:03 +08:00
pjh123 bbc09a8208 feat: 私有字段复合赋值 emit 支持(GET_PRIVATE→op→SET_PRIVATE 序列) 2026-08-16 12:12:26 +08:00
pjh123 00b2f4d8b1 fix: class 生成器方法补 is_generator 标志,修正方法形态生成器语义 2026-08-16 11:44:20 +08:00
pjh123 744899aae9 fix: for-of/for-in 提前退出时按规范顺序完成 IteratorClose
return/break/continue 逃出 for-of 时此前完全不执行 IteratorClose:
BREAK/CONTINUE/RETURN 指令现在经 ext 字携带词法逃出的迭代器层数
(for-of + for-in 各 16 位),运行时在全部 finally 穿越之后、真正
跳转/返回之前按 LIFO 关闭——与规范 §13.7.5.4(循环体完成值已含
内部 try-finally 处理,IteratorClose 在后)顺序一致。

- emit 词法:LabelCtx 增加 for-of/for-in 深度计数,loop/switch/label
  打开时快照,break/continue/return 按当前深度减目标深度计算逃出层数
  (switch 内 break 以 switch 打开点为基准,目标循环自身不计入)
- 指令编码:brk/cont/ret 三参构造,lower 跳转路径补发 ext 字
- 运行时:dispatch_break/continue/return 读取逃出计数,无 finally 时
  直接关闭后跳转/返回,有 finally 时随 Completion 悬挂由 TRY_FINALLY_END
  在穿越完成后消费;生成器 .return()/.throw() 注入经 complete_generator_return
  全关快照栈迭代器;return() 抛错经 unwind 替代完成值并关闭剩余迭代器
- 顺带:for-in 逃出残留(无 return() 语义,仅弹栈);for-await-of 的
  异步迭代器不做同步关闭(return() promise 须 await,走异步机制)
- 新增 15 项回归测试:return/labeled break/continue/switch/while/finally
  顺序/抛错优先/生成器注入/for-in/for-await-of 嵌套
2026-08-16 09:31:39 +08:00
pjh123 4e2644016b test: $262 宿主对象最小绑定 + is not defined 判定白名单化
引擎侧:绑定 $262 宿主对象(evalScript/global/gc 可用,detachArrayBuffer/
createRealm/agent 抛 not supported 而非 ReferenceError),并加入编译期
已知全局表;引用 $262.* 的测试从全量 skip 转为真实执行。

runner 侧:is not defined 不再一票吞 skip——解析错误消息中的标识符名,
仅在缺失全局白名单($262/structuredClone/queueMicrotask)内才按能力
缺失跳过;其余 is not defined 按真实失败计入,修复后应转 PASS 的
测试恢复可见。
2026-08-16 02:47:02 +08:00
pjh123 75153a909d fix: 未声明标识符读取抛 ReferenceError(typeof 特判返回 undefined) 2026-08-16 00:10:08 +08:00
pjh123 7f1187feaf fix: 非常量键成员 **= 复合赋值 rhs 生效 2026-08-15 23:20:36 +08:00
pjh123 391f613653 fix: 块内函数声明预声明支持(Annex B 块级绑定) 2026-08-15 23:13:26 +08:00
pjh123 bca463438d fix: for-const 循环 update 段豁免 const 写检查(per-iteration 绑定合法) 2026-08-15 22:29:09 +08:00
pjh123 26db7ae07c fix: TDZ 写与 const 赋值检查补全(含闭包捕获路径) 2026-08-15 21:55:43 +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 5061ad7a44 fix: 计算成员复合赋值保规范求值序 2026-08-14 11:41:50 +08:00
pjh123 6a39bccc94 perf: 常量字符串键计算成员折叠走 IC 静态路径 2026-08-14 10:20:32 +08:00
pjh123 ee7fa88ad7 chore: 清理 oxide_emit clippy 告警 2026-08-14 05:26:25 +08:00
pjh123 0d9004f8e2 perf: 对象字面量批量构造键序预建 shape 2026-08-14 04:47:15 +08:00
pjh123 b32d525141 feat: emit 模块编译(快照式链接:依赖子模块闭包 + import/export 域)
- emit_program_module:模块顶层编译(is_global_scope=false,顶层 this undefined 由 VM 按标志绑定)
- emit_module_into_ctx:预声明/闭包分析识别 export 包裹声明与 import 绑定
- 依赖收集:import/re-export/star 的 source 去重、循环检测、json/text 数据模块
- 导入绑定初始化:__moduleLinkGet 链接期检查;self-import 别名语义(export 处回写)
- export 域:声明/重导出/export */export default 就地注册命名空间
- re-export 链接检查移至 prelude(先于 body 求值)
- emit_module_call 参数打包连续寄存器(CALL_NATIVE 契约)
- CompileCtx 增 module_ns_reg/module_dep_ns_regs/self-import 映射
- 拆分 declaration helper(export 声明复用);function/class 表达式 emitter 提升可见性
2026-08-12 17:37:33 +08:00
pjh123 0c22a0e968 fix: class 类名绑定经 dedicated cell 捕获(C===Cv 恒等)+ upvalue 写入 const guard(getter 赋值抛 TypeError) 2026-08-12 17:30:28 +08:00
pjh123 621956114c fix: class 类名绑定 TDZ 与 const 语义(extends 引用类名抛 ReferenceError,类构建后初始化绑定) 2026-08-12 15:37:58 +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 e87515a27f fix: Array 方法 array-like receiver/Get 异常传播、species 构造、slice/toSpliced/toSorted 规范化,数组字面量空洞语义 2026-08-12 12:51:28 +08:00
pjh123 1824ef0df1 feat: num-bigint 接入任意精度 BigInt(字面量、算术、toString、asIntN/asUintN) 2026-08-12 03:15:18 +08:00
pjh123 fbb3500129 feat: PlainDateTime toString 选项与 ISO 区间解析 2026-08-11 23:07:41 +08:00
pjh123 1d45a34973 fix: 闭包捕获解构函数参数 2026-08-11 16:57:13 +08:00
pjh123 33dae0a8c2 fix: 闭包捕获对象键与循环变量绑定 2026-08-11 14:17:45 +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 973778f181 fix: 块级 let/const/class 预声明 + TDZ 读取运行时抛 ReferenceError 2026-08-10 21:07:39 +08:00
pjh123 8a53bfb584 feat: 编译管线/类型层 crate 补全多级日志宏 + 关键路径日志 2026-08-10 17:56:28 +08:00
pjh123 020989a348 refactor: 清理 dead abstraction(oxide_api 空壳/空钩子/PersistentHeap/空目录) 2026-08-10 11:54:44 +08:00
pjh123 9f6f694be9 fix: 私有字段 brand 检查 own 槽(字段不跨原型,规避 cell 值缺陷) 2026-08-10 11:23:52 +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 5ced83e8c0 feat: async-generator 语义(async function*),yield/await 共存 + next 返回 Promise
- emit 识别 generator+async 组合,模块同时标记 is_generator/is_async
- 新增 AsyncGeneratorState:帧快照 + 请求队列 + 当前请求
- next/return/throw 返回 Promise,请求入队逐条处理
- YIELD 让出经 promise unwrap 后交付(yield rejected promise 关闭生成器)
- AWAIT 挂起保留当前请求,微任务恢复后继续执行
- %AsyncGeneratorPrototype% / %AsyncGeneratorFunction.prototype% 内建
- session GC / promote 支持异步生成器状态盒
- 普通 async 函数嵌套调用隔离外层异步生成器上下文
2026-08-10 01:52:03 +08:00
pjh123 85c192a747 feat: rest 参数(function f(...args)),实参区收集数组 2026-08-10 00:33:25 +08:00
pjh123 5a9a46483d feat: Promise 静态方法(all/race/allSettled/any + AggregateError)+ async test262 解锁
- Promise.all/race/allSettled/any:共享聚合核心,逐元素 C.resolve + Invoke(then),
  共享记录对象承载剩余计数/结果数组/能力闭包,元素处理器按模式结算
- AggregateError 内建(构造器 + prototype,Promise.any 拒绝路径依赖)
- 修复 capability_executor:能力已持有非 undefined 值时二次调用抛 TypeError
- test262 runner:移除 async flag 无条件 skip;解锁 asyncHelpers/promiseHelper/
  doneprintHandle harness;注入 print 捕获 + ,run() 后按 marker 判定
- 排除 await-dictionary(Promise.allKeyed/allSettledKeyed 2025 proposal)特性
- iterator 遍历辅助改 pub 供 oxide_vm 复用
2026-08-09 23:25:36 +08:00
pjh123 fd47cd56d0 feat: async/await 语法支持(AWAIT 帧快照挂起/恢复 + 微任务驱动 + AsyncFunction intrinsics) 2026-08-09 22:02:15 +08:00