Skip to content

refactor(estree): remove the single-implementation escape table - #26743

Open
Dunqing wants to merge 1 commit into
mainfrom
jsstr-estree-escape-table
Open

Dunqing wants to merge 1 commit into
mainfrom
jsstr-estree-escape-table

Conversation

@Dunqing

@Dunqing Dunqing commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

The string serializer kept an EscapeTable trait with a single StandardEscapeTable implementation, retained during the JSStr migration to keep that diff reviewable. With the migration stack in place the abstraction has no second implementation and no prospect of one, since the JSStr cold path handles the only divergent case.

Remove the trait and its implementation, move get_escapes_mask to a free function with its algorithm and mask contract unchanged, and replace the generic lookups with direct ESCAPE table indexing. No output changes; the UTF-8 fast path, the JSStr cold path, and the safety invariants are untouched.

Verified with the oxc_estree, oxc_str, and parser serialization tests; the diff is one file.

Part of #26242.

Implemented with AI assistance.

Dunqing commented Sep 17, 2026 •

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@codspeed

codspeed Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 87 untouched benchmarks
⏩ 9 skipped benchmarks1


Comparing jsstr-estree-escape-table (ce4cf3b) with main (cf8296f)

Open in CodSpeed

Footnotes

  1. 9 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch from f606d30 to cd1c341 Compare September 18, 2026 02:20
@Dunqing
Dunqing force-pushed the jsstr-static-name branch 2 times, most recently from 477a2fe to bc652f1 Compare September 18, 2026 15:15
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch from cd1c341 to bf8beac Compare September 18, 2026 15:15
@github-actions github-actions Bot added the A-ast Area - AST definitions and visitors, oxc_ast / oxc_ast_visit label Sep 18, 2026
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch from 9d96a3d to d95bac0 Compare September 21, 2026 01:14
@github-actions github-actions Bot added the A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details label Sep 21, 2026
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch 2 times, most recently from 5cfc1f0 to 23971d1 Compare September 21, 2026 01:54
@Dunqing
Dunqing force-pushed the jsstr-static-name branch 2 times, most recently from 3a95eb7 to ba0f5c9 Compare September 21, 2026 02:54
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch from 23971d1 to ba61d2c Compare September 21, 2026 02:54
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch from ba61d2c to 4638a94 Compare September 21, 2026 07:04
@Dunqing
Dunqing force-pushed the jsstr-static-name branch 2 times, most recently from 65e88ca to 8ee9397 Compare September 21, 2026 07:39
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch from 5c1efa5 to a27caa4 Compare September 27, 2026 13:45
@Dunqing
Dunqing force-pushed the jsstr-constant-value branch from e973891 to 3e6b7ee Compare September 27, 2026 13:45
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch from a27caa4 to d67fe15 Compare September 27, 2026 15:46
@Dunqing
Dunqing force-pushed the jsstr-constant-value branch 2 times, most recently from 69e87ac to cabfea2 Compare September 27, 2026 23:45
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch 2 times, most recently from e53bbd7 to 721aaa4 Compare September 28, 2026 00:21
@Dunqing
Dunqing force-pushed the jsstr-constant-value branch from 37a11a0 to f2c67b5 Compare September 28, 2026 15:42
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch 2 times, most recently from 62d30a3 to fc10316 Compare September 28, 2026 16:15
@Dunqing
Dunqing force-pushed the jsstr-constant-value branch 2 times, most recently from 62c95ef to df58a7e Compare September 28, 2026 17:17
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch 2 times, most recently from 83f6f48 to 8fd8d8d Compare September 29, 2026 01:38
@Dunqing
Dunqing force-pushed the jsstr-constant-value branch from df58a7e to 47c2d85 Compare September 29, 2026 01:38
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch from 8fd8d8d to c9c1205 Compare September 29, 2026 02:18
@Dunqing
Dunqing force-pushed the jsstr-constant-value branch from 2882a14 to 9941de9 Compare September 29, 2026 08:36
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch 2 times, most recently from 402d975 to 0495a9d Compare September 30, 2026 03:12
@Dunqing
Dunqing force-pushed the jsstr-constant-value branch 2 times, most recently from 9ead552 to 3615e3a Compare September 30, 2026 08:08
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch 2 times, most recently from 047a94e to bd05b14 Compare September 30, 2026 09:34
@Dunqing
Dunqing force-pushed the jsstr-constant-value branch 2 times, most recently from c9dfcf5 to 24d442a Compare September 30, 2026 15:51
@Dunqing
Dunqing force-pushed the jsstr-estree-escape-table branch from bd05b14 to 0385214 Compare September 30, 2026 15:51
The JSON string serializer kept an `EscapeTable` trait with one
implementation after the JSStr migration removed the marker decoder that
had justified it. The indirection no longer selects anything.

Use the `ESCAPE` lookup table directly, make `get_escapes_mask` a free
function with the same algorithm and mask contract, and drop the type
parameter from `write_str`. Output is unchanged.

Part of #26242.

Implemented with AI assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST definitions and visitors, oxc_ast / oxc_ast_visit A-ecmascript Area - ECMAScript spec operations, oxc_ecmascript A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details A-minifier Area - Minification, compression and name mangling, oxc_minifier / oxc_mangler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants