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.

18 lines
529 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
[dependencies]
Bump serde from 1.0.144 to 1.0.145 (#2298) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.144 to 1.0.145. <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.145</h2> <ul> <li>Allow RefCell&lt;T&gt;, Mutex&lt;T&gt;, and RwLock&lt;T&gt; to be serialized regardless of whether T is <code>Sized</code> (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2282">#2282</a>, thanks <a href="https://github.com/ChayimFriedman2"><code>@​ChayimFriedman2</code></a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/serde-rs/serde/commit/8c036ee5a313b849c52eaaef6421c3b68dd1a350"><code>8c036ee</code></a> Release 1.0.145</li> <li><a href="https://github.com/serde-rs/serde/commit/d99009f3c62396ff6e2d21bedc042ce395388202"><code>d99009f</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2282">#2282</a> from ChayimFriedman2/sized-mutex-refcell-rwlock</li> <li><a href="https://github.com/serde-rs/serde/commit/be3c37eb8be65a472250e9893694ac02c474e06e"><code>be3c37e</code></a> Serialize unsized <code>RefCell</code>, <code>Mutex</code> and <code>RwLock</code></li> <li><a href="https://github.com/serde-rs/serde/commit/f0346ae0541b6017c4a181534bbf802a486662c3"><code>f0346ae</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2281">#2281</a> from dtolnay/try</li> <li><a href="https://github.com/serde-rs/serde/commit/fa6ce4205650d448f8adb283983ba91669a177ee"><code>fa6ce42</code></a> Redefine 'try' macro to omit From::from error conversion</li> <li><a href="https://github.com/serde-rs/serde/commit/a9320db6f91b9f6b10d2b36c1a9f642bca3cd00d"><code>a9320db</code></a> Consistently avoid '?' throughout serde crate</li> <li><a href="https://github.com/serde-rs/serde/commit/d208762c81883a181e8c6a9ca3f303e040105c7d"><code>d208762</code></a> Command-line ignore let_underscore_drop clippy lint</li> <li><a href="https://github.com/serde-rs/serde/commit/5386897d2413032b4b45515f819643eafbc44303"><code>5386897</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2273">#2273</a> from sashashura/patch-1</li> <li><a href="https://github.com/serde-rs/serde/commit/68eb59df0c360c7c269d115485a20e98e3caa3ab"><code>68eb59d</code></a> Update ci.yml</li> <li><a href="https://github.com/serde-rs/serde/commit/a7f45516699e5d3e887ec767090b35e6cadb6e29"><code>a7f4551</code></a> Add dev-dependencies keyword for serde_test</li> <li>See full diff in <a href="https://github.com/serde-rs/serde/compare/v1.0.144...v1.0.145">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.144&new-version=1.0.145)](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.145", 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"