|
|
|
[package]
|
|
|
|
name = "boa_engine"
|
|
|
|
keywords = ["javascript", "js", "compiler", "lexer", "parser"]
|
|
|
|
categories = ["parser-implementations", "compilers"]
|
|
|
|
readme = "../README.md"
|
|
|
|
description.workspace = true
|
|
|
|
version.workspace = true
|
|
|
|
edition.workspace = true
|
|
|
|
authors.workspace = true
|
|
|
|
license.workspace = true
|
|
|
|
repository.workspace = true
|
|
|
|
rust-version.workspace = true
|
|
|
|
|
|
|
|
[features]
|
|
|
|
profiler = ["boa_profiler/profiler"]
|
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
|
|
|
deser = ["boa_interner/serde"]
|
|
|
|
intl = [
|
|
|
|
"dep:icu_locale_canonicalizer",
|
|
|
|
"dep:icu_locid",
|
|
|
|
"dep:icu_datetime",
|
|
|
|
"dep:icu_plurals",
|
|
|
|
"dep:icu_provider",
|
|
|
|
"dep:icu_testdata",
|
|
|
|
"dep:sys-locale"
|
|
|
|
]
|
|
|
|
|
|
|
|
# Enable Boa's WHATWG console object implementation.
|
|
|
|
console = []
|
|
|
|
|
|
|
|
[dependencies]
|
|
|
|
boa_unicode.workspace = true
|
|
|
|
boa_interner.workspace = true
|
|
|
|
boa_gc.workspace = true
|
|
|
|
boa_profiler.workspace = true
|
|
|
|
boa_macros.workspace = true
|
|
|
|
gc = "0.4.1"
|
|
|
|
serde = { version = "1.0.147", features = ["derive", "rc"] }
|
|
|
|
serde_json = "1.0.87"
|
|
|
|
rand = "0.8.5"
|
Bump num-traits from 0.2.14 to 0.2.15 (#2056)
Bumps [num-traits](https://github.com/rust-num/num-traits) from 0.2.14 to 0.2.15.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/rust-num/num-traits/blob/master/RELEASES.md">num-traits's changelog</a>.</em></p>
<blockquote>
<h1>Release 0.2.15 (2022-05-02)</h1>
<ul>
<li><a href="https://github-redirect.dependabot.com/rust-num/num-traits/pull/195">The new <code>Euclid</code> trait calculates Euclidean division</a>, where the
remainder is always positive or zero.</li>
<li><a href="https://github-redirect.dependabot.com/rust-num/num-traits/pull/210">The new <code>LowerBounded</code> and <code>UpperBounded</code> traits</a> separately describe
types with lower and upper bounds. These traits are automatically implemented
for all fully-<code>Bounded</code> types.</li>
<li><a href="https://github-redirect.dependabot.com/rust-num/num-traits/pull/207">The new <code>Float::copysign</code> method copies the sign of the argument</a> to
to the magnitude of <code>self</code>.</li>
<li><a href="https://github-redirect.dependabot.com/rust-num/num-traits/pull/205">The new <code>PrimInt::leading_ones</code> and <code>trailing_ones</code> methods</a> are the
complement of the existing methods that count zero bits.</li>
<li><a href="https://github-redirect.dependabot.com/rust-num/num-traits/pull/202">The new <code>PrimInt::reverse_bits</code> method reverses the order of all bits</a>
of a primitive integer.</li>
<li><a href="https://github-redirect.dependabot.com/rust-num/num-traits/pull/201">Improved <code>Num::from_str_radix</code> for floats</a>, also <a href="https://github-redirect.dependabot.com/rust-num/num-traits/pull/214">ignoring case</a>.</li>
<li><a href="https://github-redirect.dependabot.com/rust-num/num-traits/pull/196"><code>Float</code> and <code>FloatCore</code> use more from <code>libm</code></a> when that is enabled.</li>
</ul>
<p><strong>Contributors</strong>: <a href="https://github.com/alion02"><code>@alion02</code></a>, <a href="https://github.com/clarfonthey"><code>@clarfonthey</code></a>, <a href="https://github.com/cuviper"><code>@cuviper</code></a>, <a href="https://github.com/ElectronicRU"><code>@ElectronicRU</code></a>,
<a href="https://github.com/ibraheemdev"><code>@ibraheemdev</code></a>, <a href="https://github.com/SparrowLii"><code>@SparrowLii</code></a>, <a href="https://github.com/sshilovsky"><code>@sshilovsky</code></a>, <a href="https://github.com/tspiteri"><code>@tspiteri</code></a>, <a href="https://github.com/XAMPPRocky"><code>@XAMPPRocky</code></a>, <a href="https://github.com/Xiretza"><code>@Xiretza</code></a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/rust-num/num-traits/commit/1597c1c4d1b3e33548e4661c519b7246a5fc1c28"><code>1597c1c</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-num/num-traits/issues/236">#236</a></li>
<li><a href="https://github.com/rust-num/num-traits/commit/4a2e648d9325810dcaf627f743c0fc5df066a820"><code>4a2e648</code></a> Release 0.2.15</li>
<li><a href="https://github.com/rust-num/num-traits/commit/edb4821d42bfd055792a72234798b76b8068fe56"><code>edb4821</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-num/num-traits/issues/207">#207</a></li>
<li><a href="https://github.com/rust-num/num-traits/commit/e4e52de40fdf4fa5f2ef260a482cf51c915581c5"><code>e4e52de</code></a> Fix copysign tests for 1.8.0</li>
<li><a href="https://github.com/rust-num/num-traits/commit/30077120f96ff00de46cab3c6ce693eb892c18bd"><code>3007712</code></a> Don't use an explicit copysign feature</li>
<li><a href="https://github.com/rust-num/num-traits/commit/30f8d3ab4bfb590f742f592309109e00b207b23d"><code>30f8d3a</code></a> Make sure test_copysignf uses Float</li>
<li><a href="https://github.com/rust-num/num-traits/commit/70b5c579ab6a001435208d8d3811407c8f07fa94"><code>70b5c57</code></a> Update float.rs</li>
<li><a href="https://github.com/rust-num/num-traits/commit/cabfb0b90497ba5d908d14a908dd269f03cc5f4d"><code>cabfb0b</code></a> Update float.rs</li>
<li><a href="https://github.com/rust-num/num-traits/commit/7ca2456e9c1b3f89a6bb749fc54d8a153ff51704"><code>7ca2456</code></a> Update float.rs</li>
<li><a href="https://github.com/rust-num/num-traits/commit/64db6c32936c1cd00c3074b847e10c7e6f8b20b3"><code>64db6c3</code></a> Add copysign</li>
<li>Additional commits viewable in <a href="https://github.com/rust-num/num-traits/compare/num-traits-0.2.14...num-traits-0.2.15">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=num-traits&package-manager=cargo&previous-version=0.2.14&new-version=0.2.15)](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>
3 years ago
|
|
|
num-traits = "0.2.15"
|
|
|
|
regress = "0.4.1"
|
|
|
|
rustc-hash = "1.1.0"
|
|
|
|
num-bigint = { version = "0.4.3", features = ["serde"] }
|
|
|
|
num-integer = "0.1.45"
|
|
|
|
bitflags = "1.3.2"
|
|
|
|
indexmap = "1.9.1"
|
|
|
|
ryu-js = "0.2.2"
|
|
|
|
chrono = "0.4.22"
|
|
|
|
fast-float = "0.2.0"
|
|
|
|
unicode-normalization = "0.1.22"
|
|
|
|
dyn-clone = "1.0.9"
|
|
|
|
once_cell = "1.15.0"
|
|
|
|
tap = "1.0.1"
|
|
|
|
sptr = "0.3.2"
|
|
|
|
static_assertions = "1.1.0"
|
Create new lazy Error type (#2283)
This is an experiment that tries to migrate the codebase from eager `Error` objects to lazy ones.
In short words, this redefines `JsResult = Result<JsValue, JsError>`, where `JsError` is a brand new type that stores only the essential part of an error type, and only transforms those errors to `JsObject`s on demand (when having to pass them as arguments to functions or store them inside async/generators).
This change is pretty big, because it unblocks a LOT of code from having to take a `&mut Context` on each call. It also paves the road for possibly making `JsError` a proper variant of `JsValue`, which can be a pretty big optimization for try/catch.
A downside of this is that it exposes some brand new error types to our public API. However, we can now implement `Error` on `JsError`, making our `JsResult` type a bit more inline with Rust's best practices.
~Will mark this as draft, since it's missing some documentation and a lot of examples, but~ it's pretty much feature complete. As always, any comments about the design are very much appreciated!
Note: Since there are a lot of changes which are essentially just rewriting `context.throw` to `JsNativeError::%type%`, I'll leave an "index" of the most important changes here:
- [boa_engine/src/error.rs](https://github.com/boa-dev/boa/pull/2283/files#diff-f15f2715655440626eefda5c46193d29856f4949ad37380c129a8debc6b82f26)
- [boa_engine/src/builtins/error/mod.rs](https://github.com/boa-dev/boa/pull/2283/files#diff-3eb1e4b4b5c7210eb98192a5277f5a239148423c6b970c4ae05d1b267f8f1084)
- [boa_tester/src/exec/mod.rs](https://github.com/boa-dev/boa/pull/2283/files#diff-fc3d7ad7b5e64574258c9febbe56171f3309b74e0c8da35238a76002f3ee34d9)
2 years ago
|
|
|
thiserror = "1.0.37"
|
|
|
|
icu_locale_canonicalizer = { version = "0.6.0", features = ["serde"], optional = true }
|
|
|
|
icu_locid = { version = "0.6.0", features = ["serde"], optional = true }
|
|
|
|
icu_datetime = { version = "0.6.0", features = ["serde"], optional = true }
|
|
|
|
icu_plurals = { version = "0.6.0", features = ["serde"], optional = true }
|
|
|
|
icu_provider = { version = "0.6.0", optional = true }
|
|
|
|
icu_testdata = { version = "0.6.0", optional = true }
|
|
|
|
sys-locale = { version = "0.2.1", optional = true }
|
|
|
|
|
|
|
|
[dev-dependencies]
|
|
|
|
criterion = "0.4.0"
|
|
|
|
float-cmp = "0.9.0"
|
|
|
|
|
|
|
|
[target.x86_64-unknown-linux-gnu.dev-dependencies]
|
|
|
|
jemallocator = "0.5.0"
|
|
|
|
|
|
|
|
[lib]
|
|
|
|
crate-type = ["cdylib", "lib"]
|
|
|
|
name = "boa_engine"
|
|
|
|
bench = false
|
|
|
|
|
|
|
|
[[bench]]
|
|
|
|
name = "full"
|
|
|
|
harness = false
|