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.

39 lines
1010 B

[package]
name = "boa_cli"
keywords = ["javascript", "compiler", "js", "cli"]
categories = ["command-line-utilities"]
default-run = "boa"
description.workspace = true
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
[dependencies]
boa_engine = { workspace = true, features = ["deser", "flowgraph", "trace"] }
boa_ast = { workspace = true, features = ["serde"] }
boa_parser.workspace = true
Implement debug object for CLI (#2772) Currently some debugging stuff in JavaScript land is difficult to impossible, like triggering a GC collect, this is not impossible to do in JavaScript the way I triggered it was by creating a huge amount of object `for (let i = 0; i < 100000; ++i) { ({}) }` but this is cumbersome and not guaranteed to trigger a gc. This PR implements `--debug-object` flag that injects the `$boa` debug object in the context, the object is separated into modules currently `gc`, `function`, `object`. We can now do `$boa.gc.collect()`, which force triggers a GC collect. Or sometimes I wanted a trace (the current solution is great, you can trace stuff like `>>> 1 + 1` but that is also it's limitation), it traces everything, I sometimes have a scenario and just want to trace a single function in that scenario, that's why I added the `$boa.function.trace(func, this, ...args)` It only traces the function. ```js >> $boa.function.trace((a, b) => a + b, undefined, 1, 2) -------------------------Compiled Output: ''-------------------------- Location Count Opcode Operands 000000 0000 DefInitArg 0000: 'a' 000005 0001 DefInitArg 0001: 'b' 000010 0002 RestParameterPop 000011 0003 GetName 0000: 'a' 000016 0004 GetName 0001: 'b' 000021 0005 Add 000022 0006 Return 000023 0007 PushUndefined 000024 0008 Return ... (cut for brevity) ... ``` It also implements `$boa.function.flowgraph(func, options)`: ```js $boa.function.flowgraph(func, 'graphviz') $boa.function.flowgraph(func, { format: 'mermaid', direction: 'TopBottom' }) ``` Printing the object pointer: ```js $boa.object.id({}) // '0x566464F33' ``` It currently implements some functionality which we can grow it with our debugging needs since we are not restricted by a spec we can add whatever we want :) I was originally going to implement this in #2723 (but the PR is too big), for shapes having functions like: ```js $boa.shape.type({}) // Shared shape $boa.shape.id({}) // 0x8578FG355 (objects, shape pointer) $boa.shape.flowgraph({}) // printing the shape transition chain, like $boa.function.flowgraph ``` Shapes chains are very hard to debug once they are big... so having this type of debugging capability would make it much easier.
2 years ago
boa_gc.workspace = true
boa_interner.workspace = true
boa_runtime.workspace = true
rustyline = { version = "12.0.0", features = ["derive"]}
clap = { version = "4.3.10", features = ["derive"] }
serde_json = "1.0.99"
colored = "2.0.0"
regex = "1.8.4"
phf = { version = "0.11.2", features = ["macros"] }
pollster = "0.3.0"
[features]
default = ["boa_engine/annex-b", "boa_engine/intl"]
[target.x86_64-unknown-linux-gnu.dependencies]
Bump jemallocator from 0.3.2 to 0.5.0 (#2088) Bumps [jemallocator](https://github.com/tikv/jemallocator) from 0.3.2 to 0.5.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/tikv/jemallocator/releases">jemallocator's releases</a>.</em></p> <blockquote> <h2>0.4.3</h2> <ul> <li>Added riscv64 support (<a href="https://github-redirect.dependabot.com/tikv/jemallocator/issues/14">#14</a>)</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/tikv/jemallocator/blob/main/CHANGELOG.md">jemallocator's changelog</a>.</em></p> <blockquote> <h1>0.5.0 - 2022-05-19</h1> <ul> <li>Update jemalloc to 5.3.0 (<a href="https://github-redirect.dependabot.com/tikv/jemallocator/issues/23">#23</a>)</li> </ul> <h1>0.4.3 - 2022-02-21</h1> <ul> <li>Added riscv64 support (<a href="https://github-redirect.dependabot.com/tikv/jemallocator/issues/14">#14</a>)</li> </ul> <h1>0.4.2 - 2021-08-09</h1> <ul> <li>Fixed prof not working under certain condition (<a href="https://github-redirect.dependabot.com/tikv/jemallocator/issues/9">#9</a>) (<a href="https://github-redirect.dependabot.com/tikv/jemallocator/issues/12">#12</a>)</li> <li>Updated paste to 1 (<a href="https://github-redirect.dependabot.com/tikv/jemallocator/issues/11">#11</a>)</li> </ul> <h1>0.4.1 - 2020-11-16</h1> <ul> <li>Updated jemalloc to fix deadlock during initialization</li> <li>Fixed failure of generating docs on release version</li> </ul> <h1>0.4.0 - 2020-07-21</h1> <ul> <li>Forked from jemallocator master</li> <li>Upgraded jemalloc to 5.2.1 (<a href="https://github-redirect.dependabot.com/tikv/jemallocator/issues/1">#1</a>)</li> <li>Fixed wrong version in generated C header (<a href="https://github-redirect.dependabot.com/tikv/jemallocator/issues/1">#1</a>)</li> <li>Upgraded project to 2018 edition (<a href="https://github-redirect.dependabot.com/tikv/jemallocator/issues/2">#2</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/tikv/jemallocator/commits">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=jemallocator&package-manager=cargo&previous-version=0.3.2&new-version=0.5.0)](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
jemallocator = "0.5.0"
[[bin]]
name = "boa"
5 years ago
doc = false
path = "src/main.rs"