Repository navigation
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will not alter performance
Comparing Footnotes
|
5980384 to
e323ae4
Compare
8d1a725 to
b72091b
Compare
e323ae4 to
ff48d91
Compare
b72091b to
29749b4
Compare
ff48d91 to
ca1b278
Compare
29749b4 to
bd447e8
Compare
ca1b278 to
a78c670
Compare
14a8889 to
a595fb2
Compare
80ff5db to
9bf4b35
Compare
33634e7 to
c0a3e5d
Compare
58f5cb9 to
4473584
Compare
c0a3e5d to
27e8c7e
Compare
A decoded property name can be static without being valid Rust UTF-8. Return JSStr from member-name helpers so comparisons retain the actual UTF-16 value and consumers no longer mistake these names for dynamic expressions. Keep explicit UTF-8 conversions at fixed-name lookups and existing UTF-8-only APIs. Cover AST helpers, self-assignment and console diagnostics, React display names, and declaration enum references with regressions. Object/class key APIs and module-record storage remain separate work. Part of #26242. Implemented with AI assistance.
Static property names containing lone surrogates were treated as dynamic because the helpers required Rust UTF-8. This skipped duplicate-key, accessor-pair, and class-overload checks. Borrow AST names as JSStr and own numeric display text in CompactStr, preserving property identity and the existing numeric spelling. Use one natural comparison for ordinary and surrogate keys and retain numeric render-prop exemptions. Escape lone surrogates in diagnostic names. BREAKING CHANGE: PropertyKey::static_name, PropertyKey::name, ClassElement::static_name, and semantic class element names now use StaticPropertyName instead of Cow<str>. Based on #26677. Part of #26242. Continues #26720. Implemented with AI assistance.
ee09742 to
e7fc537
Compare
05b64b5 to
a2be12f
Compare
e7fc537 to
d96e2af
Compare
a2be12f to
1b27b18
Compare
d96e2af to
d39a063
Compare
0536f83 to
708ef15
Compare
595668a to
d763931
Compare
708ef15 to
9fb6e70
Compare
A lone surrogate anywhere in a string value made UTF-8 conversions skip searches for otherwise valid text. Add contains, starts_with, ends_with, find, and rfind to JSStr through a sealed pattern trait. Search canonical WTF-8 without allocating. ASCII character searches use memchr, text find uses memmem, and leading predicates inspect one code point. Preserve the existing reverse-search paths. Predicates skip lone surrogates, and find offsets count WTF-8 bytes, as documented. Use the helpers in seven linter rules and JSX attribute layout checks. Render diagnostic values with JSStr::display and share the existing ASCII case-insensitive prefix comparison. Guard lowercase-title fixes against differences between source spelling and decoded values. Replace a first letter only when it is literal ASCII, and rewrite a whole title only when the decoded value equals the source. Escaped or surrogate-containing titles still report when no safe fix is available. Cover search semantics against str and a UTF-16 model, and test escaped letters, line continuations, both title options, and Jest/Vitest callers. Part of #26242. Implemented with AI assistance.
d763931 to
cf9622d
Compare
9fb6e70 to
476b6b4
Compare
cf9622d to
e071622
Compare
476b6b4 to
5695623
Compare
Index string literals by UTF-16 code unit and construct the result with JSStrBuilder. This folds either half of a supplementary character and lone surrogates without allocating a temporary heap string. Retain the native UTF-8 decoder for ordinary strings. Clear the computed flag once before normalizing string property keys. Existing guards for __proto__, constructor, and prototype remain in place. Part of #26242. Implemented with AI assistance.
5695623 to
3e34649
Compare
e071622 to
8326520
Compare
…s with lone surrogates Support JSStr receivers for indexOf, lastIndexOf, and charCodeAt. Use bounded byte searches for UTF-8 needles and translate match offsets to UTF-16 indices, avoiding repeated needle decoding and allocations. Keep the existing ordinary UTF-8 behavior unchanged. Cover mixed-width offsets, overlapping matches, surrogate-pair bounds, and matches extending beyond the lastIndexOf start bound.
3e34649 to
0b71e51
Compare
8326520 to
3bb462c
Compare
|
Closing in favour of #27098. The stack rework squashes this PR into #27098: its Generated by Claude Code |
String constant evaluation used `Cow<str>`, so folds stopped at any string with a lone surrogate. `ConstantValue::String` now holds a `JSStr`, so these strings fold too, and results are built with `JSStrBuilder`, which joins surrogate halves the way the runtime does.
`indexOf`, `lastIndexOf`, `substring` and `slice` now share one UTF-16 code-unit implementation for every string. This also fixes miscompiles on main: `'éx'.indexOf('x')` folded to 2, `'abc'.indexOf('a', 4294967296)` to 0, `'abab'.lastIndexOf('b', NaN)` to -1, and `'abc'.substring(1, void 0)` to `''`. It includes #27097, which is closed.
String `concat` calls and chains fold into a template only when no argument with side effects follows one that may be an object, so `''.concat(a, (a.push(1), 'x'))` no longer becomes `` `${a}${(a.push(1), 'x')}` ``.
## Breaking changes
- `ConstantValue::String` holds `JSStr<'a>`, and `ConstantValue::into_string`, `evaluate_value_to_string` and `get_side_free_string_value` return `JSStr<'a>`.
- `StringIndexOf` and `StringLastIndexOf` take the search value as `JSStr` and use UTF-16 code unit positions.
- `StringSubstring` is removed.
Closes #15524. Closes #25158. Closes #26053. Based on #27096. Part of #26242. Continues #26759.
Implemented with AI assistance.

Fold
indexOf,lastIndexOf, andcharCodeAtfor literal receivers containing lone surrogates. Ordinary UTF-8 receivers keep their existing implementation. Search values containing lone surrogates remain for #27098, which changes string constants toJSStr.Nonempty UTF-8 needles use bounded
memmemsearches over WTF-8 bytes, with bounds and results translated to UTF-16 code unit indices. This avoids repeated needle decoding without allocating. Empty searches retain their code unit clamping. Tests cover mixed byte widths, overlapping matches, bounds inside surrogate pairs, andlastIndexOfmatches extending beyond the start bound.On the repetitive 32,000-unit receiver and 16,001-unit nonmatching needle, optimized end-to-end minification decreased from about 880 ms to 2.8 ms. All 10,032 differential cases preserve the previous implementation's runtime results, including the existing UTF-8 behavior; the 5,520 surrogate-receiver cases match Node. Rust tests and lint pass, minify-twice is identical, and minifier conformance and size/allocation snapshots are unchanged.
Based on #27096. Part of #26242. Continues #26758, which GitHub marked indirectly merged during stack reordering.
Implemented with AI assistance.