oxc/crates/oxc_parser/src/js
Boshen 4706765d2a
refactor(parser): reduce Token size from 32 to 16 bytes (#1962)
Part of #1880

`Token` size is reduced from 32 to 16 bytes by changing the previous
token value `Option<&'a str>` to a u32 index handle.

It would be nice if this handle is eliminated entirely because
the normal case for a string is always
`&source_text[token.span.start.token.span.end]`

Unfortunately, JavaScript allows escaped characters to appear in
identifiers, strings and templates. These strings need to be unescaped
for equality checks, i.e. `"\a"  === "a"`.

This leads us to adding a `escaped_strings[]` vec for storing these
unescaped and allocated
strings.

Performance regression for adding this vec should be minimal because
escaped strings are rare.

Background Reading:

* https://floooh.github.io/2018/06/17/handles-vs-pointers.html
2024-01-09 15:17:02 +08:00
..
binding.rs refactor(ast): clean up some methods 2023-10-15 10:49:35 +08:00
class.rs fix(parser): unexpected ts type annotation in get/set (#1942) 2024-01-08 15:07:43 +08:00
declaration.rs feat(parsr): parse let.a = 1 with error recovery (#1587) 2023-11-29 23:21:39 +08:00
expression.rs refactor(parser): reduce Token size from 32 to 16 bytes (#1962) 2024-01-09 15:17:02 +08:00
function.rs refactor(parser): reduce Token size from 32 to 16 bytes (#1962) 2024-01-09 15:17:02 +08:00
grammar.rs refactor(ast): change the arguments order for some new functions 2023-09-16 16:07:52 +08:00
list.rs refactor(ast): introduce ThisParameter (#1728) 2023-12-19 13:20:33 +08:00
mod.rs
module.rs refactor(parser): remove duplicated code 2023-11-29 18:23:32 +08:00
object.rs refactor(ast): introduce ThisParameter (#1728) 2023-12-19 13:20:33 +08:00
operator.rs feat(minimizer): print parentheses 2023-06-01 22:45:26 +08:00
statement.rs refactor(parser): reduce Token size from 32 to 16 bytes (#1962) 2024-01-09 15:17:02 +08:00