feat(minifier): normalize Number.NaN as NaN#11275
Conversation
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. |
Merge activity
|
There was a problem hiding this comment.
Pull Request Overview
This PR normalizes the representation of NaN by converting both NaN and Number.NaN expressions to a unified f64::NaN.
- Adds tests to ensure that Number.NaN is normalized to NaN.
- Updates normalization logic in the minifier to handle Number.NaN alongside NaN.
- Introduces a helper method in the AST builder to construct a NaN literal.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_minifier/tests/peephole/dead_code_elimination.rs | Adds tests for folding Number.NaN to NaN. |
| crates/oxc_minifier/src/peephole/normalize.rs | Updates normalization documentation and adds fold_number_nan_to_nan function; renames convert_void_ident to fold_void_ident. |
| crates/oxc_ast/src/ast_builder_impl.rs | Introduces a new nan() helper function to build a NaN literal. |
CodSpeed Instrumentation Performance ReportMerging #11275 will degrade performances by 5.07%Comparing Summary
Benchmarks breakdown
|
8ed6bca to
01ca3de
Compare
01ca3de to
f88f666
Compare
closes #11272