mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
refactor(lexer): #[inline(always)] on unicode_ws_len_at_unchecked (#28624)
Part of effort to move to runtime CPU feature detection. Mark `unicode_ws_len_at_unchecked` as `#[inline(always)]`, instead of compiling it separately for each CPU feature set. It's a thin wrapper around `unicode_ws_len`, which is `#[inline(always)]`, so it doesn't need a CPU type. Why `#[inline(always)]`: Applying `cpu_versions!` to it, keeping its `#[inline]` attribute, made it no longer inlined on x86_64, into `misc_pre`, `jsx_skip_trivia` or `is_jsx_name_byte_at`. `misc_pre` calls it for every non-ASCII byte, so that put a function call in a hot loop. `#[inline(always)]` keeps it inlined everywhere, as it is now. No change to codegen.
This commit is contained in:
1 parent
f1cb7d319b
commit
dfc8ea2dd5
1 file changed
+1
-1
@@ -53,7 +53,7 @@ pub(super) fn unicode_ws_len_at(src: &[u8], p: usize) -> usize {
|
||||
/// U+0085, U+00A0, U+1680, U+2000..=U+200B, U+2028, U+2029, U+202F, U+205F, U+3000, U+FEFF.
|
||||
///
|
||||
/// Unsafe version of [`unicode_ws_len_at`].
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
pub(super) unsafe fn unicode_ws_len_at_unchecked(src: *const u8, p: usize) -> usize {
|
||||
unicode_ws_len(*src.add(p), *src.add(p + 1), *src.add(p + 2))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user