[codex] fix uncurried hasOwnProperty on builtin prototypes#4279
Merged
proggeramlug merged 1 commit intoJun 3, 2026
Merged
Conversation
This was referenced Jun 3, 2026
proggeramlug
added a commit
that referenced
this pull request
Jun 3, 2026
) #4276 was fixed by #4279 (proto thunks call their ops directly, no re-dispatch). This adds a wider regression fixture for the uncurry-this idiom Function.prototype.call.bind(Object.prototype.<method>) on builtin prototype receivers: also exercises TypeError/RangeError prototypes, isPrototypeOf, propertyIsEnumerable, typeof-of-result, and the direct .call form. Verified byte-identical to node --experimental-strip-types on main. Co-authored-by: Ralph Küpper <ralph@skelpo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Object.prototype.hasOwnPropertythunk calls directly throughjs_object_has_ownFunction.prototype.call.bind(Object.prototype.hasOwnProperty)on builtin prototype receiversFixes #4276.
Root Cause
The uncurried
Function.prototype.call.bind(Object.prototype.hasOwnProperty)path eventually invokes the installedObject.prototype.hasOwnPropertythunk withIMPLICIT_THISset to the requested receiver. That thunk re-enteredjs_native_call_method(this, "hasOwnProperty", ...). For receivers likeObject.prototypeandError.prototype, the method tower found the receiver ownhasOwnPropertyfield first and recursed until the depth guard returned an object.Calling
js_object_has_owndirectly matches the existing HIR rewrite forObject.prototype.hasOwnProperty.call(obj, key)and avoids the recursive method lookup.Why this cluster
This PR is limited to one receiver dispatch path:
Function.prototype.call.bind(method)forwarding the call receiver into anObject.prototypebuiltin thunk. Error descriptor shape work stays on the separate descriptor-focused branch.Validation
npm exec --yes --package=node@26 -- node --version(v26.3.0)PERRY_NO_AUTO_OPTIMIZE=1 npm exec --yes --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module globals --filter function-call-bind-builtin-prototypes'PERRY_NO_AUTO_OPTIMIZE=1 npm exec --yes --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module globals --filter builtin-constructor-own-name-length'PERRY_NO_AUTO_OPTIMIZE=1 npm exec --yes --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module globals --filter reflective-builtins'cargo check -p perry-runtimecargo fmt --all -- --checkgit diff --check./scripts/check_file_size.sh