Summary
Perry's Reflect.getPrototypeOf helper returns the input object itself. Node returns the object's actual prototype, including null for null-prototype objects and the target/proxy prototype chain for ordinary objects.
Node behavior
On Node v25.9.0:
Reflect.getPrototypeOf({}) === Object.prototype; // true
const proto = { p: 1 };
const made = Object.create(proto);
Reflect.getPrototypeOf(made) === proto; // true
class Base {}
class Child extends Base {}
Reflect.getPrototypeOf(Child.prototype) === Base.prototype; // true
Reflect.getPrototypeOf(Object.create(null)); // null
Perry evidence
Current origin/main routes Reflect.getPrototypeOf(...) through a separate Reflect helper:
crates/perry-hir/src/lower/expr_call/native_module.rs lowers Reflect getPrototypeOf calls to Expr::ReflectGetPrototypeOf(...).
crates/perry-codegen/src/expr/proxy_reflect.rs lowers that HIR node to js_reflect_get_prototype_of(...).
crates/perry-runtime/src/proxy.rs::js_reflect_get_prototype_of() is implemented as return obj, and the comment says it returns the object itself.
That means generic Reflect.getPrototypeOf(obj) sites can observe obj instead of the prototype, even though Object.getPrototypeOf has separate prototype-chain logic elsewhere.
Expected fix
Reflect.getPrototypeOf(target) should share the same actual prototype lookup semantics as Object.getPrototypeOf(target) and return null for null-prototype objects. It should not return the target object itself.
Scope note: this is distinct from prior Object.getPrototypeOf fixes such as PR #2050, #2196, and #2244. This issue is specifically the remaining Reflect.getPrototypeOf helper path.
Summary
Perry's
Reflect.getPrototypeOfhelper returns the input object itself. Node returns the object's actual prototype, includingnullfor null-prototype objects and the target/proxy prototype chain for ordinary objects.Node behavior
On Node v25.9.0:
Perry evidence
Current
origin/mainroutesReflect.getPrototypeOf(...)through a separate Reflect helper:crates/perry-hir/src/lower/expr_call/native_module.rslowers ReflectgetPrototypeOfcalls toExpr::ReflectGetPrototypeOf(...).crates/perry-codegen/src/expr/proxy_reflect.rslowers that HIR node tojs_reflect_get_prototype_of(...).crates/perry-runtime/src/proxy.rs::js_reflect_get_prototype_of()is implemented asreturn obj, and the comment says it returns the object itself.That means generic
Reflect.getPrototypeOf(obj)sites can observeobjinstead of the prototype, even thoughObject.getPrototypeOfhas separate prototype-chain logic elsewhere.Expected fix
Reflect.getPrototypeOf(target)should share the same actual prototype lookup semantics asObject.getPrototypeOf(target)and returnnullfor null-prototype objects. It should not return the target object itself.Scope note: this is distinct from prior
Object.getPrototypeOffixes such as PR #2050, #2196, and #2244. This issue is specifically the remainingReflect.getPrototypeOfhelper path.