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
505 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"
version = "0.15.0"
edition = "2021"
rust-version = "1.60"
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
authors = ["boa-dev"]
description = "String interner used in Boa."
repository = "https://github.com/boa-dev/boa"
keywords = ["javascript", "js", "string", "interner"]
categories = ["data-structures"]
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
license = "Unlicense/MIT"
[dependencies]
Bump serde from 1.0.138 to 1.0.139 (#2173) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.138 to 1.0.139. <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.139</h2> <ul> <li>Add <code>new</code> constructor function for all <code>IntoDeserializer</code> impls (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2246">#2246</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/serde-rs/serde/commit/44b9496c9114d85df2a59b1cd00cbed418713bf9"><code>44b9496</code></a> Release 1.0.139</li> <li><a href="https://github.com/serde-rs/serde/commit/7e1486d0da6d88411b85803912edc00c29ab556a"><code>7e1486d</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2246">#2246</a> from dtolnay/valuedenew</li> <li><a href="https://github.com/serde-rs/serde/commit/8170ffef2e1f4570394f3238457824bc8d7cc0c5"><code>8170ffe</code></a> Add constructor function for all IntoDeserializer impls</li> <li>See full diff in <a href="https://github.com/serde-rs/serde/compare/v1.0.138...v1.0.139">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.138&new-version=1.0.139)](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.139", features = ["derive"], optional = true }
Update phf requirement from 0.10.1 to 0.11.0 in /boa_interner (#2192) Updates the requirements on [phf](https://github.com/sfackler/rust-phf) to permit the latest version. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/sfackler/rust-phf/releases">phf's releases</a>.</em></p> <blockquote> <h2>v0.11.0</h2> <h2>What's Changed</h2> <ul> <li>Implement PhfHash for integral arrays of any size. by <a href="https://github.com/turbocool3r"><code>@​turbocool3r</code></a> in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/247">rust-phf/rust-phf#247</a></li> <li>Fix phf_codegen example by <a href="https://github.com/fgsch"><code>@​fgsch</code></a> in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/248">rust-phf/rust-phf#248</a></li> <li>Add <code>Map::new()</code> function and <code>Default</code> implementation to create new, empty map by <a href="https://github.com/msrd0"><code>@​msrd0</code></a> in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/249">rust-phf/rust-phf#249</a></li> <li>Make &quot;unicase + macros&quot; features work by <a href="https://github.com/JohnTitor"><code>@​JohnTitor</code></a> in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/251">rust-phf/rust-phf#251</a></li> <li>Fix some Clippy warnings by <a href="https://github.com/JohnTitor"><code>@​JohnTitor</code></a> in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/252">rust-phf/rust-phf#252</a></li> <li>Upgrade <code>actions/checkout</code> to v3 by <a href="https://github.com/JohnTitor"><code>@​JohnTitor</code></a> in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/253">rust-phf/rust-phf#253</a></li> <li>fix: remove now-unnecessary <code>proc-macro-hack</code> crate usage by <a href="https://github.com/ErichDonGubler"><code>@​ErichDonGubler</code></a> in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/256">rust-phf/rust-phf#256</a></li> <li>Make crates edition 2021 by <a href="https://github.com/JohnTitor"><code>@​JohnTitor</code></a> in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/257">rust-phf/rust-phf#257</a></li> <li>Release 0.11.0 by <a href="https://github.com/JohnTitor"><code>@​JohnTitor</code></a> in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/258">rust-phf/rust-phf#258</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/turbocool3r"><code>@​turbocool3r</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/247">rust-phf/rust-phf#247</a></li> <li><a href="https://github.com/fgsch"><code>@​fgsch</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/248">rust-phf/rust-phf#248</a></li> <li><a href="https://github.com/msrd0"><code>@​msrd0</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/249">rust-phf/rust-phf#249</a></li> <li><a href="https://github.com/ErichDonGubler"><code>@​ErichDonGubler</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/256">rust-phf/rust-phf#256</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/rust-phf/rust-phf/compare/v0.10.1...v0.11.0">https://github.com/rust-phf/rust-phf/compare/v0.10.1...v0.11.0</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/rust-phf/rust-phf/blob/master/CHANGELOG.md">phf's changelog</a>.</em></p> <blockquote> <h2>0.11.0</h2> <ul> <li>Bump up MSRV to 1.60</li> <li>Crates' edition are now 2021 <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/257">#257</a></li> <li>Remove <code>proc-macro-hack</code> dependency <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/256">#256</a></li> <li>Now the <code>unicase</code> feature works fine with the <code>macros</code> feature, doesn't need to import <code>phf-macros</code> directly anymore. <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/251">#251</a></li> </ul> <p><a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/251">#251</a>: <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/251">rust-phf/rust-phf#251</a> <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/256">#256</a>: <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/256">rust-phf/rust-phf#256</a> <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/257">#257</a>: <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/257">rust-phf/rust-phf#257</a></p> <h2>0.10.1</h2> <ul> <li>Allow serializing <code>Map</code> (<a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/244">#244</a>)</li> <li>Improve docs (<a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/240">#240</a>, <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/243">#243</a>)</li> </ul> <p><a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/240">#240</a>: <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/240">rust-phf/rust-phf#240</a> <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/243">#243</a>: <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/243">rust-phf/rust-phf#243</a> <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/244">#244</a>: <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/244">rust-phf/rust-phf#244</a></p> <h2>0.10.0</h2> <ul> <li>Constify <code>len</code> and <code>is_empty</code> (<a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/224">#224</a>)</li> <li>Implement <code>Clone</code>, <code>Debug</code>, and <code>FusedIterator</code> (<a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/226">#226</a>)</li> </ul> <p><a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/224">#224</a>: <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/224">rust-phf/rust-phf#224</a> <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/226">#226</a>: <a href="https://github-redirect.dependabot.com/rust-phf/rust-phf/pull/226">rust-phf/rust-phf#226</a></p> <h2>0.9.1</h2> <p><strong>Yanked except for <code>phf-generator</code>, use 0.10.0 instead.</strong></p> <ul> <li>(phf-generator): Pin <code>criterion</code> version to keep MSRV</li> <li>Constify <code>len</code> and <code>is_empty</code> (<a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/224">#224</a>) (<strong>yanked</strong>)</li> <li>Implement <code>Clone</code>, <code>Debug</code>, and <code>FusedIterator</code> (<a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/226">#226</a>) (<strong>yanked</strong>)</li> </ul> <h2>0.9.0</h2> <ul> <li>Our MSRV is now 1.41 or 1.46 (because of dependencies)</li> <li><code>rand</code> dependency has been upgraded to 0.8</li> <li>Fix some crates' build on <code>no_std</code></li> <li>Restore the <code>unicase</code> feature for <code>phf_macros</code></li> <li>Allow using the owned <code>String</code> type for <code>phf</code> dynamic code generation</li> <li>Add back <code>OrderedMap</code> and <code>OrderedSet</code></li> <li>(<strong>breaking change</strong>) Use <code>PhfBorrow</code> trait instead of <code>std::borrow::Borrow</code></li> </ul> <h2>0.8.0</h2> <ul> <li><code>phf_macros</code> now works on stable.</li> <li>:tada: Fixed asymptotic slowdowns when constructing maps over very large datasets (+1M keys)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/rust-phf/rust-phf/commit/c0b9ef98e798f807f94544aeb0fff429ef280efc"><code>c0b9ef9</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/258">#258</a> from JohnTitor/release-0.11.0</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/d2efdc08a7eb1d0d6c414b7b2ac41ce1fe1f9a43"><code>d2efdc0</code></a> Release 0.11.0</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/36ec8854a9da4f295618e98d94aaf7150df2173e"><code>36ec885</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/257">#257</a> from JohnTitor/edition-2021</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/b9d25da58b912d9927fbc41901631cd77836462b"><code>b9d25da</code></a> Make crates edition 2021</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/a85f070d641317a04b81da053cc4040619652e69"><code>a85f070</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/256">#256</a> from NZXTCorp/remove-proc-macro-hack</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/caf1ce71aed110fb44206ce2291154572ebfe9b7"><code>caf1ce7</code></a> fix: remove now-unnecessary <code>proc-macro-hack</code> crate usage</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/92e7b433a4f62cc9b070cd1d678a6061d0906ee6"><code>92e7b43</code></a> chore: point to local crates for now</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/a3e04bccc8dde2b860c68b25887be330cf671026"><code>a3e04bc</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/253">#253</a> from JohnTitor/action-tweaks</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/22570b89476248d22c9d77f315fd98e048c49700"><code>22570b8</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/sfackler/rust-phf/issues/252">#252</a> from JohnTitor/clippy-fixes</li> <li><a href="https://github.com/rust-phf/rust-phf/commit/25811a57ca6983d6b18ec190bd5bcbca6083a9ef"><code>25811a5</code></a> Use Swatinem/rust-cache</li> <li>Additional commits viewable in <a href="https://github.com/sfackler/rust-phf/compare/v0.10.1...v0.11.0">compare view</a></li> </ul> </details> <br /> 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.0", features = ["macros"] }
rustc-hash = "1.1.0"
static_assertions = "1.1.0"