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.

117 lines
3.7 KiB

[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"]
deser = ["boa_interner/serde", "boa_ast/serde"]
intl = [
"icu_normalizer/serde",
"icu_normalizer/std",
"dep:boa_icu_provider",
"dep:icu_locid_transform",
"dep:icu_locid",
"dep:icu_datetime",
"dep:icu_plurals",
"dep:icu_provider",
"dep:icu_calendar",
"dep:icu_collator",
"dep:icu_casemap",
"dep:icu_list",
"dep:icu_segmenter",
"dep:writeable",
"dep:sys-locale",
"dep:yoke",
"dep:zerofrom",
"dep:fixed_decimal",
]
fuzz = ["boa_ast/arbitrary", "boa_interner/arbitrary"]
Implement instruction flowgraph generator (#2422) This PR is a WIP implementation of a vm instruction flowgraph generator This aims to make the vm easier to debug and understand for both newcomers and experienced devs. For example if we have the following code: ```js let i = 0; while (i < 10) { if (i == 3) { break; } i++; } ``` It generates the following instructions (which is hard to read, especially jumps): <details> ``` ----------------------Compiled Output: '<main>'----------------------- Location Count Opcode Operands 000000 0000 PushZero 000001 0001 DefInitLet 0000: 'i' 000006 0002 LoopStart 000007 0003 LoopContinue 000008 0004 GetName 0000: 'i' 000013 0005 PushInt8 10 000015 0006 LessThan 000016 0007 JumpIfFalse 78 000021 0008 PushDeclarativeEnvironment 0, 1 000030 0009 GetName 0000: 'i' 000035 0010 PushInt8 3 000037 0011 Eq 000038 0012 JumpIfFalse 58 000043 0013 PushDeclarativeEnvironment 0, 0 000052 0014 Jump 78 000057 0015 PopEnvironment 000058 0016 GetName 0000: 'i' 000063 0017 IncPost 000064 0018 RotateRight 2 000066 0019 SetName 0000: 'i' 000071 0020 Pop 000072 0021 PopEnvironment 000073 0022 Jump 7 000078 0023 LoopEnd Literals: <empty> Bindings: 0000: i Functions: <empty> ``` </details> And the flow graph is generated: ![flowgraph](https://user-images.githubusercontent.com/8566042/200589387-40b36ad7-d2f2-4918-a3e4-5a8fa5eee89b.png) The beginning of the function is marked by the `start` node (in green) and end (in red). In branching the "yes" branch is marked in green and "no" in red. ~~This only generates in [graphviz format](https://en.wikipedia.org/wiki/DOT_(graph_description_language)) (a widely used format) but it would be nice to also generate to a format that `mermaid.js` can understand and that could be put in articles https://github.com/boa-dev/boa-dev.github.io/issues/26~~ TODO: - [x] Generate graphviz format - [x] Generate mermaid format - [x] Programmatically generate colors push and pop env instructions - [x] Display nested functions in sub-sub-graphs. - [x] Put under a feature (`"flowgraph"`) - [x] Handle try/catch, switch instructions - [x] CLI option for configuring direction of flow (by default it is top down) - [x] Handle `Throw` instruction (requires keeping track of try blocks) - [x] Documentation - [x] Prevent node name collisions (functions with the same name)
2 years ago
# Enable Boa's VM instruction flowgraph generator.
flowgraph = []
# Enable Boa's VM instruction tracing.
trace = []
# Enable Boa's additional ECMAScript features for web browsers.
annex-b = ["boa_parser/annex-b"]
[dependencies]
boa_interner.workspace = true
boa_gc = { workspace = true, features = [ "thinvec" ] }
boa_profiler.workspace = true
boa_macros.workspace = true
boa_ast.workspace = true
boa_parser.workspace = true
serde = { workspace = true, features = ["derive", "rc"] }
serde_json.workspace = true
Bump rand from 0.8.4 to 0.8.5 (#1839) Bumps [rand](https://github.com/rust-random/rand) from 0.8.4 to 0.8.5. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/rust-random/rand/blob/master/CHANGELOG.md">rand's changelog</a>.</em></p> <blockquote> <h2>[0.8.5] - 2021-08-20</h2> <h3>Fixes</h3> <ul> <li>Fix build on non-32/64-bit architectures (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1144">#1144</a>)</li> <li>Fix &quot;min_const_gen&quot; feature for <code>no_std</code> (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1173">#1173</a>)</li> <li>Check <code>libc::pthread_atfork</code> return value with panic on error (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1178">#1178</a>)</li> <li>More robust reseeding in case <code>ReseedingRng</code> is used from a fork handler (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1178">#1178</a>)</li> <li>Fix nightly: remove unused <code>slice_partition_at_index</code> feature (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1215">#1215</a>)</li> <li>Fix nightly + <code>simd_support</code>: update <code>packed_simd</code> (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1216">#1216</a>)</li> </ul> <h3>Rngs</h3> <ul> <li><code>StdRng</code>: Switch from HC128 to ChaCha12 on emscripten (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1142">#1142</a>). We now use ChaCha12 on all platforms.</li> </ul> <h3>Documentation</h3> <ul> <li>Added docs about rand's use of const generics (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1150">#1150</a>)</li> <li>Better random chars example (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1157">#1157</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/rust-random/rand/commit/937320cbfeebd4352a23086d9c6e68f067f74644"><code>937320c</code></a> Update CHANGELOG for 0.8.5 (<a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1221">#1221</a>)</li> <li><a href="https://github.com/rust-random/rand/commit/2924af688d352b889322870d017356f12651866b"><code>2924af6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1183">#1183</a> from vks/fill-float-doc</li> <li><a href="https://github.com/rust-random/rand/commit/dbbc1bf3176138c867f3d84c0c4d288119a5a84e"><code>dbbc1bf</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1218">#1218</a> from Will-Low/master</li> <li><a href="https://github.com/rust-random/rand/commit/9f20df04d88698c38515833d6db62d7eb50d8b80"><code>9f20df0</code></a> Making distributions comparable by deriving PartialEq. Tests included</li> <li><a href="https://github.com/rust-random/rand/commit/a407bdfa4563d0cfbf744049242926c8de079d3f"><code>a407bdf</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1216">#1216</a> from rust-random/work5</li> <li><a href="https://github.com/rust-random/rand/commit/d3ca11b0bcc1f42fe34ba4f90f99509b7eb4ff18"><code>d3ca11b</code></a> Update to packed_simd_2 0.3.7</li> <li><a href="https://github.com/rust-random/rand/commit/fa04c15d0bb5842fdbdbb73d7a53ead36f3fcf52"><code>fa04c15</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1215">#1215</a> from Lantern-chat/master</li> <li><a href="https://github.com/rust-random/rand/commit/73f8ffd16379390e624ac53cd6882dd679dd9a6f"><code>73f8ffd</code></a> Remove unused <code>slice_partition_at_index</code> feature</li> <li><a href="https://github.com/rust-random/rand/commit/8f372500f05dfadcff6c35e773e81029ab7debad"><code>8f37250</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1208">#1208</a> from newpavlov/rand_distr/fix_no_std</li> <li><a href="https://github.com/rust-random/rand/commit/9ef737ba5b814f6ab36cebafb59ad29885d68a05"><code>9ef737b</code></a> update changelog</li> <li>Additional commits viewable in <a href="https://github.com/rust-random/rand/compare/0.8.4...0.8.5">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rand&package-manager=cargo&previous-version=0.8.4&new-version=0.8.5)](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
rand = "0.8.5"
num-traits.workspace = true
regress.workspace = true
rustc-hash = { workspace = true, features = ["std"] }
num-bigint = { workspace = true, features = ["serde"] }
Bump num-integer from 0.1.44 to 0.1.45 (#2053) Bumps [num-integer](https://github.com/rust-num/num-integer) from 0.1.44 to 0.1.45. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/rust-num/num-integer/blob/master/RELEASES.md">num-integer's changelog</a>.</em></p> <blockquote> <h1>Release 0.1.45 (2022-04-29)</h1> <ul> <li><a href="https://github-redirect.dependabot.com/rust-num/num-integer/pull/45"><code>Integer::next_multiple_of</code> and <code>prev_multiple_of</code> no longer overflow -1</a>.</li> <li><a href="https://github-redirect.dependabot.com/rust-num/num-integer/pull/47"><code>Integer::is_multiple_of</code> now handles a 0 argument without panicking</a> for primitive integers.</li> <li><a href="https://github-redirect.dependabot.com/rust-num/num-integer/pull/46"><code>ExtendedGcd</code> no longer has any private fields</a>, making it possible for external implementations to customize <code>Integer::extended_gcd</code>.</li> </ul> <p><strong>Contributors</strong>: <a href="https://github.com/ciphergoth"><code>@​ciphergoth</code></a>, <a href="https://github.com/cuviper"><code>@​cuviper</code></a>, <a href="https://github.com/tspiteri"><code>@​tspiteri</code></a>, <a href="https://github.com/WizardOfMenlo"><code>@​WizardOfMenlo</code></a></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/rust-num/num-integer/commit/683903c79f21b196f4ee3a19e7cf0151021cc6c3"><code>683903c</code></a> Add more changes to 0.1.45</li> <li><a href="https://github.com/rust-num/num-integer/commit/42c22de556a1ec86be5147bc641aa8d996abd4bf"><code>42c22de</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-num/num-integer/issues/47">#47</a></li> <li><a href="https://github.com/rust-num/num-integer/commit/dee9a82166ecada5d54857bf92f4e0ecd40d277a"><code>dee9a82</code></a> Release 0.1.45</li> <li><a href="https://github.com/rust-num/num-integer/commit/4ebb39d28f13f7c2ec5cc4990c19f403ce370c86"><code>4ebb39d</code></a> cargo fmt</li> <li><a href="https://github.com/rust-num/num-integer/commit/1656a2fd143a25312f3386b0ec0946e50a9406d0"><code>1656a2f</code></a> Added a fex negative tests</li> <li><a href="https://github.com/rust-num/num-integer/commit/a7d40a121bd832106b4b7e67a6dc349df04abaa8"><code>a7d40a1</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-num/num-integer/issues/45">#45</a></li> <li><a href="https://github.com/rust-num/num-integer/commit/d839ba577a05d1b950e1a00642d1fbec0828f074"><code>d839ba5</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-num/num-integer/issues/46">#46</a></li> <li><a href="https://github.com/rust-num/num-integer/commit/7a8397f00d45c86d4744e544a6c9ab04111cd1f0"><code>7a8397f</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-num/num-integer/issues/50">#50</a></li> <li><a href="https://github.com/rust-num/num-integer/commit/bba8f3d6b344be6d5e8bc6d5d7c7a164df482c38"><code>bba8f3d</code></a> Correct documentation for gcd</li> <li><a href="https://github.com/rust-num/num-integer/commit/41480951c5e1d0cf104b5642ba11b181900b3df2"><code>4148095</code></a> Fixed is multiple of</li> <li>Additional commits viewable in <a href="https://github.com/rust-num/num-integer/compare/num-integer-0.1.44...num-integer-0.1.45">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=num-integer&package-manager=cargo&previous-version=0.1.44&new-version=0.1.45)](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-integer = "0.1.45"
bitflags.workspace = true
indexmap.workspace = true
Bump ryu-js from 0.2.1 to 0.2.2 (#1751) Bumps [ryu-js](https://github.com/boa-dev/ryu-js) from 0.2.1 to 0.2.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/boa-dev/ryu-js/releases">ryu-js's releases</a>.</em></p> <blockquote> <h2>v0.2.2</h2> <p>See <code>CHANGELOG.md</code>!</p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/boa-dev/ryu-js/blob/master/CHANGELOG.md">ryu-js's changelog</a>.</em></p> <blockquote> <h1><a href="https://github.com/boa-dev/ryu-js/compare/v0.2.1...v0.2.2"># 0.2.2 (2020-12-16)</a></h1> <p>Internal improvements:</p> <ul> <li>[INTERNAL <a href="https://github-redirect.dependabot.com/boa-dev/ryu-js/issues/17">#17</a>](<a href="https://github-redirect.dependabot.com/boa-dev/ryu-js/pull/17">boa-dev/ryu-js#17</a>) Sync to <code>dtolnay/ryu</code> master</li> <li>[INTERNAL <a href="https://github-redirect.dependabot.com/boa-dev/ryu-js/issues/16">#16</a>](<a href="https://github-redirect.dependabot.com/boa-dev/ryu-js/pull/16">boa-dev/ryu-js#16</a>) Sync to <code>dtolnay/ryu</code> master</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/boa-dev/ryu-js/commit/727f1e2cec9e3be61a2143c6fd46ab37aa76a8b2"><code>727f1e2</code></a> Bump version 0.2.1 -&gt; 0.2.2 (<a href="https://github-redirect.dependabot.com/boa-dev/ryu-js/issues/18">#18</a>)</li> <li><a href="https://github.com/boa-dev/ryu-js/commit/7b91c0ea609fa1ad25016b1e210b08e72acb8072"><code>7b91c0e</code></a> Sync to <code>dtolnay/ryu</code> master (<a href="https://github-redirect.dependabot.com/boa-dev/ryu-js/issues/17">#17</a>)</li> <li><a href="https://github.com/boa-dev/ryu-js/commit/85fecf5e68c4bcf6c43ca8e9e4833753d99770fa"><code>85fecf5</code></a> Sync to <code>dtolnay/ryu</code> master (<a href="https://github-redirect.dependabot.com/boa-dev/ryu-js/issues/16">#16</a>)</li> <li>See full diff in <a href="https://github.com/boa-dev/ryu-js/compare/v0.2.1...v0.2.2">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ryu-js&package-manager=cargo&previous-version=0.2.1&new-version=0.2.2)](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
ryu-js = "0.2.2"
chrono = { workspace = true, default-features = false, features = ["clock", "std"] }
fast-float.workspace = true
once_cell = { workspace = true, features = ["std"] }
tap = "1.0.1"
sptr = "0.3.2"
static_assertions.workspace = true
thiserror = "1.0.49"
dashmap = "5.5.3"
num_enum = "0.7.0"
pollster.workspace = true
thin-vec.workspace = true
itertools = { version = "0.11.0", default-features = false }
icu_normalizer = "~1.3.0"
# intl deps
boa_icu_provider = {workspace = true, features = ["std"], optional = true }
sys-locale = { version = "0.3.1", optional = true }
icu_provider = { workspace = true, optional = true }
icu_locid = { workspace = true, features = ["serde"], optional = true }
icu_locid_transform = { workspace = true, default-features = false, features = ["std", "serde"], optional = true }
icu_datetime = { workspace = true, default-features = false, features = ["serde", "experimental"], optional = true }
icu_calendar = { workspace = true, default-features = false, optional = true }
icu_collator = { workspace = true, default-features = false, features = ["serde"], optional = true }
icu_plurals = { workspace = true, default-features = false, features = ["serde"], optional = true }
icu_list = { workspace = true, default-features = false, features = ["serde"], optional = true }
icu_casemap = { workspace = true, default-features = false, features = ["serde"], optional = true}
icu_segmenter = { workspace = true, default-features = false, features = ["auto", "serde"], optional = true }
writeable = { workspace = true, optional = true }
yoke = { workspace = true, optional = true }
zerofrom = { workspace = true, optional = true }
fixed_decimal = { workspace = true, features = ["ryu"], optional = true}
[dev-dependencies]
criterion = "0.5.1"
float-cmp = "0.9.0"
indoc.workspace = true
textwrap.workspace = true
futures-lite = "1.13.0"
[target.x86_64-unknown-linux-gnu.dev-dependencies]
jemallocator = "0.5.4"
[lib]
crate-type = ["cdylib", "lib"]
name = "boa_engine"
bench = false
[[bench]]
name = "full"
harness = false