Rust编写的JavaScript引擎,该项目是一个试验性质的项目。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
957 B

Lexer string interning (#1758) This Pull Request is part of #279. It adds a string interner to Boa, which allows many types to not contain heap-allocated strings, and just contain a `NonZeroUsize` instead. This can move types to the stack (hopefully I'll be able to move `Token`, for example, maybe some `Node` types too. Note that the internet is for now only available in the lexer. Next steps (in this PR or future ones) would include also using interning in the parser, and finally in execution. The idea is that strings should be represented with a `Sym` until they are displayed. Talking about display. I have changed the `ParseError` type in order to not contain anything that could contain a `Sym` (basically tokens), which might be a bit faster, but what is important is that we don't depend on the interner when displaying errors. The issue I have now is in order to display tokens. This requires the interner if we want to know identifiers, for example. The issue here is that Rust doesn't allow using a `fmt::Formatter` (only in nightly), which is making my head hurt. Maybe someone of you can find a better way of doing this. Then, about `cursor.expect()`, this is the only place where we don't have the expected token type as a static string, so it's failing to compile. We have the option of changing the type definition of `ParseError` to contain an owned string, but maybe we can avoid this by having a `&'static str` come from a `TokenKind` with the default values, such as "identifier" for an identifier. I wanted for you to think about it and maybe we can just add that and avoid allocations there. Oh, and this depends on the VM-only branch, so that has to be merged before :) Another thing to check: should the interner be in its own module?
3 years ago
[package]
name = "boa_interner"
description = "String interner for the Boa JavaScript engine."
keywords = ["javascript", "js", "string", "interner"]
categories = ["data-structures", "no-std"]
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
Lexer string interning (#1758) This Pull Request is part of #279. It adds a string interner to Boa, which allows many types to not contain heap-allocated strings, and just contain a `NonZeroUsize` instead. This can move types to the stack (hopefully I'll be able to move `Token`, for example, maybe some `Node` types too. Note that the internet is for now only available in the lexer. Next steps (in this PR or future ones) would include also using interning in the parser, and finally in execution. The idea is that strings should be represented with a `Sym` until they are displayed. Talking about display. I have changed the `ParseError` type in order to not contain anything that could contain a `Sym` (basically tokens), which might be a bit faster, but what is important is that we don't depend on the interner when displaying errors. The issue I have now is in order to display tokens. This requires the interner if we want to know identifiers, for example. The issue here is that Rust doesn't allow using a `fmt::Formatter` (only in nightly), which is making my head hurt. Maybe someone of you can find a better way of doing this. Then, about `cursor.expect()`, this is the only place where we don't have the expected token type as a static string, so it's failing to compile. We have the option of changing the type definition of `ParseError` to contain an owned string, but maybe we can avoid this by having a `&'static str` come from a `TokenKind` with the default values, such as "identifier" for an identifier. I wanted for you to think about it and maybe we can just add that and avoid allocations there. Oh, and this depends on the VM-only branch, so that has to be merged before :) Another thing to check: should the interner be in its own module?
3 years ago
[features]
default = ["std"]
std = ["once_cell/std"]
Lexer string interning (#1758) This Pull Request is part of #279. It adds a string interner to Boa, which allows many types to not contain heap-allocated strings, and just contain a `NonZeroUsize` instead. This can move types to the stack (hopefully I'll be able to move `Token`, for example, maybe some `Node` types too. Note that the internet is for now only available in the lexer. Next steps (in this PR or future ones) would include also using interning in the parser, and finally in execution. The idea is that strings should be represented with a `Sym` until they are displayed. Talking about display. I have changed the `ParseError` type in order to not contain anything that could contain a `Sym` (basically tokens), which might be a bit faster, but what is important is that we don't depend on the interner when displaying errors. The issue I have now is in order to display tokens. This requires the interner if we want to know identifiers, for example. The issue here is that Rust doesn't allow using a `fmt::Formatter` (only in nightly), which is making my head hurt. Maybe someone of you can find a better way of doing this. Then, about `cursor.expect()`, this is the only place where we don't have the expected token type as a static string, so it's failing to compile. We have the option of changing the type definition of `ParseError` to contain an owned string, but maybe we can avoid this by having a `&'static str` come from a `TokenKind` with the default values, such as "identifier" for an identifier. I wanted for you to think about it and maybe we can just add that and avoid allocations there. Oh, and this depends on the VM-only branch, so that has to be merged before :) Another thing to check: should the interner be in its own module?
3 years ago
[dependencies]
boa_macros.workspace = true
phf = { version = "0.11.1", default-features = false, features = ["macros"] }
rustc-hash = { version = "1.1.0", default-features = false }
static_assertions = "1.1.0"
Bump once_cell from 1.17.0 to 1.17.1 (#2602) Bumps [once_cell](https://github.com/matklad/once_cell) from 1.17.0 to 1.17.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/matklad/once_cell/blob/master/CHANGELOG.md">once_cell's changelog</a>.</em></p> <blockquote> <h2>1.17.1</h2> <ul> <li>Make <code>OnceRef</code> implementation compliant with <a href="https://github-redirect.dependabot.com/rust-lang/rust/issues/95228">strict provenance</a>.</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/matklad/once_cell/commit/35148638c54c6233545c65d1a5e09d5ba0661806"><code>3514863</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/222">#222</a></li> <li><a href="https://github.com/matklad/once_cell/commit/f0ad5f083d4a6a51a61a0fa5ee9cdf0ed562178a"><code>f0ad5f0</code></a> Bump version to 1.17.1 and update the changelog.</li> <li><a href="https://github.com/matklad/once_cell/commit/78ab172105ef089c1568d1be11432c916694b64b"><code>78ab172</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/219">#219</a></li> <li><a href="https://github.com/matklad/once_cell/commit/6e351e5204e223f25baf4f63aefa861610ee3649"><code>6e351e5</code></a> Use AtomicPtr for race::OnceRef to avoid ptr-int-ptr casts (keeping</li> <li><a href="https://github.com/matklad/once_cell/commit/d706539c6f7cd47d0e8037d832c0c95214fb5f91"><code>d706539</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/214">#214</a></li> <li><a href="https://github.com/matklad/once_cell/commit/cc07949250ed44b208ff3d19af8f6b6577fea1e2"><code>cc07949</code></a> Explain safety of <code>unsync::OnceCell::get(&amp;self)</code> in more detail</li> <li><a href="https://github.com/matklad/once_cell/commit/af9d29c966beb51e53b419cad65c949d7744de21"><code>af9d29c</code></a> drop useless arg</li> <li>See full diff in <a href="https://github.com/matklad/once_cell/compare/v1.17.0...v1.17.1">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=once_cell&package-manager=cargo&previous-version=1.17.0&new-version=1.17.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
2 years ago
once_cell = {version = "1.17.1", default-features = false, features = ["critical-section"]}
Bump indexmap from 1.9.2 to 1.9.3 (#2749) Bumps [indexmap](https://github.com/bluss/indexmap) from 1.9.2 to 1.9.3. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/bluss/indexmap/blob/master/RELEASES.md">indexmap's changelog</a>.</em></p> <blockquote> <ul> <li> <p>1.9.3</p> <ul> <li>Bump the <code>rustc-rayon</code> dependency, for compiler use only.</li> </ul> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/bluss/indexmap/commit/861fad73de14b7f08d2dc56ed83607aef621b42e"><code>861fad7</code></a> Merge pull request <a href="https://redirect.github.com/bluss/indexmap/issues/259">#259</a> from cuviper/indexmap-1-rustc-rayon-0.5</li> <li><a href="https://github.com/bluss/indexmap/commit/3413435112fe333ad69f2c766e7b76800e7105ec"><code>3413435</code></a> Release 1.9.3</li> <li><a href="https://github.com/bluss/indexmap/commit/6c6700066a8eb2a8e875813c56d1c16ba56a6b55"><code>6c67000</code></a> Update rustc-rayon to 0.5</li> <li>See full diff in <a href="https://github.com/bluss/indexmap/compare/1.9.2...1.9.3">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=indexmap&package-manager=cargo&previous-version=1.9.2&new-version=1.9.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
2 years ago
indexmap = "1.9.3"
Bump serde from 1.0.158 to 1.0.159 (#2755) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.158 to 1.0.159. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p> <blockquote> <h2>v1.0.159</h2> <ul> <li>Accept empty #[serde()] attribute (<a href="https://redirect.github.com/serde-rs/serde/issues/2422">#2422</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/serde-rs/serde/commit/d6de911855d1cc0ad13f87503a79d40dc4490442"><code>d6de911</code></a> Release 1.0.159</li> <li><a href="https://github.com/serde-rs/serde/commit/04af32230e9419c2606b905b36bcf132d969085f"><code>04af322</code></a> Merge pull request <a href="https://redirect.github.com/serde-rs/serde/issues/2422">#2422</a> from dtolnay/emptyattr</li> <li><a href="https://github.com/serde-rs/serde/commit/4cb8d079f8658bef6b7a41caca11f5111d067df5"><code>4cb8d07</code></a> Accept empty #[serde()] attribute</li> <li><a href="https://github.com/serde-rs/serde/commit/6ab55a1e523d21059ae1da630c2179c2eb2b725c"><code>6ab55a1</code></a> Add regression test for issue 2415</li> <li><a href="https://github.com/serde-rs/serde/commit/acfd19cb463ea77d2146d637c35d8751601dae75"><code>acfd19c</code></a> Release serde_derive_internals 0.27.0</li> <li>See full diff in <a href="https://github.com/serde-rs/serde/compare/v1.0.158...v1.0.159">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.158&new-version=1.0.159)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
2 years ago
serde = { version = "1.0.159", features = ["derive"], optional = true }
arbitrary = { version = "1", features = ["derive"], optional = true }
hashbrown = { version = "0.13.2", default-features = false, features = ["inline-more"] }