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.

25 lines
700 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"]
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]
fuzz = ["arbitrary"]
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
Bump serde from 1.0.145 to 1.0.147 (#2374) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.145 to 1.0.147. <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.147</h2> <ul> <li>Add <code>serde::de::value::EnumAccessDeserializer</code> which transforms an <code>EnumAccess</code> into a <code>Deserializer</code> (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2305">#2305</a>)</li> </ul> <h2>v1.0.146</h2> <ul> <li>Allow internally tagged newtype variant to contain unit (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2303">#2303</a>, thanks <a href="https://github.com/tage64"><code>@​tage64</code></a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/serde-rs/serde/commit/f41509261e32357e28a6bc6f46f58e98d841e7e8"><code>f415092</code></a> Release 1.0.147</li> <li><a href="https://github.com/serde-rs/serde/commit/6d009711a2fe0be0bd0e2b47eeebbad8cb35b018"><code>6d00971</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2305">#2305</a> from serde-rs/enumaccessdeserializer</li> <li><a href="https://github.com/serde-rs/serde/commit/354b48fd40874cef6d77806abc236fe24dbf399a"><code>354b48f</code></a> Add EnumAccessDeserializer to turn EnumAccess into a Deserializer</li> <li><a href="https://github.com/serde-rs/serde/commit/3fd8e52f0c59045482a004073b6e3e033ed2bc67"><code>3fd8e52</code></a> Release 1.0.146</li> <li><a href="https://github.com/serde-rs/serde/commit/142dce0d3dc82f59f1a06342864de51160b12c65"><code>142dce0</code></a> Touch up PR 2303</li> <li><a href="https://github.com/serde-rs/serde/commit/6aed101630b50c5ea23273245eee6054f7337d6f"><code>6aed101</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2303">#2303</a> from tage64/master</li> <li><a href="https://github.com/serde-rs/serde/commit/e2ccfd9ea7f118a29e27037e1da79aa29a7c1be8"><code>e2ccfd9</code></a> Remove bad deserialization from sequence to internally tagged newtype variant...</li> <li><a href="https://github.com/serde-rs/serde/commit/a07d794f74475677544fdb35b981141ff8284c0b"><code>a07d794</code></a> Update test_suite/tests/test_annotations.rs</li> <li><a href="https://github.com/serde-rs/serde/commit/90d28fc314747039a710d2561a5ca2007d9378ad"><code>90d28fc</code></a> Serialize and deserialize a tagged newtype variant over unit () as if it was ...</li> <li><a href="https://github.com/serde-rs/serde/commit/55cf0ac51a1c737a65d1a26b4b29184425e465a5"><code>55cf0ac</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2297">#2297</a> from serde-rs/output</li> <li>Additional commits viewable in <a href="https://github.com/serde-rs/serde/compare/v1.0.145...v1.0.147">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.145&new-version=1.0.147)](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.147", features = ["derive"], optional = true }
Bump phf from 0.11.0 to 0.11.1 (#2226) Bumps [phf](https://github.com/rust-phf/rust-phf) from 0.11.0 to 0.11.1. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/rust-phf/rust-phf/releases">phf's releases</a>.</em></p> <blockquote> <h2>phf v0.11.1</h2> <h3>Chore</h3> <ul> <li><!-- raw HTML omitted --> point to local crates for now</li> </ul> <h3>Documentation</h3> <ul> <li>state allowed key expressions in <code>phf_map</code></li> </ul> <h3>Bug Fixes</h3> <ul> <li> <p>remove now-unnecessary <code>proc-macro-hack</code> crate usage Resolves <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/issues/255">rust-phf/rust-phf#255</a>.</p> <p>This resolves an issue with Windows Defender identifying <code>proc-macro-hack</code> as threats. It also sheds a depedency that is no longer necessary, now that the MSRV of this crate is 1.46 and <code>proc-macro-hack</code> is only useful for providing support for Rust versions 1.31 through 1.45. Per <a href="https://github.com/dtolnay/proc-macro-hack">upstream</a>:</p> <blockquote> <p><strong>Note:</strong> <em>As of Rust 1.45 this crate is superseded by native support for #[proc_macro] in expression position. Only consider using this crate if you care about supporting compilers between 1.31 and 1.45.</em></p> </blockquote> </li> </ul> <h3>Commit Statistics</h3> <ul> <li>234 commits contributed to the release over the course of 2957 calendar days.</li> <li>3 commits where understood as <a href="https://www.conventionalcommits.org">conventional</a>.</li> <li>1 unique issue was worked on: <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/issues/249">#249</a></li> </ul> <h3>Commit Details</h3> <!-- raw HTML omitted --> <!-- raw HTML omitted --> <ul> <li><strong><a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/issues/249">#249</a></strong> <ul> <li>Add <code>Map::new()</code> function and <code>Default</code> implementation to create new, empty map (baac7d0)</li> </ul> </li> <li><strong>Uncategorized</strong> <ul> <li>Replace handmade changelog with generated one by <code>cargo-smart-release</code> (cb84cf6)</li> <li>Add category to crates (32a72c3)</li> <li>Update repository links on Cargo.toml (1af3b0f)</li> <li>Release 0.11.0 (d2efdc0)</li> <li>Merge pull request <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/issues/257">#257</a> from JohnTitor/edition-2021 (36ec885)</li> <li>Make crates edition 2021 (b9d25da)</li> <li>remove now-unnecessary <code>proc-macro-hack</code> crate usage (caf1ce7)</li> <li>point to local crates for now (92e7b43)</li> <li>Merge pull request <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/issues/253">#253</a> from JohnTitor/action-tweaks (a3e04bc)</li> <li>Fix some Clippy warnings (71fd47c)</li> <li>Make &quot;unicase + macros&quot; features work (11bb242)</li> <li>Prepare 0.10.1 release (4cc8344)</li> </ul> </li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/rust-phf/rust-phf/blob/master/RELEASE_PROCESS.md">phf's changelog</a>.</em></p> <blockquote> <h1>How to make a new release</h1> <p>Since v0.11.1, this repository uses <a href="https://crates.io/crates/cargo-smart-release"><code>cargo-smart-release</code></a> to release crates.</p> <h2>Installation</h2> <pre lang="sh"><code>cargo install cargo-smart-release </code></pre> <h2>Before running <code>cargo-smart-release</code></h2> <p>If the next version has a major change or bumps MSRV, i.e. it increases a minor version on <code>v0.Y.Z</code> or a major version on <code>vX.Y.Z</code>, update the versions mentioned on the README and doc comments (and CI config if it touches MSRV).</p> <h2>Run <code>cargo-smart-release</code></h2> <p>First, just run:</p> <pre lang="sh"><code>cargo smart-release phf phf_codegen phf_generator phf_macros phf_shared </code></pre> <p>This would show what <code>cargo-smart-release</code> would do, e.g. how it updates the version number, changelog, etc. If you satisfy the output, run:</p> <pre lang="sh"><code>cargo smart-release -u -e phf phf_codegen phf_generator phf_macros phf_shared </code></pre> <p>This would make actual releases. <code>-e</code> means that it executes actual releases and <code>-u</code> means that it always updates crates-index. <code>cargo-smart-release</code> also takes care of the Git tags.</p> <p>After executing it, ensure that all the releases are actually happened and the tags are pushed. If all the things are fine, that's it!</p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/rust-phf/rust-phf/commit/3897b21c6d38e5adcaf9110b4bb33c19f6b41977"><code>3897b21</code></a> Release phf_shared v0.11.1, phf_generator v0.11.1, phf_macros v0.11.1, phf v0...</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/3c6af3f7d783a6018070944a00fa29e0ff48b0dc"><code>3c6af3f</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/issues/265">#265</a> from rust-phf/unpin-criterion</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/27a2ce4b07ddc68c45e2faccbfef52d22375c1b0"><code>27a2ce4</code></a> phf_generator: Unpin the <code>criterion</code> dependency</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/97f997d2be827ca636a29046c78e2c09c5c62650"><code>97f997d</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/issues/264">#264</a> from rust-phf/tweak-changelog</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/cb84cf6636ab52823c53e70d6abeac8f648a3482"><code>cb84cf6</code></a> Replace handmade changelog with generated one by <code>cargo-smart-release</code></li> <li><a href="https://github.com/rust-phf/rust-phf/commit/d441940cbb1a4653d2b33467e2449e6178ad53a7"><code>d441940</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/issues/263">#263</a> from lopopolo/lopopolo/rand-no-default-features</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/deefda1cdff6ced54526ddb702b13282e0c8c66b"><code>deefda1</code></a> Disable default features for rand dep in phf_generator</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/1407ebe536b39611db92d765ddec4de0e6c8a16e"><code>1407ebe</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/issues/260">#260</a> from JohnTitor/fix-repo-link</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/488b1638d29a1f27add32a324fd75b8c729782a5"><code>488b163</code></a> Fix a typo</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/e0b34fa0a697f45f2c41a875bf84b78a6d3ce079"><code>e0b34fa</code></a> Add README.md for some crates</li> <li>Additional commits viewable in <a href="https://github.com/rust-phf/rust-phf/compare/v0.11.0...phf-v0.11.1">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=phf&package-manager=cargo&previous-version=0.11.0&new-version=0.11.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
phf = { version = "0.11.1", features = ["macros"] }
rustc-hash = "1.1.0"
static_assertions = "1.1.0"
Bump once_cell from 1.15.0 to 1.16.0 (#2396) Bumps [once_cell](https://github.com/matklad/once_cell) from 1.15.0 to 1.16.0. <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.16.0</h2> <ul> <li>Add <code>no_std</code> implementation based on <code>critical-section</code>, <a href="https://github-redirect.dependabot.com/matklad/once_cell/pull/195">#195</a>.</li> <li>Deprecate <code>atomic-polyfill</code> feature (use the new <code>critical-section</code> instead)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/matklad/once_cell/commit/18e47d73088c0d60ec4a7da50b4ef50417bbc5df"><code>18e47d7</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/206">#206</a></li> <li><a href="https://github.com/matklad/once_cell/commit/06ff1bd31fe480b27497b89472fd0d4d33f281c4"><code>06ff1bd</code></a> publish 1.16.0</li> <li><a href="https://github.com/matklad/once_cell/commit/04e1d59ce7d0d8f2d73c12e84919b927c37bc9e7"><code>04e1d59</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/204">#204</a></li> <li><a href="https://github.com/matklad/once_cell/commit/32ba3f8aa8b88ea36dff2ae4767cd3b22f2d1634"><code>32ba3f8</code></a> clarify MSRV</li> <li><a href="https://github.com/matklad/once_cell/commit/0ebafa5d2f74e35f56f7b7300037b7c26da24bb8"><code>0ebafa5</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/203">#203</a></li> <li><a href="https://github.com/matklad/once_cell/commit/cb85e6b8b8231e2f7bf21e96825113ddcb7244a8"><code>cb85e6b</code></a> publish 1.16.0-pre.1</li> <li><a href="https://github.com/matklad/once_cell/commit/b56e329d70dcc0f2f223d738fe3520b1f842e435"><code>b56e329</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/195">#195</a></li> <li><a href="https://github.com/matklad/once_cell/commit/7d9afdb9d794b549b87a6d7c6611e3a28ec1588a"><code>7d9afdb</code></a> Add comment explaining <code>Mutex\&lt;unsync::OnceCell&gt;</code>.</li> <li><a href="https://github.com/matklad/once_cell/commit/32dada4dbe48ea45c63749b45a476a1d46af75a2"><code>32dada4</code></a> Fix features.</li> <li><a href="https://github.com/matklad/once_cell/commit/23d129038fddb4ec2336ec5879f6482cafe4bd5c"><code>23d1290</code></a> Decrease <code>critical-section</code> version.</li> <li>Additional commits viewable in <a href="https://github.com/matklad/once_cell/compare/v1.15.0...v1.16.0">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.15.0&new-version=1.16.0)](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 = "1.16.0"
indexmap = "1.9.1"
arbitrary = { version = "1", optional = true, features = ["derive"] }