[codex] Align function prototype value reads#4272
Draft
andrewtdiz wants to merge 1 commit into
Draft
Conversation
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
Addresses #2768 and #3877.
This aligns direct ordinary function
.prototypevalue reads for local function values so codegen routesFuncRef/closureprototypereads through the runtime materialization path. That givesObject.create(Foo.prototype)andReflect.construct(..., newTarget)an object value instead of the previous non-object result, while preserving dynamic/deletedprototypeproperties and generator function prototype handling.The PR also adds a focused object parity fixture for ordinary function prototype values, assigned prototype objects,
Object.create(Foo.prototype), and arrow-function absence.Why Batched
Both issues hit the same runtime/codegen invariant: construct/proxy/object creation flows depend on
newTarget.prototypeorFoo.prototypebeing an object when an ordinary function exposes its default prototype. Keeping them together avoids splitting one semantic fix across duplicate reflect/proxy symptoms.Validation
PERRY_NO_AUTO_OPTIMIZE=1 npm exec --yes --package=node@26 -- bash -lc 'node --version; ./run_parity_tests.sh --suite node-suite --module object --filter function-prototype-value'PERRY_NO_AUTO_OPTIMIZE=1 npm exec --yes --package=node@26 -- bash -lc 'node --version; ./run_parity_tests.sh --suite node-suite --module object --filter reflect-proxy-construct'test-parity/node-suite/object/function-prototype-value.tstest-parity/node-suite/object/reflect-proxy-construct.tscargo fmt --all -- --checkgit diff --check./scripts/check_file_size.shcargo build --release --quiet -p perry -p perry-runtime -p perry-stdlibpassed on the code-bearing diff before the final comment-only cleanup. A later retry after that cleanup was interrupted by SIGTERM while another release job was running in a separate worktree.Known Limitations
This intentionally keeps the cut narrow. Imported function
.prototypevalue reads and broader inherited-property behavior through objects created fromFoo.prototypeare left as follow-up work; this PR fixes the localFuncRef/closure value-read tail that blocks the focused reflect/proxy construct parity fixture.