Browse Source

Rename "Boa" to boa_engine, moved GC and profiler to their crates (#1844)

* Separated GC and Profiler

* Fixed prettierignore

* Removed re-exports, fixed benchmarks, added some caches

* Removed empty line

* Update boa_engine/Cargo.toml

Co-authored-by: raskad <32105367+raskad@users.noreply.github.com>

* Fixed the profiler

* Removed empty file

Co-authored-by: raskad <32105367+raskad@users.noreply.github.com>
pull/1857/head
Iban Eguia 3 years ago committed by GitHub
parent
commit
4d2772d6a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      .github/dependabot.yml
  2. 5
      .github/workflows/bors.yml
  3. 2
      .github/workflows/pull_request.yml
  4. 2
      .github/workflows/release.yml
  5. 5
      .github/workflows/rust.yml
  6. 2
      .github/workflows/test262.yml
  7. 2
      .github/workflows/webassembly.yml
  8. 4
      .prettierignore
  9. 87
      Cargo.lock
  10. 8
      Cargo.toml
  11. 10
      boa/src/gc.rs
  12. 26
      boa_cli/Cargo.toml
  13. 5
      boa_cli/src/main.rs
  14. 40
      boa_engine/Cargo.toml
  15. 0
      boa_engine/benches/README.md
  16. 0
      boa_engine/benches/bench_scripts/arithmetic_operations.js
  17. 0
      boa_engine/benches/bench_scripts/array_access.js
  18. 0
      boa_engine/benches/bench_scripts/array_create.js
  19. 0
      boa_engine/benches/bench_scripts/array_pop.js
  20. 0
      boa_engine/benches/bench_scripts/boolean_object_access.js
  21. 0
      boa_engine/benches/bench_scripts/clean_js.js
  22. 0
      boa_engine/benches/bench_scripts/fibonacci.js
  23. 0
      boa_engine/benches/bench_scripts/for_loop.js
  24. 0
      boa_engine/benches/bench_scripts/mini_js.js
  25. 0
      boa_engine/benches/bench_scripts/number_object_access.js
  26. 0
      boa_engine/benches/bench_scripts/object_creation.js
  27. 0
      boa_engine/benches/bench_scripts/object_prop_access_const.js
  28. 0
      boa_engine/benches/bench_scripts/object_prop_access_dyn.js
  29. 0
      boa_engine/benches/bench_scripts/regexp.js
  30. 0
      boa_engine/benches/bench_scripts/regexp_creation.js
  31. 0
      boa_engine/benches/bench_scripts/regexp_literal.js
  32. 0
      boa_engine/benches/bench_scripts/regexp_literal_creation.js
  33. 0
      boa_engine/benches/bench_scripts/string_compare.js
  34. 0
      boa_engine/benches/bench_scripts/string_concat.js
  35. 0
      boa_engine/benches/bench_scripts/string_copy.js
  36. 0
      boa_engine/benches/bench_scripts/string_object_access.js
  37. 0
      boa_engine/benches/bench_scripts/symbol_creation.js
  38. 2
      boa_engine/benches/full.rs
  39. 4
      boa_engine/examples/classes.rs
  40. 4
      boa_engine/examples/closures.rs
  41. 2
      boa_engine/examples/jsarray.rs
  42. 18
      boa_engine/src/bigint.rs
  43. 7
      boa_engine/src/builtins/array/array_iterator.rs
  44. 9
      boa_engine/src/builtins/array/mod.rs
  45. 0
      boa_engine/src/builtins/array/tests.rs
  46. 7
      boa_engine/src/builtins/array_buffer/mod.rs
  47. 0
      boa_engine/src/builtins/array_buffer/tests.rs
  48. 5
      boa_engine/src/builtins/bigint/mod.rs
  49. 0
      boa_engine/src/builtins/bigint/tests.rs
  50. 5
      boa_engine/src/builtins/boolean/mod.rs
  51. 0
      boa_engine/src/builtins/boolean/tests.rs
  52. 5
      boa_engine/src/builtins/console/mod.rs
  53. 0
      boa_engine/src/builtins/console/tests.rs
  54. 2
      boa_engine/src/builtins/dataview/mod.rs
  55. 12
      boa_engine/src/builtins/date/mod.rs
  56. 0
      boa_engine/src/builtins/date/tests.rs
  57. 13
      boa_engine/src/builtins/error/eval.rs
  58. 4
      boa_engine/src/builtins/error/mod.rs
  59. 4
      boa_engine/src/builtins/error/range.rs
  60. 4
      boa_engine/src/builtins/error/reference.rs
  61. 4
      boa_engine/src/builtins/error/syntax.rs
  62. 0
      boa_engine/src/builtins/error/tests.rs
  63. 5
      boa_engine/src/builtins/error/type.rs
  64. 4
      boa_engine/src/builtins/error/uri.rs
  65. 3
      boa_engine/src/builtins/function/arguments.rs
  66. 17
      boa_engine/src/builtins/function/mod.rs
  67. 0
      boa_engine/src/builtins/function/tests.rs
  68. 5
      boa_engine/src/builtins/global_this/mod.rs
  69. 0
      boa_engine/src/builtins/global_this/tests.rs
  70. 5
      boa_engine/src/builtins/infinity/mod.rs
  71. 0
      boa_engine/src/builtins/infinity/tests.rs
  72. 8
      boa_engine/src/builtins/intl/mod.rs
  73. 0
      boa_engine/src/builtins/intrinsics.rs
  74. 5
      boa_engine/src/builtins/iterable/mod.rs
  75. 8
      boa_engine/src/builtins/json/mod.rs
  76. 0
      boa_engine/src/builtins/json/tests.rs
  77. 7
      boa_engine/src/builtins/map/map_iterator.rs
  78. 14
      boa_engine/src/builtins/map/mod.rs
  79. 7
      boa_engine/src/builtins/map/ordered_map.rs
  80. 0
      boa_engine/src/builtins/map/tests.rs
  81. 8
      boa_engine/src/builtins/math/mod.rs
  82. 0
      boa_engine/src/builtins/math/tests.rs
  83. 0
      boa_engine/src/builtins/mod.rs
  84. 5
      boa_engine/src/builtins/nan/mod.rs
  85. 0
      boa_engine/src/builtins/nan/tests.rs
  86. 0
      boa_engine/src/builtins/number/conversions.rs
  87. 5
      boa_engine/src/builtins/number/mod.rs
  88. 0
      boa_engine/src/builtins/number/tests.rs
  89. 7
      boa_engine/src/builtins/object/for_in_iterator.rs
  90. 8
      boa_engine/src/builtins/object/mod.rs
  91. 0
      boa_engine/src/builtins/object/tests.rs
  92. 7
      boa_engine/src/builtins/proxy/mod.rs
  93. 8
      boa_engine/src/builtins/reflect/mod.rs
  94. 0
      boa_engine/src/builtins/reflect/tests.rs
  95. 17
      boa_engine/src/builtins/regexp/mod.rs
  96. 10
      boa_engine/src/builtins/regexp/regexp_string_iterator.rs
  97. 0
      boa_engine/src/builtins/regexp/tests.rs
  98. 14
      boa_engine/src/builtins/set/mod.rs
  99. 2
      boa_engine/src/builtins/set/ordered_set.rs
  100. 7
      boa_engine/src/builtins/set/set_iterator.rs
  101. Some files were not shown because too many files have changed in this diff Show More

22
.github/dependabot.yml

@ -13,15 +13,23 @@ updates:
schedule: schedule:
interval: daily interval: daily
- package-ecosystem: cargo - package-ecosystem: cargo
directory: /boa/ directory: /boa_cli/
schedule: schedule:
interval: daily interval: daily
- package-ecosystem: cargo - package-ecosystem: cargo
directory: /boa_cli/ directory: /boa_engine/
schedule: schedule:
interval: daily interval: daily
- package-ecosystem: cargo - package-ecosystem: cargo
directory: /boa_wasm/ directory: /boa_gc/
schedule:
interval: daily
- package-ecosystem: cargo
directory: /boa_interner/
schedule:
interval: daily
- package-ecosystem: cargo
directory: /boa_profiler/
schedule: schedule:
interval: daily interval: daily
- package-ecosystem: cargo - package-ecosystem: cargo
@ -29,10 +37,14 @@ updates:
schedule: schedule:
interval: daily interval: daily
- package-ecosystem: cargo - package-ecosystem: cargo
directory: /boa_interner/ directory: /boa_unicode/
schedule:
interval: daily
- package-ecosystem: cargo
directory: /boa_wasm/
schedule: schedule:
interval: daily interval: daily
- package-ecosystem: gitsubmodule - package-ecosystem: gitsubmodule
directory: /test262/ directory: /
schedule: schedule:
interval: weekly interval: weekly

5
.github/workflows/bors.yml

@ -43,7 +43,10 @@ jobs:
- name: Cache cargo - name: Cache cargo
uses: actions/cache@v2.1.7 uses: actions/cache@v2.1.7
with: with:
path: target path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:

2
.github/workflows/pull_request.yml

@ -25,4 +25,4 @@ jobs:
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
branchName: ${{ github.base_ref }} branchName: ${{ github.base_ref }}
cwd: ./boa cwd: ./boa_engine

2
.github/workflows/release.yml

@ -39,6 +39,8 @@ jobs:
node_modules node_modules
target target
boa_wasm/pkg boa_wasm/pkg
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-yarn-build-target-${{ hashFiles('**/yarn.lock') }} key: ${{ runner.os }}-yarn-build-target-${{ hashFiles('**/yarn.lock') }}
- uses: Borales/actions-yarn@v2.3.0 - uses: Borales/actions-yarn@v2.3.0
with: with:

5
.github/workflows/rust.yml

@ -47,7 +47,10 @@ jobs:
- name: Cache cargo - name: Cache cargo
uses: actions/cache@v2.1.7 uses: actions/cache@v2.1.7
with: with:
path: target path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:

2
.github/workflows/test262.yml

@ -29,7 +29,7 @@ jobs:
uses: actions/cache@v2.1.7 uses: actions/cache@v2.1.7
with: with:
path: | path: |
./boa/target target
~/.cargo/git ~/.cargo/git
~/.cargo/registry ~/.cargo/registry
key: ${{ runner.os }}-cargo-test262-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-test262-${{ hashFiles('**/Cargo.lock') }}

2
.github/workflows/webassembly.yml

@ -38,6 +38,8 @@ jobs:
path: | path: |
node_modules node_modules
target target
~/.cargo/git
~/.cargo/registry
boa_wasm/pkg boa_wasm/pkg
key: ${{ runner.os }}-yarn-build-target-${{ hashFiles('**/yarn.lock') }} key: ${{ runner.os }}-yarn-build-target-${{ hashFiles('**/yarn.lock') }}
- uses: Borales/actions-yarn@v2.3.0 - uses: Borales/actions-yarn@v2.3.0

4
.prettierignore

@ -2,8 +2,8 @@
*.rs *.rs
target target
node_modules node_modules
boa/benches/bench_scripts/mini_js.js boa_engine/benches/bench_scripts/mini_js.js
boa/benches/bench_scripts/clean_js.js boa_engine/benches/bench_scripts/clean_js.js
boa_wasm/pkg boa_wasm/pkg
dist dist
test262 test262

87
Cargo.lock generated

@ -2,35 +2,6 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "Boa"
version = "0.13.0"
dependencies = [
"bitflags",
"boa_interner",
"boa_unicode",
"chrono",
"criterion",
"dyn-clone",
"fast-float",
"float-cmp",
"gc",
"indexmap",
"jemallocator",
"measureme",
"num-bigint",
"num-integer",
"num-traits",
"once_cell",
"rand",
"regress",
"rustc-hash",
"ryu-js",
"serde",
"serde_json",
"unicode-normalization",
]
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.7.6" version = "0.7.6"
@ -96,7 +67,8 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
name = "boa_cli" name = "boa_cli"
version = "0.13.0" version = "0.13.0"
dependencies = [ dependencies = [
"Boa", "boa_engine",
"boa_interner",
"colored", "colored",
"jemallocator", "jemallocator",
"phf", "phf",
@ -107,6 +79,44 @@ dependencies = [
"structopt", "structopt",
] ]
[[package]]
name = "boa_engine"
version = "0.13.0"
dependencies = [
"bitflags",
"boa_gc",
"boa_interner",
"boa_profiler",
"boa_unicode",
"chrono",
"criterion",
"dyn-clone",
"fast-float",
"float-cmp",
"gc",
"indexmap",
"jemallocator",
"num-bigint",
"num-integer",
"num-traits",
"once_cell",
"rand",
"regress",
"rustc-hash",
"ryu-js",
"serde",
"serde_json",
"unicode-normalization",
]
[[package]]
name = "boa_gc"
version = "0.13.0"
dependencies = [
"gc",
"measureme",
]
[[package]] [[package]]
name = "boa_interner" name = "boa_interner"
version = "0.13.0" version = "0.13.0"
@ -116,12 +126,21 @@ dependencies = [
"string-interner", "string-interner",
] ]
[[package]]
name = "boa_profiler"
version = "0.13.0"
dependencies = [
"measureme",
"once_cell",
]
[[package]] [[package]]
name = "boa_tester" name = "boa_tester"
version = "0.13.0" version = "0.13.0"
dependencies = [ dependencies = [
"Boa",
"bitflags", "bitflags",
"boa_engine",
"boa_interner",
"colored", "colored",
"fxhash", "fxhash",
"gc", "gc",
@ -148,7 +167,7 @@ dependencies = [
name = "boa_wasm" name = "boa_wasm"
version = "0.13.0" version = "0.13.0"
dependencies = [ dependencies = [
"Boa", "boa_engine",
"getrandom", "getrandom",
"wasm-bindgen", "wasm-bindgen",
] ]
@ -669,9 +688,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.118" version = "0.2.119"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06e509672465a0504304aa87f9f176f2b2b716ed8fb105ebe5c02dc6dce96a94" checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
[[package]] [[package]]
name = "libgit2-sys" name = "libgit2-sys"

8
Cargo.toml

@ -1,11 +1,13 @@
[workspace] [workspace]
members = [ members = [
"boa",
"boa_cli", "boa_cli",
"boa_wasm", "boa_engine",
"boa_gc",
"boa_interner",
"boa_profiler",
"boa_tester", "boa_tester",
"boa_unicode", "boa_unicode",
"boa_interner", "boa_wasm",
] ]
# The release profile, used for `cargo build --release`. # The release profile, used for `cargo build --release`.

10
boa/src/gc.rs

@ -1,10 +0,0 @@
//! This module represents the main way to interact with the garbage collector.
// This is because `rust-gc` unsafe_empty_trace has a `unsafe_`
// when it should be `empty_trace`.
#![allow(clippy::unsafe_removed_from_name)]
pub use gc::{
custom_trace, force_collect, unsafe_empty_trace as empty_trace, Finalize, Gc, GcCell as Cell,
GcCellRef as Ref, GcCellRefMut as RefMut, Trace,
};

26
boa_cli/Cargo.toml

@ -1,19 +1,37 @@
[package] [package]
name = "boa_cli" name = "boa_cli"
version = "0.13.0" version = "0.13.0"
edition = "2021"
rust-version = "1.58"
authors = ["boa-dev"] authors = ["boa-dev"]
description = "Boa is a Javascript lexer, parser and Just-in-Time compiler written in Rust. Currently, it has support for some of the language." description = "Boa is a Javascript lexer, parser and Just-in-Time compiler written in Rust. Currently, it has support for some of the language."
repository = "https://github.com/boa-dev/boa" repository = "https://github.com/boa-dev/boa"
keywords = ["javascript", "compiler", "lexer", "parser", "js", "cli"] keywords = ["javascript", "compiler", "lexer", "parser", "js", "cli"]
categories = ["command-line-utilities"] categories = ["command-line-utilities"]
license = "Unlicense/MIT" license = "Unlicense/MIT"
exclude = ["../.vscode/*", "../Dockerfile", "../Makefile", "../.editorConfig"]
edition = "2021"
rust-version = "1.58"
default-run = "boa" default-run = "boa"
exclude = [
"../.vscode/*",
"../.editorconfig",
"../test262/*",
"../node_modules/*",
"../target/*",
"../dist/*",
"../.github/*",
"../assets/*",
"../docs/*",
"../*.js",
"../test_ignore.txt",
"../yarn.lock",
"../package.json",
"../index.html",
"../tests/*",
"../.github/*",
]
[dependencies] [dependencies]
Boa = { path = "../boa", features = ["deser", "console"] } boa_engine = { path = "../boa_engine", features = ["deser", "console"] }
boa_interner = { path = "../boa_interner" }
rustyline = "9.1.2" rustyline = "9.1.2"
rustyline-derive = "0.6.0" rustyline-derive = "0.6.0"
structopt = "0.3.26" structopt = "0.3.26"

5
boa_cli/src/main.rs

@ -59,7 +59,8 @@
rustdoc::missing_doc_code_examples rustdoc::missing_doc_code_examples
)] )]
use boa::{syntax::ast::node::StatementList, Context, Interner}; use boa_engine::{syntax::ast::node::StatementList, Context};
use boa_interner::Interner;
use colored::{Color, Colorize}; use colored::{Color, Colorize};
use rustyline::{config::Config, error::ReadlineError, EditMode, Editor}; use rustyline::{config::Config, error::ReadlineError, EditMode, Editor};
use std::{fs::read, io, path::PathBuf}; use std::{fs::read, io, path::PathBuf};
@ -146,7 +147,7 @@ fn parse_tokens<S>(src: S, interner: &mut Interner) -> Result<StatementList, Str
where where
S: AsRef<[u8]>, S: AsRef<[u8]>,
{ {
use boa::syntax::parser::Parser; use boa_engine::syntax::parser::Parser;
let src_bytes = src.as_ref(); let src_bytes = src.as_ref();
Parser::new(src_bytes, false) Parser::new(src_bytes, false)

40
boa/Cargo.toml → boa_engine/Cargo.toml

@ -1,18 +1,35 @@
[package] [package]
name = "Boa" name = "boa_engine"
version = "0.13.0" version = "0.13.0"
edition = "2021"
rust-version = "1.58"
authors = ["boa-dev"] authors = ["boa-dev"]
description = "Boa is a Javascript lexer, parser and Just-in-Time compiler written in Rust. Currently, it has support for some of the language." description = "Boa is a Javascript lexer, parser and Just-in-Time compiler written in Rust. Currently, it has support for some of the language."
repository = "https://github.com/boa-dev/boa" repository = "https://github.com/boa-dev/boa"
keywords = ["javascript", "compiler", "lexer", "parser", "js"] keywords = ["javascript", "js", "compiler", "lexer", "parser"]
categories = ["parser-implementations", "wasm"] categories = ["parser-implementations", "compilers"]
license = "Unlicense/MIT" license = "Unlicense/MIT"
exclude = ["../.vscode/*", "../Dockerfile", "../Makefile", "../.editorConfig"] exclude = [
edition = "2021" "../.vscode/*",
rust-version = "1.58" "../.editorconfig",
"../test262/*",
"../node_modules/*",
"../target/*",
"../dist/*",
"../.github/*",
"../assets/*",
"../docs/*",
"../*.js",
"../test_ignore.txt",
"../yarn.lock",
"../package.json",
"../index.html",
"../tests/*",
"../.github/*",
]
[features] [features]
profiler = ["measureme"] profiler = ["boa_profiler/profiler"]
deser = ["boa_interner/serde"] deser = ["boa_interner/serde"]
# Enable Boa's WHATWG console object implementation. # Enable Boa's WHATWG console object implementation.
@ -21,7 +38,9 @@ console = []
[dependencies] [dependencies]
boa_unicode = { path = "../boa_unicode", version = "0.13.0" } boa_unicode = { path = "../boa_unicode", version = "0.13.0" }
boa_interner = { path = "../boa_interner", version = "0.13.0" } boa_interner = { path = "../boa_interner", version = "0.13.0" }
gc = { version = "0.4.1", features = ["derive"] } boa_gc = { path = "../boa_gc", version = "0.13.0" }
gc = { version = "0.4.1" }
boa_profiler = { path = "../boa_profiler", version = "0.13.0" }
serde = { version = "1.0.136", features = ["derive", "rc"] } serde = { version = "1.0.136", features = ["derive", "rc"] }
serde_json = "1.0.79" serde_json = "1.0.79"
rand = "0.8.5" rand = "0.8.5"
@ -39,9 +58,6 @@ unicode-normalization = "0.1.19"
dyn-clone = "1.0.4" dyn-clone = "1.0.4"
once_cell = "1.9.0" once_cell = "1.9.0"
# Optional Dependencies
measureme = { version = "10.0.0", optional = true }
[dev-dependencies] [dev-dependencies]
criterion = "0.3.5" criterion = "0.3.5"
float-cmp = "0.9.0" float-cmp = "0.9.0"
@ -51,7 +67,7 @@ jemallocator = "0.3.2"
[lib] [lib]
crate-type = ["cdylib", "lib"] crate-type = ["cdylib", "lib"]
name = "boa" name = "boa_engine"
bench = false bench = false
[[bench]] [[bench]]

0
boa/benches/README.md → boa_engine/benches/README.md

0
boa/benches/bench_scripts/arithmetic_operations.js → boa_engine/benches/bench_scripts/arithmetic_operations.js

0
boa/benches/bench_scripts/array_access.js → boa_engine/benches/bench_scripts/array_access.js

0
boa/benches/bench_scripts/array_create.js → boa_engine/benches/bench_scripts/array_create.js

0
boa/benches/bench_scripts/array_pop.js → boa_engine/benches/bench_scripts/array_pop.js

0
boa/benches/bench_scripts/boolean_object_access.js → boa_engine/benches/bench_scripts/boolean_object_access.js

0
boa/benches/bench_scripts/clean_js.js → boa_engine/benches/bench_scripts/clean_js.js

0
boa/benches/bench_scripts/fibonacci.js → boa_engine/benches/bench_scripts/fibonacci.js

0
boa/benches/bench_scripts/for_loop.js → boa_engine/benches/bench_scripts/for_loop.js

0
boa/benches/bench_scripts/mini_js.js → boa_engine/benches/bench_scripts/mini_js.js

0
boa/benches/bench_scripts/number_object_access.js → boa_engine/benches/bench_scripts/number_object_access.js

0
boa/benches/bench_scripts/object_creation.js → boa_engine/benches/bench_scripts/object_creation.js

0
boa/benches/bench_scripts/object_prop_access_const.js → boa_engine/benches/bench_scripts/object_prop_access_const.js

0
boa/benches/bench_scripts/object_prop_access_dyn.js → boa_engine/benches/bench_scripts/object_prop_access_dyn.js

0
boa/benches/bench_scripts/regexp.js → boa_engine/benches/bench_scripts/regexp.js

0
boa/benches/bench_scripts/regexp_creation.js → boa_engine/benches/bench_scripts/regexp_creation.js

0
boa/benches/bench_scripts/regexp_literal.js → boa_engine/benches/bench_scripts/regexp_literal.js

0
boa/benches/bench_scripts/regexp_literal_creation.js → boa_engine/benches/bench_scripts/regexp_literal_creation.js

0
boa/benches/bench_scripts/string_compare.js → boa_engine/benches/bench_scripts/string_compare.js

0
boa/benches/bench_scripts/string_concat.js → boa_engine/benches/bench_scripts/string_concat.js

0
boa/benches/bench_scripts/string_copy.js → boa_engine/benches/bench_scripts/string_copy.js

0
boa/benches/bench_scripts/string_object_access.js → boa_engine/benches/bench_scripts/string_object_access.js

0
boa/benches/bench_scripts/symbol_creation.js → boa_engine/benches/bench_scripts/symbol_creation.js

2
boa/benches/full.rs → boa_engine/benches/full.rs

@ -1,6 +1,6 @@
//! Benchmarks of the whole execution engine in Boa. //! Benchmarks of the whole execution engine in Boa.
use boa::{realm::Realm, Context}; use boa_engine::{realm::Realm, Context};
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use criterion::{black_box, criterion_group, criterion_main, Criterion};
#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))] #[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]

4
boa/examples/classes.rs → boa_engine/examples/classes.rs

@ -1,11 +1,11 @@
// NOTE: this example requires the `console` feature to run correctly. // NOTE: this example requires the `console` feature to run correctly.
use boa::{ use boa_engine::{
class::{Class, ClassBuilder}, class::{Class, ClassBuilder},
gc::{Finalize, Trace},
property::Attribute, property::Attribute,
Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_gc::{Finalize, Trace};
// We create a new struct that is going to represent a person. // We create a new struct that is going to represent a person.
// //

4
boa/examples/closures.rs → boa_engine/examples/closures.rs

@ -1,12 +1,12 @@
// This example goes into the details on how to pass closures as functions // This example goes into the details on how to pass closures as functions
// inside Rust and call them from Javascript. // inside Rust and call them from Javascript.
use boa::{ use boa_engine::{
gc::{Finalize, Trace},
object::{FunctionBuilder, JsObject}, object::{FunctionBuilder, JsObject},
property::{Attribute, PropertyDescriptor}, property::{Attribute, PropertyDescriptor},
Context, JsString, JsValue, Context, JsString, JsValue,
}; };
use boa_gc::{Finalize, Trace};
fn main() -> Result<(), JsValue> { fn main() -> Result<(), JsValue> {
// We create a new `Context` to create a new Javascript executor. // We create a new `Context` to create a new Javascript executor.

2
boa/examples/jsarray.rs → boa_engine/examples/jsarray.rs

@ -1,4 +1,4 @@
use boa::{ use boa_engine::{
object::{FunctionBuilder, JsArray}, object::{FunctionBuilder, JsArray},
Context, JsValue, Context, JsValue,
}; };

18
boa/src/bigint.rs → boa_engine/src/bigint.rs

@ -1,22 +1,16 @@
//! This module implements the JavaScript bigint primitive rust type. //! This module implements the JavaScript bigint primitive rust type.
use crate::{ use crate::{builtins::Number, Context, JsValue};
builtins::Number, use boa_gc::{unsafe_empty_trace, Finalize, Trace};
gc::{empty_trace, Finalize, Trace}, use num_integer::Integer;
Context, JsValue, use num_traits::pow::Pow;
}; use num_traits::{FromPrimitive, One, ToPrimitive, Zero};
use std::{ use std::{
convert::TryFrom,
fmt::{self, Display}, fmt::{self, Display},
ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub}, ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub},
rc::Rc, rc::Rc,
}; };
use num_integer::Integer;
use num_traits::pow::Pow;
use num_traits::{FromPrimitive, One, ToPrimitive, Zero};
/// The raw bigint type. /// The raw bigint type.
pub type RawBigInt = num_bigint::BigInt; pub type RawBigInt = num_bigint::BigInt;
@ -33,7 +27,7 @@ pub struct JsBigInt {
// Safety: BigInt does not contain any objects which needs to be traced, // Safety: BigInt does not contain any objects which needs to be traced,
// so this is safe. // so this is safe.
unsafe impl Trace for JsBigInt { unsafe impl Trace for JsBigInt {
empty_trace!(); unsafe_empty_trace!();
} }
impl JsBigInt { impl JsBigInt {

7
boa/src/builtins/array/array_iterator.rs → boa_engine/src/builtins/array/array_iterator.rs

@ -1,11 +1,12 @@
use crate::{ use crate::{
builtins::{function::make_builtin_fn, iterable::create_iter_result_object, Array, JsValue}, builtins::{function::make_builtin_fn, iterable::create_iter_result_object, Array, JsValue},
gc::{Finalize, Trace},
object::{JsObject, ObjectData}, object::{JsObject, ObjectData},
property::{PropertyDescriptor, PropertyNameKind}, property::{PropertyDescriptor, PropertyNameKind},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, Context, JsResult,
}; };
use boa_gc::{Finalize, Trace};
use boa_profiler::Profiler;
/// The Array Iterator object represents an iteration over an array. It implements the iterator protocol. /// The Array Iterator object represents an iteration over an array. It implements the iterator protocol.
/// ///
@ -121,7 +122,7 @@ impl ArrayIterator {
iterator_prototype: JsObject, iterator_prototype: JsObject,
context: &mut Context, context: &mut Context,
) -> JsObject { ) -> JsObject {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
// Create prototype // Create prototype
let array_iterator = let array_iterator =

9
boa/src/builtins/array/mod.rs → boa_engine/src/builtins/array/mod.rs

@ -13,6 +13,9 @@ pub mod array_iterator;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
use boa_profiler::Profiler;
use super::JsArgs;
use crate::{ use crate::{
builtins::array::array_iterator::ArrayIterator, builtins::array::array_iterator::ArrayIterator,
builtins::BuiltIn, builtins::BuiltIn,
@ -25,12 +28,10 @@ use crate::{
property::{Attribute, PropertyDescriptor, PropertyNameKind}, property::{Attribute, PropertyDescriptor, PropertyNameKind},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
value::{IntegerOrInfinity, JsValue}, value::{IntegerOrInfinity, JsValue},
BoaProfiler, Context, JsResult, JsString, Context, JsResult, JsString,
}; };
use std::cmp::{max, min, Ordering}; use std::cmp::{max, min, Ordering};
use super::JsArgs;
/// JavaScript `Array` built-in implementation. /// JavaScript `Array` built-in implementation.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub(crate) struct Array; pub(crate) struct Array;
@ -43,7 +44,7 @@ impl BuiltIn for Array {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let symbol_iterator = WellKnownSymbols::iterator(); let symbol_iterator = WellKnownSymbols::iterator();

0
boa/src/builtins/array/tests.rs → boa_engine/src/builtins/array/tests.rs

7
boa/src/builtins/array_buffer/mod.rs → boa_engine/src/builtins/array_buffer/mod.rs

@ -4,19 +4,18 @@ mod tests;
use crate::{ use crate::{
builtins::{typed_array::TypedArrayName, BuiltIn, JsArgs}, builtins::{typed_array::TypedArrayName, BuiltIn, JsArgs},
context::StandardObjects, context::StandardObjects,
gc::{Finalize, Trace},
object::{ object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, FunctionBuilder, internal_methods::get_prototype_from_constructor, ConstructorBuilder, FunctionBuilder,
JsObject, ObjectData, JsObject, ObjectData,
}, },
profiler::BoaProfiler,
property::Attribute, property::Attribute,
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
value::{IntegerOrInfinity, Numeric}, value::{IntegerOrInfinity, Numeric},
Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_gc::{Finalize, Trace};
use boa_profiler::Profiler;
use num_traits::{Signed, ToPrimitive}; use num_traits::{Signed, ToPrimitive};
use std::convert::TryInto;
#[derive(Debug, Clone, Trace, Finalize)] #[derive(Debug, Clone, Trace, Finalize)]
pub struct ArrayBuffer { pub struct ArrayBuffer {
@ -39,7 +38,7 @@ impl BuiltIn for ArrayBuffer {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let get_species = FunctionBuilder::native(context, Self::get_species) let get_species = FunctionBuilder::native(context, Self::get_species)
.name("get [Symbol.species]") .name("get [Symbol.species]")

0
boa/src/builtins/array_buffer/tests.rs → boa_engine/src/builtins/array_buffer/tests.rs

5
boa/src/builtins/bigint/mod.rs → boa_engine/src/builtins/bigint/mod.rs

@ -18,8 +18,9 @@ use crate::{
property::Attribute, property::Attribute,
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
value::{IntegerOrInfinity, PreferredType}, value::{IntegerOrInfinity, PreferredType},
BoaProfiler, Context, JsBigInt, JsResult, JsValue, Context, JsBigInt, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
use num_bigint::ToBigInt; use num_bigint::ToBigInt;
#[cfg(test)] #[cfg(test)]
@ -37,7 +38,7 @@ impl BuiltIn for BigInt {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let to_string_tag = WellKnownSymbols::to_string_tag(); let to_string_tag = WellKnownSymbols::to_string_tag();

0
boa/src/builtins/bigint/tests.rs → boa_engine/src/builtins/bigint/tests.rs

5
boa/src/builtins/boolean/mod.rs → boa_engine/src/builtins/boolean/mod.rs

@ -19,8 +19,9 @@ use crate::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData, internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData,
}, },
property::Attribute, property::Attribute,
BoaProfiler, Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
/// Boolean implementation. /// Boolean implementation.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
@ -35,7 +36,7 @@ impl BuiltIn for Boolean {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let boolean_object = ConstructorBuilder::with_standard_object( let boolean_object = ConstructorBuilder::with_standard_object(
context, context,

0
boa/src/builtins/boolean/tests.rs → boa_engine/src/builtins/boolean/tests.rs

5
boa/src/builtins/console/mod.rs → boa_engine/src/builtins/console/mod.rs

@ -21,8 +21,9 @@ use crate::{
object::ObjectInitializer, object::ObjectInitializer,
property::Attribute, property::Attribute,
value::{display::display_obj, JsValue}, value::{display::display_obj, JsValue},
BoaProfiler, Context, JsResult, JsString, Context, JsResult, JsString,
}; };
use boa_profiler::Profiler;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use std::time::SystemTime; use std::time::SystemTime;
@ -142,7 +143,7 @@ impl BuiltIn for Console {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let console = ObjectInitializer::new(context) let console = ObjectInitializer::new(context)
.function(Self::assert, "assert", 0) .function(Self::assert, "assert", 0)
.function(Self::clear, "clear", 0) .function(Self::clear, "clear", 0)

0
boa/src/builtins/console/tests.rs → boa_engine/src/builtins/console/tests.rs

2
boa/src/builtins/dataview/mod.rs → boa_engine/src/builtins/dataview/mod.rs

@ -1,7 +1,6 @@
use crate::{ use crate::{
builtins::{array_buffer::SharedMemoryOrder, typed_array::TypedArrayName, BuiltIn, JsArgs}, builtins::{array_buffer::SharedMemoryOrder, typed_array::TypedArrayName, BuiltIn, JsArgs},
context::StandardObjects, context::StandardObjects,
gc::{Finalize, Trace},
object::{ object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, FunctionBuilder, internal_methods::get_prototype_from_constructor, ConstructorBuilder, FunctionBuilder,
JsObject, ObjectData, JsObject, ObjectData,
@ -11,6 +10,7 @@ use crate::{
value::JsValue, value::JsValue,
Context, JsResult, Context, JsResult,
}; };
use boa_gc::{Finalize, Trace};
#[derive(Debug, Clone, Trace, Finalize)] #[derive(Debug, Clone, Trace, Finalize)]
pub struct DataView { pub struct DataView {

12
boa/src/builtins/date/mod.rs → boa_engine/src/builtins/date/mod.rs

@ -1,23 +1,23 @@
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
use super::JsArgs;
use crate::{ use crate::{
builtins::BuiltIn, builtins::BuiltIn,
context::StandardObjects, context::StandardObjects,
gc::{empty_trace, Finalize, Trace},
object::{ object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData, internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData,
}, },
property::Attribute, property::Attribute,
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
value::{JsValue, PreferredType}, value::{JsValue, PreferredType},
BoaProfiler, Context, JsResult, JsString, Context, JsResult, JsString,
}; };
use boa_gc::{unsafe_empty_trace, Finalize, Trace};
use boa_profiler::Profiler;
use chrono::{prelude::*, Duration, LocalResult}; use chrono::{prelude::*, Duration, LocalResult};
use std::fmt::Display; use std::fmt::Display;
use super::JsArgs;
/// The number of nanoseconds in a millisecond. /// The number of nanoseconds in a millisecond.
const NANOS_PER_MS: i64 = 1_000_000; const NANOS_PER_MS: i64 = 1_000_000;
/// The number of milliseconds in an hour. /// The number of milliseconds in an hour.
@ -76,7 +76,7 @@ impl Display for Date {
unsafe impl Trace for Date { unsafe impl Trace for Date {
// Date is a stack value, it doesn't require tracing. // Date is a stack value, it doesn't require tracing.
// only safe if `chrono` never implements `Trace` for `NaiveDateTime` // only safe if `chrono` never implements `Trace` for `NaiveDateTime`
empty_trace!(); unsafe_empty_trace!();
} }
impl Default for Date { impl Default for Date {
@ -93,7 +93,7 @@ impl BuiltIn for Date {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let date_object = ConstructorBuilder::new(context, Self::constructor) let date_object = ConstructorBuilder::new(context, Self::constructor)
.name(Self::NAME) .name(Self::NAME)

0
boa/src/builtins/date/tests.rs → boa_engine/src/builtins/date/tests.rs

13
boa/src/builtins/error/eval.rs → boa_engine/src/builtins/error/eval.rs

@ -11,17 +11,16 @@
//! [spec]: https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-evalerror //! [spec]: https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard-evalerror
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError
use crate::context::StandardObjects;
use crate::object::internal_methods::get_prototype_from_constructor;
use crate::object::JsObject;
use crate::{ use crate::{
builtins::BuiltIn, builtins::BuiltIn,
object::{ConstructorBuilder, ObjectData}, context::StandardObjects,
profiler::BoaProfiler, object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData,
},
property::Attribute, property::Attribute,
Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
/// JavaScript `EvalError` impleentation. /// JavaScript `EvalError` impleentation.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
@ -35,7 +34,7 @@ impl BuiltIn for EvalError {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let error_prototype = context.standard_objects().error_object().prototype(); let error_prototype = context.standard_objects().error_object().prototype();
let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE; let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;

4
boa/src/builtins/error/mod.rs → boa_engine/src/builtins/error/mod.rs

@ -16,10 +16,10 @@ use crate::{
object::{ object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData, internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData,
}, },
profiler::BoaProfiler,
property::Attribute, property::Attribute,
Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
pub(crate) mod eval; pub(crate) mod eval;
pub(crate) mod range; pub(crate) mod range;
@ -50,7 +50,7 @@ impl BuiltIn for Error {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE; let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;
let error_object = ConstructorBuilder::with_standard_object( let error_object = ConstructorBuilder::with_standard_object(

4
boa/src/builtins/error/range.rs → boa_engine/src/builtins/error/range.rs

@ -15,10 +15,10 @@ use crate::{
object::{ object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData, internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData,
}, },
profiler::BoaProfiler,
property::Attribute, property::Attribute,
Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
/// JavaScript `RangeError` implementation. /// JavaScript `RangeError` implementation.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
@ -32,7 +32,7 @@ impl BuiltIn for RangeError {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let error_prototype = context.standard_objects().error_object().prototype(); let error_prototype = context.standard_objects().error_object().prototype();
let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE; let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;

4
boa/src/builtins/error/reference.rs → boa_engine/src/builtins/error/reference.rs

@ -15,10 +15,10 @@ use crate::{
object::{ object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData, internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData,
}, },
profiler::BoaProfiler,
property::Attribute, property::Attribute,
Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub(crate) struct ReferenceError; pub(crate) struct ReferenceError;
@ -31,7 +31,7 @@ impl BuiltIn for ReferenceError {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let error_prototype = context.standard_objects().error_object().prototype(); let error_prototype = context.standard_objects().error_object().prototype();
let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE; let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;

4
boa/src/builtins/error/syntax.rs → boa_engine/src/builtins/error/syntax.rs

@ -17,10 +17,10 @@ use crate::{
object::{ object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData, internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData,
}, },
profiler::BoaProfiler,
property::Attribute, property::Attribute,
Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
/// JavaScript `SyntaxError` impleentation. /// JavaScript `SyntaxError` impleentation.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
@ -34,7 +34,7 @@ impl BuiltIn for SyntaxError {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let error_prototype = context.standard_objects().error_object().prototype(); let error_prototype = context.standard_objects().error_object().prototype();
let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE; let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;

0
boa/src/builtins/error/tests.rs → boa_engine/src/builtins/error/tests.rs

5
boa/src/builtins/error/type.rs → boa_engine/src/builtins/error/type.rs

@ -22,8 +22,9 @@ use crate::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData, internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData,
}, },
property::Attribute, property::Attribute,
BoaProfiler, Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
/// JavaScript `TypeError` implementation. /// JavaScript `TypeError` implementation.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
@ -37,7 +38,7 @@ impl BuiltIn for TypeError {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let error_prototype = context.standard_objects().error_object().prototype(); let error_prototype = context.standard_objects().error_object().prototype();
let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE; let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;

4
boa/src/builtins/error/uri.rs → boa_engine/src/builtins/error/uri.rs

@ -16,10 +16,10 @@ use crate::{
object::{ object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData, internal_methods::get_prototype_from_constructor, ConstructorBuilder, JsObject, ObjectData,
}, },
profiler::BoaProfiler,
property::Attribute, property::Attribute,
Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
/// JavaScript `URIError` impleentation. /// JavaScript `URIError` impleentation.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
@ -33,7 +33,7 @@ impl BuiltIn for UriError {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let error_prototype = context.standard_objects().error_object().prototype(); let error_prototype = context.standard_objects().error_object().prototype();
let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE; let attribute = Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;

3
boa/src/builtins/function/arguments.rs → boa_engine/src/builtins/function/arguments.rs

@ -1,14 +1,13 @@
use crate::{ use crate::{
builtins::Array, builtins::Array,
environments::DeclarativeEnvironment, environments::DeclarativeEnvironment,
gc::{Finalize, Trace},
object::{JsObject, ObjectData}, object::{JsObject, ObjectData},
property::PropertyDescriptor, property::PropertyDescriptor,
symbol::{self, WellKnownSymbols}, symbol::{self, WellKnownSymbols},
syntax::ast::node::FormalParameter, syntax::ast::node::FormalParameter,
Context, JsValue, Context, JsValue,
}; };
use gc::Gc; use boa_gc::{Finalize, Gc, Trace};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
/// `ParameterMap` represents the `[[ParameterMap]]` internal slot on a Arguments exotic object. /// `ParameterMap` represents the `[[ParameterMap]]` internal slot on a Arguments exotic object.

17
boa/src/builtins/function/mod.rs → boa_engine/src/builtins/function/mod.rs

@ -15,7 +15,6 @@ use crate::{
builtins::{BuiltIn, JsArgs}, builtins::{BuiltIn, JsArgs},
context::StandardObjects, context::StandardObjects,
environments::DeclarativeEnvironmentStack, environments::DeclarativeEnvironmentStack,
gc::{self, Finalize, Gc, Trace},
object::{ object::{
internal_methods::get_prototype_from_constructor, JsObject, NativeObject, Object, internal_methods::get_prototype_from_constructor, JsObject, NativeObject, Object,
ObjectData, ObjectData,
@ -24,8 +23,10 @@ use crate::{
property::{Attribute, PropertyDescriptor, PropertyKey}, property::{Attribute, PropertyDescriptor, PropertyKey},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
value::IntegerOrInfinity, value::IntegerOrInfinity,
BoaProfiler, Context, JsResult, JsString, JsValue, Context, JsResult, JsString, JsValue,
}; };
use boa_gc::{self, Finalize, Gc, Trace};
use boa_profiler::Profiler;
use dyn_clone::DynClone; use dyn_clone::DynClone;
use std::{ use std::{
any::Any, any::Any,
@ -125,7 +126,7 @@ impl ConstructorKind {
/// with `Any::downcast_ref` and `Any::downcast_mut` to recover the original /// with `Any::downcast_ref` and `Any::downcast_mut` to recover the original
/// type. /// type.
#[derive(Clone, Debug, Trace, Finalize)] #[derive(Clone, Debug, Trace, Finalize)]
pub struct Captures(Gc<gc::Cell<Box<dyn NativeObject>>>); pub struct Captures(Gc<boa_gc::Cell<Box<dyn NativeObject>>>);
impl Captures { impl Captures {
/// Creates a new capture context. /// Creates a new capture context.
@ -133,7 +134,7 @@ impl Captures {
where where
T: NativeObject, T: NativeObject,
{ {
Self(Gc::new(gc::Cell::new(Box::new(captures)))) Self(Gc::new(boa_gc::Cell::new(Box::new(captures))))
} }
/// Casts `Captures` to `Any` /// Casts `Captures` to `Any`
@ -141,7 +142,7 @@ impl Captures {
/// # Panics /// # Panics
/// ///
/// Panics if it's already borrowed as `&mut Any` /// Panics if it's already borrowed as `&mut Any`
pub fn as_any(&self) -> gc::Ref<'_, dyn Any> { pub fn as_any(&self) -> boa_gc::Ref<'_, dyn Any> {
Ref::map(self.0.borrow(), |data| data.deref().as_any()) Ref::map(self.0.borrow(), |data| data.deref().as_any())
} }
@ -150,7 +151,7 @@ impl Captures {
/// # Panics /// # Panics
/// ///
/// Panics if it's already borrowed as `&mut Any` /// Panics if it's already borrowed as `&mut Any`
pub fn as_mut_any(&self) -> gc::RefMut<'_, Box<dyn NativeObject>, dyn Any> { pub fn as_mut_any(&self) -> boa_gc::RefMut<'_, Box<dyn NativeObject>, dyn Any> {
RefMut::map(self.0.borrow_mut(), |data| data.deref_mut().as_mut_any()) RefMut::map(self.0.borrow_mut(), |data| data.deref_mut().as_mut_any())
} }
} }
@ -225,7 +226,7 @@ pub(crate) fn make_builtin_fn<N>(
N: Into<String>, N: Into<String>,
{ {
let name = name.into(); let name = name.into();
let _timer = BoaProfiler::global().start_event(&format!("make_builtin_fn: {name}"), "init"); let _timer = Profiler::global().start_event(&format!("make_builtin_fn: {name}"), "init");
let function = JsObject::from_proto_and_data( let function = JsObject::from_proto_and_data(
interpreter.standard_objects().function_object().prototype(), interpreter.standard_objects().function_object().prototype(),
@ -488,7 +489,7 @@ impl BuiltIn for BuiltInFunctionObject {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event("function", "init"); let _timer = Profiler::global().start_event("function", "init");
let function_prototype = context.standard_objects().function_object().prototype(); let function_prototype = context.standard_objects().function_object().prototype();
FunctionBuilder::native(context, Self::prototype) FunctionBuilder::native(context, Self::prototype)

0
boa/src/builtins/function/tests.rs → boa_engine/src/builtins/function/tests.rs

5
boa/src/builtins/global_this/mod.rs → boa_engine/src/builtins/global_this/mod.rs

@ -10,7 +10,8 @@
//! [spec]: https://tc39.es/ecma262/#sec-globalthis //! [spec]: https://tc39.es/ecma262/#sec-globalthis
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
use crate::{builtins::BuiltIn, property::Attribute, BoaProfiler, Context, JsValue}; use crate::{builtins::BuiltIn, property::Attribute, Context, JsValue};
use boa_profiler::Profiler;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -26,7 +27,7 @@ impl BuiltIn for GlobalThis {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
context.global_object().clone().into() context.global_object().clone().into()
} }

0
boa/src/builtins/global_this/tests.rs → boa_engine/src/builtins/global_this/tests.rs

5
boa/src/builtins/infinity/mod.rs → boa_engine/src/builtins/infinity/mod.rs

@ -12,7 +12,8 @@
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
use crate::{builtins::BuiltIn, property::Attribute, BoaProfiler, Context, JsValue}; use crate::{builtins::BuiltIn, property::Attribute, Context, JsValue};
use boa_profiler::Profiler;
/// JavaScript global `Infinity` property. /// JavaScript global `Infinity` property.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -26,7 +27,7 @@ impl BuiltIn for Infinity {
.union(Attribute::PERMANENT); .union(Attribute::PERMANENT);
fn init(_: &mut Context) -> JsValue { fn init(_: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
f64::INFINITY.into() f64::INFINITY.into()
} }

0
boa/src/builtins/infinity/tests.rs → boa_engine/src/builtins/infinity/tests.rs

8
boa/src/builtins/intl/mod.rs → boa_engine/src/builtins/intl/mod.rs

@ -7,15 +7,15 @@
//! //!
//! [spec]: https://tc39.es/ecma402/#intl-object //! [spec]: https://tc39.es/ecma402/#intl-object
use indexmap::IndexSet;
use crate::{ use crate::{
builtins::{Array, BuiltIn, JsArgs}, builtins::{Array, BuiltIn, JsArgs},
object::ObjectInitializer, object::ObjectInitializer,
property::Attribute, property::Attribute,
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, JsString, JsValue, Context, JsResult, JsString, JsValue,
}; };
use boa_profiler::Profiler;
use indexmap::IndexSet;
/// JavaScript `Intl` object. /// JavaScript `Intl` object.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -29,7 +29,7 @@ impl BuiltIn for Intl {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let string_tag = WellKnownSymbols::to_string_tag(); let string_tag = WellKnownSymbols::to_string_tag();
let object = ObjectInitializer::new(context) let object = ObjectInitializer::new(context)

0
boa/src/builtins/intrinsics.rs → boa_engine/src/builtins/intrinsics.rs

5
boa/src/builtins/iterable/mod.rs → boa_engine/src/builtins/iterable/mod.rs

@ -6,8 +6,9 @@ use crate::{
}, },
object::{JsObject, ObjectInitializer}, object::{JsObject, ObjectInitializer},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct IteratorPrototypes { pub struct IteratorPrototypes {
@ -168,7 +169,7 @@ impl JsValue {
/// ///
/// [spec]: https://tc39.es/ecma262/#sec-%iteratorprototype%-object /// [spec]: https://tc39.es/ecma262/#sec-%iteratorprototype%-object
fn create_iterator_prototype(context: &mut Context) -> JsObject { fn create_iterator_prototype(context: &mut Context) -> JsObject {
let _timer = BoaProfiler::global().start_event("Iterator Prototype", "init"); let _timer = Profiler::global().start_event("Iterator Prototype", "init");
let symbol_iterator = WellKnownSymbols::iterator(); let symbol_iterator = WellKnownSymbols::iterator();
let iterator_prototype = ObjectInitializer::new(context) let iterator_prototype = ObjectInitializer::new(context)

8
boa/src/builtins/json/mod.rs → boa_engine/src/builtins/json/mod.rs

@ -13,6 +13,7 @@
//! [json]: https://www.json.org/json-en.html //! [json]: https://www.json.org/json-en.html
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
use super::JsArgs;
use crate::{ use crate::{
builtins::{ builtins::{
string::{is_leading_surrogate, is_trailing_surrogate}, string::{is_leading_surrogate, is_trailing_surrogate},
@ -22,12 +23,11 @@ use crate::{
property::{Attribute, PropertyNameKind}, property::{Attribute, PropertyNameKind},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
value::IntegerOrInfinity, value::IntegerOrInfinity,
BoaProfiler, Context, JsResult, JsString, JsValue, Context, JsResult, JsString, JsValue,
}; };
use boa_profiler::Profiler;
use serde_json::{self, Value as JSONValue}; use serde_json::{self, Value as JSONValue};
use super::JsArgs;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -43,7 +43,7 @@ impl BuiltIn for Json {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let to_string_tag = WellKnownSymbols::to_string_tag(); let to_string_tag = WellKnownSymbols::to_string_tag();
let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE; let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE;

0
boa/src/builtins/json/tests.rs → boa_engine/src/builtins/json/tests.rs

7
boa/src/builtins/map/map_iterator.rs → boa_engine/src/builtins/map/map_iterator.rs

@ -1,12 +1,13 @@
use super::ordered_map::MapLock; use super::ordered_map::MapLock;
use crate::{ use crate::{
builtins::{function::make_builtin_fn, iterable::create_iter_result_object, Array, JsValue}, builtins::{function::make_builtin_fn, iterable::create_iter_result_object, Array, JsValue},
gc::{Finalize, Trace},
object::{JsObject, ObjectData}, object::{JsObject, ObjectData},
property::{PropertyDescriptor, PropertyNameKind}, property::{PropertyDescriptor, PropertyNameKind},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, Context, JsResult,
}; };
use boa_gc::{Finalize, Trace};
use boa_profiler::Profiler;
/// The Map Iterator object represents an iteration over a map. It implements the iterator protocol. /// The Map Iterator object represents an iteration over a map. It implements the iterator protocol.
/// ///
@ -120,7 +121,7 @@ impl MapIterator {
iterator_prototype: JsObject, iterator_prototype: JsObject,
context: &mut Context, context: &mut Context,
) -> JsObject { ) -> JsObject {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
// Create prototype // Create prototype
let map_iterator = let map_iterator =

14
boa/src/builtins/map/mod.rs → boa_engine/src/builtins/map/mod.rs

@ -12,6 +12,8 @@
#![allow(clippy::mutable_key_type)] #![allow(clippy::mutable_key_type)]
use self::{map_iterator::MapIterator, ordered_map::OrderedMap};
use super::JsArgs;
use crate::{ use crate::{
builtins::{iterable::IteratorResult, BuiltIn}, builtins::{iterable::IteratorResult, BuiltIn},
context::StandardObjects, context::StandardObjects,
@ -21,16 +23,12 @@ use crate::{
}, },
property::{Attribute, PropertyNameKind}, property::{Attribute, PropertyNameKind},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use ordered_map::OrderedMap; use boa_profiler::Profiler;
pub mod map_iterator;
use map_iterator::MapIterator;
use super::JsArgs;
use num_traits::Zero; use num_traits::Zero;
pub mod map_iterator;
pub mod ordered_map; pub mod ordered_map;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -46,7 +44,7 @@ impl BuiltIn for Map {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let get_species = FunctionBuilder::native(context, Self::get_species) let get_species = FunctionBuilder::native(context, Self::get_species)
.name("get [Symbol.species]") .name("get [Symbol.species]")

7
boa/src/builtins/map/ordered_map.rs → boa_engine/src/builtins/map/ordered_map.rs

@ -1,8 +1,5 @@
use crate::{ use crate::{object::JsObject, JsValue};
gc::{custom_trace, Finalize, Trace}, use boa_gc::{custom_trace, Finalize, Trace};
object::JsObject,
JsValue,
};
use indexmap::{Equivalent, IndexMap}; use indexmap::{Equivalent, IndexMap};
use std::{ use std::{
collections::hash_map::RandomState, collections::hash_map::RandomState,

0
boa/src/builtins/map/tests.rs → boa_engine/src/builtins/map/tests.rs

8
boa/src/builtins/math/mod.rs → boa_engine/src/builtins/math/mod.rs

@ -11,12 +11,12 @@
//! [spec]: https://tc39.es/ecma262/#sec-math-object //! [spec]: https://tc39.es/ecma262/#sec-math-object
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
use super::JsArgs;
use crate::{ use crate::{
builtins::BuiltIn, object::ObjectInitializer, property::Attribute, symbol::WellKnownSymbols, builtins::BuiltIn, object::ObjectInitializer, property::Attribute, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
use super::JsArgs;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -33,7 +33,7 @@ impl BuiltIn for Math {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::PERMANENT; let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::PERMANENT;
let string_tag = WellKnownSymbols::to_string_tag(); let string_tag = WellKnownSymbols::to_string_tag();

0
boa/src/builtins/math/tests.rs → boa_engine/src/builtins/math/tests.rs

0
boa/src/builtins/mod.rs → boa_engine/src/builtins/mod.rs

5
boa/src/builtins/nan/mod.rs → boa_engine/src/builtins/nan/mod.rs

@ -13,7 +13,8 @@
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
use crate::{builtins::BuiltIn, property::Attribute, BoaProfiler, Context, JsValue}; use crate::{builtins::BuiltIn, property::Attribute, Context, JsValue};
use boa_profiler::Profiler;
/// JavaScript global `NaN` property. /// JavaScript global `NaN` property.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -27,7 +28,7 @@ impl BuiltIn for NaN {
.union(Attribute::PERMANENT); .union(Attribute::PERMANENT);
fn init(_: &mut Context) -> JsValue { fn init(_: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
f64::NAN.into() f64::NAN.into()
} }

0
boa/src/builtins/nan/tests.rs → boa_engine/src/builtins/nan/tests.rs

0
boa/src/builtins/number/conversions.rs → boa_engine/src/builtins/number/conversions.rs

5
boa/src/builtins/number/mod.rs → boa_engine/src/builtins/number/mod.rs

@ -21,8 +21,9 @@ use crate::{
}, },
property::Attribute, property::Attribute,
value::{AbstractRelation, IntegerOrInfinity, JsValue}, value::{AbstractRelation, IntegerOrInfinity, JsValue},
BoaProfiler, Context, JsResult, Context, JsResult,
}; };
use boa_profiler::Profiler;
use num_traits::{float::FloatCore, Num}; use num_traits::{float::FloatCore, Num};
mod conversions; mod conversions;
@ -46,7 +47,7 @@ impl BuiltIn for Number {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::PERMANENT; let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::PERMANENT;
let number_object = ConstructorBuilder::with_standard_object( let number_object = ConstructorBuilder::with_standard_object(

0
boa/src/builtins/number/tests.rs → boa_engine/src/builtins/number/tests.rs

7
boa/src/builtins/object/for_in_iterator.rs → boa_engine/src/builtins/object/for_in_iterator.rs

@ -1,12 +1,13 @@
use crate::{ use crate::{
builtins::{function::make_builtin_fn, iterable::create_iter_result_object}, builtins::{function::make_builtin_fn, iterable::create_iter_result_object},
gc::{Finalize, Trace},
object::{JsObject, ObjectData}, object::{JsObject, ObjectData},
property::PropertyDescriptor, property::PropertyDescriptor,
property::PropertyKey, property::PropertyKey,
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, JsString, JsValue, Context, JsResult, JsString, JsValue,
}; };
use boa_gc::{Finalize, Trace};
use boa_profiler::Profiler;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use std::collections::VecDeque; use std::collections::VecDeque;
@ -128,7 +129,7 @@ impl ForInIterator {
iterator_prototype: JsObject, iterator_prototype: JsObject,
context: &mut Context, context: &mut Context,
) -> JsObject { ) -> JsObject {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
// Create prototype // Create prototype
let for_in_iterator = let for_in_iterator =

8
boa/src/builtins/object/mod.rs → boa_engine/src/builtins/object/mod.rs

@ -13,6 +13,7 @@
//! [spec]: https://tc39.es/ecma262/#sec-objects //! [spec]: https://tc39.es/ecma262/#sec-objects
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
use super::Array;
use crate::{ use crate::{
builtins::{map, BuiltIn, JsArgs}, builtins::{map, BuiltIn, JsArgs},
context::StandardObjects, context::StandardObjects,
@ -23,10 +24,9 @@ use crate::{
property::{Attribute, PropertyDescriptor, PropertyKey, PropertyNameKind}, property::{Attribute, PropertyDescriptor, PropertyKey, PropertyNameKind},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
value::JsValue, value::JsValue,
BoaProfiler, Context, JsResult, JsString, Context, JsResult, JsString,
}; };
use boa_profiler::Profiler;
use super::Array;
pub mod for_in_iterator; pub mod for_in_iterator;
#[cfg(test)] #[cfg(test)]
@ -44,7 +44,7 @@ impl BuiltIn for Object {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let object = ConstructorBuilder::with_standard_object( let object = ConstructorBuilder::with_standard_object(
context, context,

0
boa/src/builtins/object/tests.rs → boa_engine/src/builtins/object/tests.rs

7
boa/src/builtins/proxy/mod.rs → boa_engine/src/builtins/proxy/mod.rs

@ -12,11 +12,12 @@
use crate::{ use crate::{
builtins::{BuiltIn, JsArgs}, builtins::{BuiltIn, JsArgs},
gc::{Finalize, Trace},
object::{ConstructorBuilder, FunctionBuilder, JsObject, ObjectData}, object::{ConstructorBuilder, FunctionBuilder, JsObject, ObjectData},
property::Attribute, property::Attribute,
BoaProfiler, Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_gc::{Finalize, Trace};
use boa_profiler::Profiler;
/// Javascript `Proxy` object. /// Javascript `Proxy` object.
#[derive(Debug, Clone, Trace, Finalize)] #[derive(Debug, Clone, Trace, Finalize)]
@ -33,7 +34,7 @@ impl BuiltIn for Proxy {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
ConstructorBuilder::with_standard_object( ConstructorBuilder::with_standard_object(
context, context,

8
boa/src/builtins/reflect/mod.rs → boa_engine/src/builtins/reflect/mod.rs

@ -10,15 +10,15 @@
//! [spec]: https://tc39.es/ecma262/#sec-reflect-object //! [spec]: https://tc39.es/ecma262/#sec-reflect-object
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect
use super::{Array, JsArgs};
use crate::{ use crate::{
builtins::{self, BuiltIn}, builtins::{self, BuiltIn},
object::{JsObject, ObjectInitializer}, object::{JsObject, ObjectInitializer},
property::Attribute, property::Attribute,
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use boa_profiler::Profiler;
use super::{Array, JsArgs};
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -35,7 +35,7 @@ impl BuiltIn for Reflect {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let to_string_tag = WellKnownSymbols::to_string_tag(); let to_string_tag = WellKnownSymbols::to_string_tag();

0
boa/src/builtins/reflect/tests.rs → boa_engine/src/builtins/reflect/tests.rs

17
boa/src/builtins/regexp/mod.rs → boa_engine/src/builtins/regexp/mod.rs

@ -11,12 +11,11 @@
pub mod regexp_string_iterator; pub mod regexp_string_iterator;
use std::str::FromStr; use self::regexp_string_iterator::RegExpStringIterator;
use super::JsArgs;
use crate::{ use crate::{
builtins::{array::Array, string, BuiltIn}, builtins::{array::Array, string, BuiltIn},
context::StandardObjects, context::StandardObjects,
gc::{empty_trace, Finalize, Trace},
object::{ object::{
internal_methods::get_prototype_from_constructor, ConstructorBuilder, FunctionBuilder, internal_methods::get_prototype_from_constructor, ConstructorBuilder, FunctionBuilder,
JsObject, ObjectData, JsObject, ObjectData,
@ -25,12 +24,12 @@ use crate::{
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
syntax::lexer::regex::RegExpFlags, syntax::lexer::regex::RegExpFlags,
value::{IntegerOrInfinity, JsValue}, value::{IntegerOrInfinity, JsValue},
BoaProfiler, Context, JsResult, JsString, Context, JsResult, JsString,
}; };
use regexp_string_iterator::RegExpStringIterator; use boa_gc::{unsafe_empty_trace, Finalize, Trace};
use boa_profiler::Profiler;
use regress::Regex; use regress::Regex;
use std::str::FromStr;
use super::JsArgs;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -47,7 +46,7 @@ pub struct RegExp {
// Only safe while regress::Regex doesn't implement Trace itself. // Only safe while regress::Regex doesn't implement Trace itself.
unsafe impl Trace for RegExp { unsafe impl Trace for RegExp {
empty_trace!(); unsafe_empty_trace!();
} }
impl BuiltIn for RegExp { impl BuiltIn for RegExp {
@ -58,7 +57,7 @@ impl BuiltIn for RegExp {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let get_species = FunctionBuilder::native(context, Self::get_species) let get_species = FunctionBuilder::native(context, Self::get_species)
.name("get [Symbol.species]") .name("get [Symbol.species]")

10
boa/src/builtins/regexp/regexp_string_iterator.rs → boa_engine/src/builtins/regexp/regexp_string_iterator.rs

@ -10,16 +10,16 @@
//! //!
//! [spec]: https://tc39.es/ecma262/#sec-regexp-string-iterator-objects //! [spec]: https://tc39.es/ecma262/#sec-regexp-string-iterator-objects
use regexp::{advance_string_index, RegExp};
use crate::{ use crate::{
builtins::{function::make_builtin_fn, iterable::create_iter_result_object, regexp}, builtins::{function::make_builtin_fn, iterable::create_iter_result_object, regexp},
gc::{Finalize, Trace},
object::{JsObject, ObjectData}, object::{JsObject, ObjectData},
property::PropertyDescriptor, property::PropertyDescriptor,
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, JsString, JsValue, Context, JsResult, JsString, JsValue,
}; };
use boa_gc::{Finalize, Trace};
use boa_profiler::Profiler;
use regexp::{advance_string_index, RegExp};
// TODO: See todos in create_regexp_string_iterator and next. // TODO: See todos in create_regexp_string_iterator and next.
#[derive(Debug, Clone, Finalize, Trace)] #[derive(Debug, Clone, Finalize, Trace)]
@ -148,7 +148,7 @@ impl RegExpStringIterator {
iterator_prototype: JsObject, iterator_prototype: JsObject,
context: &mut Context, context: &mut Context,
) -> JsObject { ) -> JsObject {
let _timer = BoaProfiler::global().start_event("RegExp String Iterator", "init"); let _timer = Profiler::global().start_event("RegExp String Iterator", "init");
// Create prototype // Create prototype
let result = JsObject::from_proto_and_data(iterator_prototype, ObjectData::ordinary()); let result = JsObject::from_proto_and_data(iterator_prototype, ObjectData::ordinary());

0
boa/src/builtins/regexp/tests.rs → boa_engine/src/builtins/regexp/tests.rs

14
boa/src/builtins/set/mod.rs → boa_engine/src/builtins/set/mod.rs

@ -10,6 +10,8 @@
//! [spec]: https://tc39.es/ecma262/#sec-set-objects //! [spec]: https://tc39.es/ecma262/#sec-set-objects
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
use self::{ordered_set::OrderedSet, set_iterator::SetIterator};
use super::JsArgs;
use crate::{ use crate::{
builtins::BuiltIn, builtins::BuiltIn,
context::StandardObjects, context::StandardObjects,
@ -19,16 +21,12 @@ use crate::{
}, },
property::{Attribute, PropertyNameKind}, property::{Attribute, PropertyNameKind},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, JsValue, Context, JsResult, JsValue,
}; };
use ordered_set::OrderedSet; use boa_profiler::Profiler;
pub mod set_iterator;
use set_iterator::SetIterator;
use super::JsArgs;
pub mod ordered_set; pub mod ordered_set;
pub mod set_iterator;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -43,7 +41,7 @@ impl BuiltIn for Set {
.union(Attribute::CONFIGURABLE); .union(Attribute::CONFIGURABLE);
fn init(context: &mut Context) -> JsValue { fn init(context: &mut Context) -> JsValue {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
let get_species = FunctionBuilder::native(context, Self::get_species) let get_species = FunctionBuilder::native(context, Self::get_species)
.name("get [Symbol.species]") .name("get [Symbol.species]")

2
boa/src/builtins/set/ordered_set.rs → boa_engine/src/builtins/set/ordered_set.rs

@ -1,4 +1,4 @@
use crate::gc::{custom_trace, Finalize, Trace}; use boa_gc::{custom_trace, Finalize, Trace};
use indexmap::{ use indexmap::{
set::{IntoIter, Iter}, set::{IntoIter, Iter},
IndexSet, IndexSet,

7
boa/src/builtins/set/set_iterator.rs → boa_engine/src/builtins/set/set_iterator.rs

@ -1,11 +1,12 @@
use crate::{ use crate::{
builtins::{function::make_builtin_fn, iterable::create_iter_result_object, Array, JsValue}, builtins::{function::make_builtin_fn, iterable::create_iter_result_object, Array, JsValue},
gc::{Finalize, Trace},
object::{JsObject, ObjectData}, object::{JsObject, ObjectData},
property::{PropertyDescriptor, PropertyNameKind}, property::{PropertyDescriptor, PropertyNameKind},
symbol::WellKnownSymbols, symbol::WellKnownSymbols,
BoaProfiler, Context, JsResult, Context, JsResult,
}; };
use boa_gc::{Finalize, Trace};
use boa_profiler::Profiler;
/// The Set Iterator object represents an iteration over a set. It implements the iterator protocol. /// The Set Iterator object represents an iteration over a set. It implements the iterator protocol.
/// ///
@ -129,7 +130,7 @@ impl SetIterator {
iterator_prototype: JsObject, iterator_prototype: JsObject,
context: &mut Context, context: &mut Context,
) -> JsObject { ) -> JsObject {
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
// Create prototype // Create prototype
let set_iterator = let set_iterator =

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save