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.

145 lines
4.5 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:icu_decimal",
"dep:writeable",
"dep:sys-locale",
"dep:yoke",
"dep:zerofrom",
"dep:fixed_decimal",
"dep:tinystr",
]
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 = ["js"]
# Enable Boa's additional ECMAScript features for web browsers.
annex-b = ["boa_parser/annex-b"]
# Stage 3 proposals
temporal = ["dep:icu_calendar"]
# Enable experimental features, like Stage 3 proposals.
experimental = ["temporal"]
# Enable binding to JS APIs for system related utilities.
js = ["dep:web-time"]
[dependencies]
boa_interner.workspace = true
boa_gc = { workspace = true, features = [ "thin-vec", "icu" ] }
boa_profiler.workspace = true
boa_macros.workspace = true
boa_ast.workspace = true
boa_parser.workspace = true
boa_temporal = { 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"] }
num-integer = "0.1.46"
bitflags.workspace = true
indexmap = { workspace = true, features = ["std"] }
ryu-js = "1.0.0"
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.56"
dashmap = "5.5.3"
num_enum = "0.7.2"
pollster.workspace = true
thin-vec.workspace = true
itertools = { version = "0.12.1", default-features = false }
icu_normalizer.workspace = true
paste = "1.0"
portable-atomic = "1.6.0"
bytemuck = { version = "1.14.3", features = ["derive"] }
arrayvec = "0.7.4"
intrusive-collections = "0.9.6"
cfg-if = "1.0.0"
time.workspace = true
hashbrown.workspace = true
# 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", "experimental"], 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 }
icu_decimal = { workspace = true, default-features = false, features = ["serde"], optional = true }
writeable = { workspace = true, optional = true }
yoke = { workspace = true, optional = true }
zerofrom = { workspace = true, optional = true }
fixed_decimal = { workspace = true, features = ["ryu", "experimental"], optional = true }
tinystr = { workspace = true, optional = true }
[target.'cfg(all(target_family = "wasm", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies]
web-time = { version = "1.0.0", optional = true }
[dev-dependencies]
criterion = "0.5.1"
float-cmp = "0.9.0"
indoc.workspace = true
textwrap.workspace = true
futures-lite = "2.2.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
[lints]
workspace = true