fix(runtime): obj.toLocaleString runtime dispatch + async-gen 0-arg return/throw arity - #4546
Merged
Merged
Conversation
…eturn/throw arity value.toLocaleString() on a non-number receiver was mis-routed by the Expr::DateToLocaleString codegen arm to js_date_to_locale_string, printing a 1970-epoch "Invalid Date" for plain objects/strings/booleans. Add a js_value_to_locale_string runtime helper that dispatches on the value tag (number grouping, Date string, object custom/[object Object]) and route the unknown-static-type arm to it. Async-generator next/return/throw queue wrappers each take one arg but had no registered arity, so 0-arg gen.return()/gen.throw() read an uninitialized stack slot instead of undefined. Register arity 1 for the three wrapper func pointers.
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.
Two test262/parity fixes
1.
value.toLocaleString()on non-number receivers (#4546)The
Expr::DateToLocaleStringcodegen arm routed every non-number receiver tojs_date_to_locale_string, so a plain object / string / boolean printed a 1970-epoch "Invalid Date" instead of[object Object](or a customtoLocaleString).Fix: new
js_value_to_locale_stringruntime helper that dispatches on the value tag (number → grouping, Date → date string, object → custom/[object Object]). The unknown-static-type arm now calls it; Number/Int32 keep their fast path; dates flow through the runtime tag check.2. async-generator 0-arg
.return()/.throw()(#4547)The queue wrappers (
next/return/throw) each take oneargbut had no registered arity, so a 0-arggen.return()/gen.throw()read an uninitialized stack slot instead ofundefined. Register arity 1 for the three wrapper func pointers.All cases above verified byte-identical against
node --experimental-strip-types.