Problem / 问题
Arithmetic and comparison bytecode send already-primitive operands through VmHost into Runtime::to_primitive, although ToPrimitive returns these values unchanged. Repeated numeric loops pay this boundary cost before using existing numeric implementations.
数值与比较指令把已经是原始值的操作数送入 VmHost/Runtime 转换路径,随后原样返回。需要把原始值直通集中在 VM 转换入口,避免逐指令复制快速运算逻辑。
Proposed change / 修改方案
Add one VM-local ToPrimitive entry point: forward Object values and the original hint to the existing host; return all primitive values unchanged. Route numeric preparation and unary/add/comparison instructions through it. Preserve conversion order, exception propagation, Int/Float tags, BigInt rules, arithmetic implementations and runtime object conversion.
新增共享 VM ToPrimitive 入口:原始值直接返回,对象及 hint 交给原有 host;数值准备、一元、加法和比较复用它。保留转换顺序、异常、数值标签和现有计算规则。
Stack on personal-fork PR #2: Eric-Song-Nop#2 (perf/static-property-atoms, eb48e71). The implementation PR will target that branch in Eric-Song-Nop/quickjs-oxide.
基于上述个人 fork PR 分支实现并提交 stacked PR。该 fork 未启用 Issues,因此问题继续记录在此仓库。
Validation / 验证
Test primitive host bypass and representation preservation; object hint/order/exception behavior; existing numeric boundaries. Run Rust workspace tests, full Test262 outcome comparison and required checks remotely through Herdr/PocketLab. Measure identical before/after release builds on fixed loops, property reads and Richards with alternating repetitions; report observed gains or lack of gains without assuming that source-level call removal guarantees speedup.
远端执行测试、完整 Test262 对照与检查;相同 release 配置交替测量,报告实际收益及局限。
Problem / 问题
Arithmetic and comparison bytecode send already-primitive operands through VmHost into Runtime::to_primitive, although ToPrimitive returns these values unchanged. Repeated numeric loops pay this boundary cost before using existing numeric implementations.
数值与比较指令把已经是原始值的操作数送入 VmHost/Runtime 转换路径,随后原样返回。需要把原始值直通集中在 VM 转换入口,避免逐指令复制快速运算逻辑。
Proposed change / 修改方案
Add one VM-local ToPrimitive entry point: forward Object values and the original hint to the existing host; return all primitive values unchanged. Route numeric preparation and unary/add/comparison instructions through it. Preserve conversion order, exception propagation, Int/Float tags, BigInt rules, arithmetic implementations and runtime object conversion.
新增共享 VM ToPrimitive 入口:原始值直接返回,对象及 hint 交给原有 host;数值准备、一元、加法和比较复用它。保留转换顺序、异常、数值标签和现有计算规则。
Stack on personal-fork PR #2: Eric-Song-Nop#2 (
perf/static-property-atoms, eb48e71). The implementation PR will target that branch in Eric-Song-Nop/quickjs-oxide.基于上述个人 fork PR 分支实现并提交 stacked PR。该 fork 未启用 Issues,因此问题继续记录在此仓库。
Validation / 验证
Test primitive host bypass and representation preservation; object hint/order/exception behavior; existing numeric boundaries. Run Rust workspace tests, full Test262 outcome comparison and required checks remotely through Herdr/PocketLab. Measure identical before/after release builds on fixed loops, property reads and Richards with alternating repetitions; report observed gains or lack of gains without assuming that source-level call removal guarantees speedup.
远端执行测试、完整 Test262 对照与检查;相同 release 配置交替测量,报告实际收益及局限。