pjh123
457b1b874d
fix: new 表达式 native 构造收口 call_function_sync 防 255/254 槽污染
2026-08-16 13:41:01 +08:00
pjh123
1da9c98e62
fix: for-in/for-of 头名仅 var 提升入入口初始化名单,排除 let/const
2026-08-16 13:32:25 +08:00
pjh123
8f7d0f1186
fix: 类表达式真实名 cell 按声明路径门控,不再覆盖外层同名绑定
2026-08-16 13:32:25 +08:00
pjh123
5df04a8e58
chore: 全仓 rustfmt 格式化归拢
2026-08-16 12:50:36 +08:00
pjh123
4572ecffaa
feat: new.target MetaProperty emit 支持(LOAD_VAR NewTarget)
2026-08-16 12:43:50 +08:00
pjh123
2755894330
test: upvalue cell 时序判别用例(class 捕获/var 入口初始化/参数默认值链式捕获)
2026-08-16 12:34:14 +08:00
pjh123
23a5f35ae1
fix: 闭包链式捕获越界改编译错误早暴露防静默错值
2026-08-16 12:34:14 +08:00
pjh123
4911c058d8
fix: var 捕获绑定函数与程序入口统一初始化为 undefined 消除 TDZ 误报
2026-08-16 12:34:10 +08:00
pjh123
331691e8bd
fix: class 声明名纳入闭包捕获,嵌套函数经 cell 读取类绑定
2026-08-16 12:34:03 +08:00
pjh123
43c7ca1fd6
feat: 私有字段复合赋值 emit 支持(GET_PRIVATE→op→SET_PRIVATE 序列)
2026-08-16 12:12:26 +08:00
pjh123
82c088ac9f
fix: for-await-of 同步迭代器 return() 忽略路径补异常值槽配对
2026-08-16 12:00:59 +08:00
pjh123
75f28f6e3e
fix: class 生成器方法补 is_generator 标志,修正方法形态生成器语义
2026-08-16 11:44:20 +08:00
pjh123
16793d3b36
fix: 异常值通道配对——忽略调用槽配对、unwind 接住清槽、生成器参数初始化不覆盖异常值
2026-08-16 11:29:50 +08:00
pjh123
afa79aa5fb
fix: Date 多参构造年 0-99 按规范映射到 1900-1999
2026-08-16 10:58:50 +08:00
pjh123
e97473c8ad
fix: Date 普通调用忽略参数并移除 RFC2822 panic
2026-08-16 10:58:12 +08:00
pjh123
d237b4b70e
fix: clear_ic_caches ext 计数补登 BREAK/CONTINUE/RETURN
2026-08-16 10:43:03 +08:00
pjh123
8ac26fc01f
fix: IC 快速路径 symbol 原始值走 Symbol.prototype 链
2026-08-16 10:31:34 +08:00
pjh123
a8378694be
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
b885b672b9
for-of 迭代器栈条目化:迭代器与最近 next 结果配对存放
...
单一 last_for_of_result 槽被嵌套迭代覆盖,CLOSE 判定本迭代器是否
自然 done 时误读他者结果,导致数组解构/spread/嵌套 for-of 提前退出
漏调或误调 return()。改为栈条目 (iterator, last_result) 配对:
- IterState.for_of_iters 元素改 ForOfEntry,删除 last_for_of_result
- INIT 压条目,DONE 写本条目,NEXT/CLOSE 读本条目结果判 done
- GC mark/rewrite、inline save/restore、挂起帧快照同步配对遍历
- for-await-of 数组解构提前 break 现正确触发 return()(任务 40 样例)
2026-08-16 04:00:06 +08:00
pjh123
19fcdd73d0
fix: Date 构造器缺省字段与溢出滚动语义符合规范
...
多参缺省字段固定为日=1、时分秒毫秒=0(不再取当前时刻);
月/日/时等分量越界按 MakeDay/MakeTime 滚动进位,负月同样归一;
单参字符串与 Date.parse 支持时区偏移(Z/+hh:mm/+hhmm)折算 UTC,
修复此前 NaiveDateTime 解析静默丢弃偏移的问题。
2026-08-16 03:43:42 +08:00
pjh123
1a2d8682ae
fix: builtins 对象分配统一走 alloc_object 登记消除高频路径泄漏
2026-08-16 03:36:02 +08:00
pjh123
63ccb0fcf3
regalloc: 建图只遍历活集 + rewrite use 点按指令分组
...
graph 建边由逐指令全 node 扫描(O(insts × nodes),活集小也扫全表)
改为只遍历该指令活集中置位的 vreg(u64 位集 trailing_zeros 升序,
与 node 表升序遍历逐字节同序,确定性不漂移)。rewrite 主循环对每
指令全扫全局 uses 表(O(insts × spills) 二次方)改为按指令分组的
use 点列表,只取本指令的 use 点。
实测(debug,test262 identifiers 最大样本):plain 17.0.0
16.9s → 1.06s(-94%),class 9.0.0 7.0s → 1.61s(-77%),
均低于 2s 达标线;identifiers 子集 268/268 全 PASS(原 32 个
10s 超时全部转 PASS)。
2026-08-16 03:26:57 +08:00
pjh123
9bbe5ae67a
liveness: live 集改 u64 位集 + 不动点缓冲复用
...
LiveInfo 四矩阵由逐位 Vec<bool>(1 字节/位,长度 = max_vreg+1)改为
u64 压缩位集(1 字 64 位,长度 ÷8),dataflow 不动点 out/input 缓冲
提为循环外复用(clear + 覆盖,免逐迭代逐块分配)。dce_precise /
graph 建图 / call_window 三处消费方同步改为字内位移查询,越界语义
与旧 Vec<bool>::get 一致(越界 = 不 live)。位集遍历(call_window
存活上界)按 trailing_zeros 只走实际置位,活集小则近 O(活集) 而非
O(254)。
实测(debug,start-unicode-17.0.0.js):liveness 三趟合计
~536ms → ~118ms(-78%),矩阵内存 ÷8;graph 全 node 扫描为剩余
瓶颈,另行跟进。
2026-08-16 03:20:02 +08:00
pjh123
f899538535
regalloc: LiveInfo 维度守卫改 Cow 借用,合法路径免全量复制
...
alloc 与 encode_call_window 在 LiveInfo 维度匹配(正常路径)时仍全量
clone 稠密 bitset 矩阵,随后只读消费。改为 Cow::Borrowed 借用原分析
结果,维度不符才 Cow::Owned 重建。零语义变化,消除每次 alloc/编码
的无谓内存复制。
2026-08-16 03:03:55 +08:00
pjh123
0737ce3ef1
test262: supervise 模式回传失败类别,汇总可按根因拆分
...
子进程心跳扩展失败分类计数(类别\t计数逐行写出),supervise_window
聚合为 RunStats 而非裸三计数,父进程汇总打印 FAIL categories(与
in-process 共用 print_fail_categories)。此前子进程 stdout 被丢弃、
heartbeat 只带 pass/fail/skip,categorize_fail 在 supervise 下完全
不可用,10k+ fail 无法按 VM/parse/compile 根因拆分;现在类别基线
可数据化。超时/崩溃归入 timeout/crash 类别。
2026-08-16 02:50:29 +08:00
pjh123
2b86cd241d
test262: $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
1a03213390
test262: skip 判定收窄——receiver 校验等已实现语义错误转真实失败
...
judge_vm_error 抽出纯函数 classify_vm_error 并补充表驱动单测;
将 call stack size exceeded / not callable / ToPrimitive 缺口 / receiver
校验(called on non-Set 等)12 条错误子串移出 skip 列表:这些是引擎
行为与测试期望不符的真实失败,此前被误计为 skip,fail 数被系统性低估。
保留的 skip 仅限真正的能力未实现形态(not yet implemented / not
supported / NEW_EXPRESSION 等)。
2026-08-16 02:46:17 +08:00
pjh123
06441e09ff
fix: 全局构造器与内置对象属性改非枚举与规范对齐
2026-08-16 02:29:42 +08:00
pjh123
355b0233f0
fix: NEW_OBJECT 走统一分配入口登记 epoch 对象消除属性向量泄漏
2026-08-16 02:16:34 +08:00
pjh123
5de959e2bd
fix: String 方法 Symbol 参数抛 TypeError 且缺参按 undefined 查找
...
as_string 由兜底转换改 Result 化:Symbol 与其余转换失败抛
TypeError,对象 ToString 抛出的原生异常经 take_uncaught_value
原样传播,不再静默降级为空串/占位文本。17 处调用点统一经
try_string! 抛错。
indexOf/includes/startsWith/endsWith/lastIndexOf 删除缺参短路:
searchString 缺省按 ToString(undefined)="undefined" 参与查找,
'undefined'.indexOf() 现得 0。
类正则对象(Object.create(RegExp.prototype))默认 toString 抛
TypeError 的 replace/split 用例随异常传播行为更新断言。
2026-08-16 02:08:13 +08:00
pjh123
0c6aa7fbef
fix: 构造帧 super 状态改显式标志修复多层继承与 return 语义
...
derived 构造器 super 状态改由 CallFrame.super_called 显式标志承载,
取代依赖 regs[254] 值判定:多层继承中间 derived 帧由 SUPER_CALL 压入
this=构造对象,值判定三重失效(未调 super 不报错 / this-before-super
失效 / 合法 super() 误判 more-than-once)。父构造器正常返回经
construct_result_reg==Some(254) 识别置位调用方帧(该 ABI 不变量仅
SUPER_CALL 压帧满足),抛错走 unwind 不置位。
do_return 检查放宽为非对象返回值(含 undefined/null/原始值)且未调
super 时抛 ReferenceError(规范 §9.2.2.2),调过 super 回退构造 this。
super 构造器改取当前帧 callee 原型而非 newTarget 原型:newTarget 跨
SUPER_CALL 压帧保持为最外层类,取其原型在中间 derived 层解析回同一
父类导致无限压帧。
2026-08-16 01:23:52 +08:00
pjh123
946c96472f
fix: object 家族 dirty 时重建迭代器绑定并对齐 Iterator.prototype,绑定幂等化避免重复槽
2026-08-16 00:25:30 +08:00
pjh123
d309379551
fix: 未声明标识符读取抛 ReferenceError(typeof 特判返回 undefined)
2026-08-16 00:10:08 +08:00
pjh123
e448c642a5
fix: 迭代器原型形状补全(Iterator.prototype/string 中继层/next 原型化)
2026-08-15 23:36:01 +08:00
pjh123
3358cf712e
fix: 非常量键成员 **= 复合赋值 rhs 生效
2026-08-15 23:20:36 +08:00
pjh123
2a447b17fe
fix: 块内函数声明预声明支持(Annex B 块级绑定)
2026-08-15 23:13:26 +08:00
pjh123
ec32e42ce5
feat: 迭代器原型基建:%IteratorPrototype% 链 + 各集合迭代器原型
...
新增 %IteratorPrototype%(含 @@iterator 返回自身,经原型链被全部迭代器
继承,it[Symbol.iterator]() === it 恒等)与 %ArrayIteratorPrototype%/
%MapIteratorPrototype%/%SetIteratorPrototype%/%StringIteratorPrototype%/
%RegExpStringIteratorPrototype%(链到 %IteratorPrototype%);Array/Map/Set/
TA/String/matchAll 迭代器包装统一挂对应原型;补 Array/String 的 @@iterator
别名绑定。集合迭代器原型不含 return 方法(规范集合迭代器无 return)。
2026-08-15 22:57:03 +08:00
pjh123
c230edeb57
feat: Function.prototype[Symbol.hasInstance] 绑定与 bound 函数构造语义
...
@@hasInstance 按 OrdinaryHasInstance 实现(非可调用 this 返回 false、
prototype 非对象抛 TypeError、bound 链递归到最内层 target);
new boundFn() 解包 [[BoundTargetFunction]] 链后转发构造:绑定实参前置、
新对象原型取 target.prototype、new.target 替换为最内层 target。
2026-08-15 22:40:45 +08:00
pjh123
d83d598221
fix: parseInt/parseFloat 对象参数按 ToString 完整转换并传播异常
...
对象参数走 ToPrimitive(string hint) 后取串解析(toString 结果可见),
Symbol 抛 TypeError,对象方法抛出的原始异常原样传播。
2026-08-15 22:32:14 +08:00
pjh123
9390ed6be4
fix: for-const 循环 update 段豁免 const 写检查(per-iteration 绑定合法)
2026-08-15 22:29:09 +08:00
pjh123
3e34607380
fix: Promise.prototype.then 按构造器建派生能力支持子类
2026-08-15 22:16:05 +08:00
pjh123
07ea7e6d4f
fix: TDZ 写与 const 赋值检查补全(含闭包捕获路径)
2026-08-15 21:55:43 +08:00
pjh123
2669967967
fix: parseInt/parseFloat 前缀解析与 radix 语义符合规范
2026-08-15 21:40:27 +08:00
pjh123
07d6c83c6b
fix: 错误对象属性枚举性、toString 标签与构造器调用语义
...
- message/name 属性改非枚举(CreateNonEnumerableDataPropertyOrThrow),
Object.keys/for-in/JSON.stringify 不再泄漏错误信息
- 新增 Error 家族对象标签,Object.prototype.toString 输出 [object Error],
含子类型与用户子类(沿原型链判定)
- Error 家族构造器补 length=1,函数调用忽略 this 一律新建对象
- JSON.stringify 序列化仅含可枚举自身属性(规范 EnumerableOwnPropertyNames)
2026-08-15 21:30:28 +08:00
pjh123
c4961fae29
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
b706b8c506
feat: Object keys 系列合并数组元素区,assign 按规范过滤枚举/触发 getter
...
walk_own_keys 返回值语义改为绝对存储索引:数组对象先枚举元素区
(跳过 hole),命名属性偏移到元素区之后;shape 槽位计数含 symbol 键
与物理存储对齐(修 symbol 键错位读值)。delete_own_property /
REST / SPREAD 四连锁点同步去偏移,REST/SPREAD 删除独立元素区循环
(由 walk_own_keys 统一覆盖,防重复键)。
Object.assign 增补:源只取可枚举自身属性;取值改 ordinary_get
(accessor 触发 getter,receiver=源);提交写 receiver 修正为 target
(目标同名 setter 的 this 指向 target)。
2026-08-15 21:04:24 +08:00
pjh123
970c2e988e
feat: freeze/seal/preventExtensions 写路径拦截(逐属性 meta + extensible 检查)
...
freeze/seal 逐属性改写 meta(数据属性 writable/configurable=false,
访问器 configurable=false,含数组元素区),使 has_prop_meta() 恒 true,
IC 直写路径自动失效;ordinary_set/create_named_prop_fast/
set_or_create_prop_value/define_* 增补 extensible/frozen 检查,
SET_ELEM 直写入口回落 ordinary_set 或拒绝新元素。
引擎未实现 strict 标志,赋值失败统一 raise_type_error(sloppy 静默留待后续)。
2026-08-15 20:55:20 +08:00
pjh123
f4e790978d
fix: matchAll 空匹配推进至少一个字符,RegExp 补 GC 搬移深拷贝
...
matchAll 迭代器在空匹配(range.start == range.end)后把游标停在原位置,
同一位置反复空匹配导致死循环;改为按 UTF-8 字符边界推进(与 regress
find_iter 的 next_right_pos 一致),串尾空匹配把游标推到串长之后保证下轮
耗尽。
另修 RegExp 在 GC sweep 与 epoch 晋升中的指针别名:克隆只复制 native_fn 槽
的 Box 指针,源对象释放后克隆持悬垂指针,teardown 双重释放(heap 损坏)。
新增 clone_regexp_native 深拷贝已编译正则,sweep/promote 两处挂接,与
drop 配对保证单次释放。
2026-08-15 20:31:51 +08:00
pjh123
1c70d0343d
fix: Function.prototype.apply 解除实参上限,native 大实参集走 spill 溢出区
...
apply 曾把实参数组静默截断到 55 个(寄存器窗口限制),导致
String.fromCodePoint.apply(null, codePoints) 这类大参数集调用只取前 55 个。
改为直接物化全部实参经 TailCall 下发:字节码目标走帧参数区(spill 栈)任意
个数;native 目标新增 spill 溢出区通道,寄存器窗口(253)之外的实参转存
spill 栈(GC 根、嵌套安全),builtin 经 VmHost::native_arg_count/native_arg_at
读取,String.fromCodePoint 迁移为新接口。大实参集不再静默截断。
2026-08-15 20:31:32 +08:00
pjh123
1b9974fe7f
fix: BigInt64Array/BigUint64Array 与 DataView BigInt 存取走真 BigInt 语义
...
TA 元素读写按 kind 分流:BigInt 类型走 ToBigInt(Number 入参抛 TypeError、
写入 mod 2^64 截断、读出为真 BigInt 值),数值类型走 ToNumber 且显式拒绝
BigInt 值;消除 64 位整数经 f64 中转的静默精度丢失。
- runtime_api 新增公共 to_bigint_full / string_to_bigint_full,bigint 构造器
与 asIntN/asUintN 改调公共版消除双实现
- sort/toSorted 默认序对 BigInt 类型按 i64/u64 值比较;reverse/copyWithin/
filter/toReversed/with 消除无谓数值中转
- 构造器第一参数非对象统一走 ToIndex(bool/null/BigInt/字符串),Symbol 抛
TypeError
- DataView get/setBigInt64/getBigUint64 返回 BigInt 值、入参按 ToBigInt 校验
- 测试:精度往返 / TypeError / mod 2^64 / 字节序 / 排序 / 回调值类型断言
2026-08-15 20:04:48 +08:00