mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
refactor(lexer): compile jsx_over_generic separately for each CPU feature set (#28626)
Part of effort to move to runtime CPU feature detection. Apply `cpu_versions!` to `jsx_over_generic`, keeping its `#[inline(never)]` attribute. `jsx_over_type_params` passes it `cpu`. It doesn't use `cpu` yet. No change to codegen, apart from the new AVX2 version in builds without AVX2 flags.
This commit is contained in:
1 parent
4b90665034
commit
d50848d678
2 files changed
+13
-3
No files matched your search
@@ -54,7 +54,7 @@ pub(super) unsafe fn jsx_over_type_params(
|
||||
&lanes.disambiguate.closers,
|
||||
);
|
||||
let (jsx, unterminated) =
|
||||
jsx_over_generic(&tokens, &mut lanes.disambiguate.walks, lt, lp);
|
||||
jsx_over_generic(&tokens, &mut lanes.disambiguate.walks, lt, lp, cpu);
|
||||
if unterminated {
|
||||
lanes.push_diag(lt as u32, (gt + 1 - lt) as u32, DiagCode::UnterminatedJsxElement);
|
||||
}
|
||||
|
||||
@@ -7,13 +7,23 @@
|
||||
//!
|
||||
//! [`context`]: crate::pipeline::disambiguate::context
|
||||
|
||||
use crate::pipeline::disambiguate::{Tokens, Walks, context};
|
||||
use crate::pipeline::{
|
||||
cpu::{Cpu, apply, cpu_versions},
|
||||
disambiguate::{Tokens, Walks, context},
|
||||
};
|
||||
|
||||
use super::bytes::arrow_after_params;
|
||||
|
||||
/// Whether the ambiguous < at lt is JSX, and whether it is an unterminated element to report.
|
||||
#[apply(cpu_versions)]
|
||||
#[inline(never)]
|
||||
pub fn jsx_over_generic(tokens: &Tokens, walks: &mut Walks, lt: usize, lp: usize) -> (bool, bool) {
|
||||
pub fn jsx_over_generic(
|
||||
tokens: &Tokens,
|
||||
walks: &mut Walks,
|
||||
lt: usize,
|
||||
lp: usize,
|
||||
_cpu: impl Cpu,
|
||||
) -> (bool, bool) {
|
||||
let site = context::before(tokens, walks, lt);
|
||||
if site.in_type || site.type_params {
|
||||
return (false, false);
|
||||
|
||||
Reference in new issue
Block a user