mirror of https://github.com/boa-dev/boa.git
Tree:
718fea378a
add-vhs-ci
benchmarks
control-flow-graph
dependabot/cargo/rust-dependencies-fd1ddd1272
dependabot/cargo/rustls-0.23.18
expect-lints
feature/node_span
feature/snapshot
features
gh-readonly-queue/main/pr-2877-b0ddf5eed00a53281d67fc7d846233fc0d99ce9c
gh-readonly-queue/main/pr-3144-8e48cec73fae708420b9af88813d4870243c491a
main
nan-boxing
optimization/static-shapes
real_conformance
reduce-environment-allocations
refactor/interner
refactor/register-vm
releases/0.17
releases/0.19
semver_checks
tco
utility-crate
wasm-debugger
nightly
v0.10
v0.11
v0.12
v0.13
v0.14
v0.15
v0.16
v0.17
v0.17.1
v0.17.2
v0.17.3
v0.18
v0.19
v0.19.1
v0.2.0
v0.2.1
v0.3.0
v0.4.0
v0.5.0
v0.5.1
v0.6.0
v0.7.0
v0.8.0
v0.9.0
${ noResults }
312 Commits (718fea378a6355b0b1e3f226432f1b24f84515c7)
Author | SHA1 | Message | Date |
---|---|---|---|
dependabot[bot] | 5aac69c27d |
Bump once_cell from 1.16.0 to 1.17.0 (#2510)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.16.0 to 1.17.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/matklad/once_cell/blob/master/CHANGELOG.md">once_cell's changelog</a>.</em></p> <blockquote> <h2>1.17.0</h2> <ul> <li>Add <code>race::OnceRef</code> for storing a <code>&'a T</code>.</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
Veera | f216a6dda9 |
Fix unary operations on `this` (#2507)
<!--- Thank you for contributing to Boa! Please fill out the template below, and remove or add any information as you feel necessary. ---> This Pull Request fixes/closes #2416. Previously, prefix increment and decrement operations on `this` caused a panic. This PR makes the parser issue a syntax error when the operand UnaryExpression is not simple (as mentioned in https://tc39.es/ecma262/#sec-update-expressions-static-semantics-early-errors). |
2 years ago |
José Julián Espina | 81680ff5c4 |
Pass locale data provider by ref instead of boxing (#2508)
This change is actually pretty simple, but since now we have to pass a lifetime parameter to all references of `Context`, it touches a lot of files. Relevant changes: - https://github.com/boa-dev/boa/pull/2508/files#diff-73e17259d77e5fbef83b2bdbbe4dc40a912f807472287f7f45b77e0cbf78792d - https://github.com/boa-dev/boa/pull/2508/files#diff-e7ebcd61f7a01c432b62e1742a6cfd8e28326a1f2b6afb37ba66d4964b3db521 - https://github.com/boa-dev/boa/pull/2508/files#diff-7b2a85f5aa9b5a8070e04e87a67b4f7cc700a43a520e0d6cc6e0b701711ccb7c - https://github.com/boa-dev/boa/pull/2508/files#diff-872037c107c01bf644ede412e4802b3eefeb5a70ce595c441f75651d45111b2a - https://github.com/boa-dev/boa/pull/2508/files#diff-a665b3b6f564521875fd0d725bffbc4f0cc84e5feefdc5fd875fd943e56311cd - https://github.com/boa-dev/boa/pull/2508/files#diff-3e1f19581f227120ddc3334fd0450152b767811c9b6cb4048581347fcd9fc91d - https://github.com/boa-dev/boa/pull/2508/files#diff-5fe65193a910618375d9575d918cd584430437ee2738a987c92068dea3117297 - https://github.com/boa-dev/boa/pull/2508/files#diff-4ce8770f8aaf50785ece12a9a15b781a544bfc47f080e2ff62ddfb18264a44ef All the other changes are just replacing `Context` with `Context<'_>`. |
2 years ago |
José Julián Espina | cbf07824cb |
Cleanup `Context` APIs (#2504)
Just a general cleanup of the APIs of our `Context`. - Reordered the `pub` and `pub(crate)/fn` methods to have a clear separation between our public and private APIs. - Removed the call method and added it to `JsValue` instead, which semantically makes a bit more sense. - Removed the `construct_object` method, and added an utility method `new` to `JsObject` instead. - Rewrote some patterns I found while rewriting the calls of the removed function. |
2 years ago |
dependabot[bot] | dcacc638aa |
Bump serde from 1.0.151 to 1.0.152 (#2509)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.151 to 1.0.152. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p> <blockquote> <h2>v1.0.152</h2> <ul> <li>Documentation improvements</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
Choongwoo Han | ab2e6e1ab3 |
Use opcode table rather than match (#2501)
`execute_instruction` is heavily used. After decoding an opcode, `match` is used to find a proper `execute` function for the opcode. But, the `match` may not be able to be optimized into a table jump by rust compiler, so it may use multiple branches to find the function. When I tested with a toy program, only `enum -> &'static str` case was optimized to use a table while `enum -> function call` uses multiple branches. ([gotbolt](https://rust.godbolt.org/z/1rzK5vj6f)) This change makes the opcode to use a table explicitly. It improves the benchmark score of Richards by 1-2% (22.8 -> 23.2). |
2 years ago |
José Julián Espina | 3bf5de2929 |
Redesign Intl API and implement some services (#2478)
This Pull Request fixes/closes #1180. (I'll open a tracking issue for the progress) It changes the following: - Redesigns the internal API of Intl to (hopefully!) make it easier to implement a service. - Implements the `Intl.Locale` service. - Implements the `Intl.Collator` service. - Implements the `Intl.ListFormat` service. On the subject of the failing tests. Some of them are caused by missing locale data in the `icu_testdata` crate; we would need to regenerate that with the missing locales, or vendor a custom default data. On the other hand, there are some tests that are bugs from the ICU4X crate. The repo https://github.com/jedel1043/icu4x-test262 currently tracks the found bugs when running test262. I'll sync with the ICU4X team to try to fix those. cc @sffc |
2 years ago |
José Julián Espina | cc45a827ca |
Cleanup inline annotations (#2493)
Per the [Standard Library development guide](https://std-dev-guide.rust-lang.org/code-considerations/performance/inline.html): > You can add `#[inline]`: > > - To public, small, non-generic functions. > > You shouldn't need `#[inline]`: > - On methods that have any generics in scope. > - On methods on traits that don't have a default implementation. > > `#[inline]` can always be introduced later, so if you're in doubt they can just be removed. This PR follows this guideline to reduce the number of `#[inline]` annotations in our code, removing the annotation in: - Non-public functions - Generic functions - Medium and big functions. Hopefully this shouldn't impact our perf at all, but let's wait to see the benchmark results. |
2 years ago |
José Julián Espina | 850a20b988 |
Replace `criterion::black_box` with `std::hint::black_box` (#2494)
This Pull Request replaces the `criterion::black_box` function with the recently stabilized `std::hint::black_box` intrinsic. |
2 years ago |
dependabot[bot] | 69067cac22 |
Bump serde from 1.0.150 to 1.0.151 (#2497)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.150 to 1.0.151. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p> <blockquote> <h2>v1.0.151</h2> <ul> <li>Update <code>serde::</code>{<code>ser</code>,<code>de</code>}<code>::StdError</code> to re-export <code>core::error::Error</code> when serde is built with <code>feature="std"</code> <strong>off</strong> and <code>feature="unstable"</code> <strong>on</strong> (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2344">#2344</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
dependabot[bot] | 4660579490 |
Bump thiserror from 1.0.37 to 1.0.38 (#2498)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.37 to 1.0.38. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/dtolnay/thiserror/releases">thiserror's releases</a>.</em></p> <blockquote> <h2>1.0.38</h2> <ul> <li>Documentation improvements</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
dependabot[bot] | 0d82ef0653 |
Bump serde_json from 1.0.89 to 1.0.91 (#2496)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.89 to 1.0.91. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/json/releases">serde_json's releases</a>.</em></p> <blockquote> <h2>v1.0.91</h2> <ul> <li>Opt out of <code>-Zrustdoc-scrape-examples</code> on docs.rs for now</li> </ul> <h2>v1.0.90</h2> <ul> <li>Documentation improvements</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
dependabot[bot] | b4208fbb23 |
Bump dyn-clone from 1.0.9 to 1.0.10 (#2490)
Bumps [dyn-clone](https://github.com/dtolnay/dyn-clone) from 1.0.9 to 1.0.10. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/dtolnay/dyn-clone/releases">dyn-clone's releases</a>.</em></p> <blockquote> <h2>1.0.10</h2> <ul> <li>Documentation improvements</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
e-codes-stuff | ce51449d67 |
Divide byte compiler (#2425)
This Pull Request is currently unfinished but will fix/close #1808 after some review and more work It changes the following: - Divides byte compiler logic into separate files I would like some review on the current code I have to know if the patterns I'm using are acceptable for the codebase, if everything looks good I will try to separate more code into different small modules to finish the work here. |
2 years ago |
raskad | e3d35e9b36 |
Fix rust 1.66.0 lints (#2486)
This Pull Request fixes the new lints introduced in clippy 1.66.0. |
2 years ago |
dependabot[bot] | af4292181b |
Bump serde from 1.0.149 to 1.0.150 (#2481)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.149 to 1.0.150. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p> <blockquote> <h2>v1.0.150</h2> <ul> <li>Relax some trait bounds from the <code>Serialize</code> impl of <code>HashMap</code> and <code>BTreeMap</code> (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2334">#2334</a>)</li> <li>Enable <code>Serialize</code> and <code>Deserialize</code> impls of <code>std::sync::atomic</code> types on more platforms (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2337">#2337</a>, thanks <a href="https://github.com/badboy"><code>@badboy</code></a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
dependabot[bot] | eec4b8f804 |
Bump serde from 1.0.148 to 1.0.149 (#2472)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.148 to 1.0.149. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p> <blockquote> <h2>v1.0.149</h2> <ul> <li>Relax some trait bounds from the <code>Serialize</code> impl of <code>BinaryHeap</code>, <code>BTreeSet</code>, and <code>HashSet</code> (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2333">#2333</a>, thanks <a href="https://github.com/jonasbb"><code>@jonasbb</code></a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
Kevin | c79b9023df |
Documentation Updates (#2463)
<!--- Thank you for contributing to Boa! Please fill out the template below, and remove or add any information as you feel necessary. ---> Submitting this as a draft for feedback/second opinions. This draft contains some changes to the documentation. Quick Overview: - Potential `Boa` header for Boa's crates added to `boa_engine`. - Changes the wording to a lot of module headers (See `builtins` module and `object/builtins` module). - Updating built-in wrapper's code examples to use `?` operator. - Adds the doc logo URL to a few crates that didn't have it. The main idea of this draft is to move away from the "This module implements" wording as it feels a bit duplicative when listed under the Modules section (mainly focusing around changes in `boa_engine` to start). While working on this, I had a question about whether we should be using JavaScript or ECMAScript in the Boa's documentation. We do seem to currently use both, and this draft uses JavaScript heavily in the wording. |
2 years ago |
raskad | b9f8841a83 |
Allow class expressions without identifier (#2464)
This Pull Request changes the following: - Remove false early error when a class expression was missing a binding identifier. - Simplify/fix environment truncation on function returns. The new failed tests where false positives before that will be fixed in another PR. |
2 years ago |
dependabot[bot] | b59d996a3b |
Bump serde from 1.0.147 to 1.0.148 (#2465)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.147 to 1.0.148. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p> <blockquote> <h2>v1.0.148</h2> <ul> <li>Support <code>remote</code> derive for generic types that have private fields (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2327">#2327</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
raskad | 9b56912ea7 |
Set function names in object literal methods (#2460)
This Pull Request changes the following: - Implement `SetFunctionName` opcode based on [`SetFunctionName`](https://tc39.es/ecma262/#sec-setfunctionname) |
2 years ago |
raskad | 7971d4c197 |
Fix `PartialEq` for `JsBigInt` and `f64` (#2461)
This Pull Request changes the following: - Use the `BigInt::from_f64` function when checking `JsBigInt` and `f64` for eqality. |
2 years ago |
Kevin | 8c882817c0 |
`JsArrayBuffer` take method and docs (#2454)
<!--- Thank you for contributing to Boa! Please fill out the template below, and remove or add any information as you feel necessary. ---> This Pull Request is related to the #2058 and the discussion in the discord chat. It changes the following: - Adds a `take` method to `JsArrayBuffer` - Builds out `JsArrayBuffer` docs - Adds a `JsArrayBuffer::take()` example to `jsarraybuffer.rs` in `boa_examples` |
2 years ago |
raskad | 5435ae0ab9 |
Restructure lint lists in `boa_engine` (#2455)
This Pull Request restructures the lint deny/warn/allow lists in `boa_engine`. It adds a lot of documentation to pup functions. There are still a few clippy lints that are not fixed, mainly regarding casting of number types. Fixing those lints effectiveley would in some cases probably require bigger refactors. This should probably wait for #2449 to be merged, because that PR already fixes that lints regarding the `Date` built-in. |
2 years ago |
Arjun Kavi | 9c2bc0a7a6 |
Fix built-ins/Array/prototype/toString/non-callable-join-string-tag.js test case (#2458)
This Pull Request fixes [built-ins/Array/prototype/toString/non-callable-join-string-tag.js](https://github.com/tc39/test262/blob/main/test/built-ins/Array/prototype/toString/non-callable-join-string-tag.js) Previously: ``` Array.prototype.toString.call(new Proxy(() => {}, {})) => "[object Object]" ``` With this change: ``` Array.prototype.toString.call(new Proxy(() => {}, {})) => "[object Function]" ``` Reasoning: 1) [23.1.3.33 Array.prototype.toString](https://tc39.es/ecma262/#sec-array.prototype.tostring): Assuming `this` does not have a callable `join` property, delegate to `Object.prototype.toString`. 2) [20.1.3.6 Object.prototype.toString](https://tc39.es/ecma262/#sec-object.prototype.tostring): if `O` has a `[[Call]]` internal method set, `builtinTag` should be "Function". a) This was what was not correctly done in the existing implementation 3) [10.5.14 ProxyCreate](https://tc39.es/ecma262/#sec-proxycreate): If the `target` passed isCallable, set the `[[Call]]` internal method |
2 years ago |
Halid Odat | a2964e63dd |
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 |
José Julián Espina | 1ae48441fd |
Refactor the `Date` builtin (#2449)
Just a general cleanup of the `Date` builtin to use slightly better patterns and to fix our warnings about deprecated functions. About the regressed tests. It seems to be a `chrono` bug, so I opened up an issue (https://github.com/chronotope/chrono/issues/884) for it and they've already opened a PR fixing it (https://github.com/chronotope/chrono/pull/885). However, while checking out the remaining failing tests, I realized there's a more fundamental limitation with the library. Currently, [`chrono`](https://github.com/chronotope/chrono) specifies: > Date types are limited in about +/- 262,000 years from the common epoch. While the [ECMAScript spec](https://tc39.es/ecma262/#sec-time-values-and-time-range) says: > The smaller range supported by a time value as specified in this section is approximately -273,790 to 273,790 years relative to 1970. The range allowed by the spec is barely outside of the range supported by `chrono`! This is why the remaining `Date` tests fail. Seeing that, I would like to ping @djc and @esheppa (the maintainers of `chrono`) to ask if it would be feasible to add a feature, akin to the `large-dates` feature from the `time` crate, that expands the supported range of `chrono`. EDIT: Filed https://github.com/chronotope/chrono/issues/886 |
2 years ago |
dependabot[bot] | 20db887025 |
Bump serde_json from 1.0.88 to 1.0.89 (#2457)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.88 to 1.0.89. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/json/releases">serde_json's releases</a>.</em></p> <blockquote> <h2>v1.0.89</h2> <ul> <li>Fix invalid JSON incorrectly accepted when a large number has no digits after decimal point (<a href="https://github-redirect.dependabot.com/serde-rs/json/issues/953">#953</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
dependabot[bot] | f617de94dc |
Bump indexmap from 1.9.1 to 1.9.2 (#2446)
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.9.1 to 1.9.2. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/bluss/indexmap/blob/master/RELEASES.md">indexmap's changelog</a>.</em></p> <blockquote> <ul> <li> <p>1.9.2</p> <ul> <li><code>IndexMap</code> and <code>IndexSet</code> both implement <code>arbitrary::Arbitrary<'_></code> and <code>quickcheck::Arbitrary</code> if those optional dependency features are enabled.</li> </ul> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
dependabot[bot] | e0b0833797 |
Bump serde_json from 1.0.87 to 1.0.88 (#2445)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.87 to 1.0.88. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/json/releases">serde_json's releases</a>.</em></p> <blockquote> <h2>v1.0.88</h2> <ul> <li>Optimize serde_json::Map's implementation of <code>append</code> and <code>clone_from</code> (<a href="https://github-redirect.dependabot.com/serde-rs/json/issues/952">#952</a>, thanks <a href="https://github.com/Lucretiel"><code>@Lucretiel</code></a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
José Julián Espina | 79f638d667 |
Implement the `WeakRef` builtin (#2438)
52/60 tests passing. The remaining tests are either features not implemented ([FinalizationRegistry](https://tc39.es/ecma262/multipage/managing-memory.html#sec-finalization-registry-objects)) or features still in development ([symbols-as-weakmap-keys](https://github.com/tc39/proposal-symbols-as-weakmap-keys)). |
2 years ago |
Addison Crump | c1b5f38d11 |
VM Fuzzer (#2401)
This Pull Request offers a basic VM fuzzer which relies on implied oracles (namely, "does it crash or timeout?"). It changes the following: - Adds an insns_remaining field to Context, denoting the number of instructions remaining to execute (only available when fuzzing) - Adds a JsNativeError variant, denoting when the number of instructions has been exceeded (only available when fuzzing) - Adds a VM fuzzer which looks for cases where Boa may crash on an input This offers no guarantees about correctness, only assertion violations. Depends on #2400. Any issues I raise in association with this fuzzer will link back to this fuzzer. You may run the fuzzer using the following commands: ```bash $ cd boa_engine $ cargo +nightly fuzz run -s none vm-implied ``` Co-authored-by: Addison Crump <addison.crump@cispa.de> |
2 years ago |
Kevin | 98e6dd36cb |
Boa Gc implementation draft (#2394)
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel necessary.
--->
Not sure if anyone else may be working on something more substantial/in-depth, but I thought I'd post this. 😄
The basic rundown is that this is more of an untested (and in some ways naïve) draft than anything else. It builds rather heavily on `rust-gc`, and tries to keep plenty of the core aspects so as to not break anything too much, and also to minimize overarching changes were it to actually be merged at some point.
This implementation does add ~~a generational divide (although a little unoptimized) to the heap,~~ a GcAlloc/Collector struct with methods, and an ephemeron implementation that allows for the WeakPair and WeakGc pointers.
|
2 years ago |
dependabot[bot] | 4493254de7 |
Bump chrono from 0.4.22 to 0.4.23 (#2436)
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.22 to 0.4.23. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/chronotope/chrono/releases">chrono's releases</a>.</em></p> <blockquote> <p>0.4.23 is the next 0.4 release of the popular chrono date and time library for Rust. After the 0.4.20-0.4.22 series that brought chrono back to life after a long hiatus, development has been fairly quiet, allowing us to start planning changes for the 0.5.0 release. As such, we've started deprecating some APIs that are likely to be removed in 0.5. If you have any feedback on these changes, please let us know in the issue tracker!</p> <h3>Deprecations</h3> <ul> <li>Deprecate methods that have an <code>_opt()</code> alternative (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/827">#827</a>)</li> <li>Deprecate usage of the <code>Date<Tz></code> type (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/851">#851</a>)</li> </ul> <h3>Features</h3> <ul> <li>Optimize RFC 3339 (and RFC 2822) encoding (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/844">#844</a>, thanks to <a href="https://github.com/conradludgate"><code>@conradludgate</code></a>)</li> <li>Addition and subtraction with the <code>Days</code> type (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/784">#784</a>)</li> <li>Add <code>NaiveDateTime::from_timestamp_millis(_opt)</code> (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/818">#818</a>, thanks to <a href="https://github.com/Pscheidl"><code>@Pscheidl</code></a> -- backported in <a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/823">#823</a>)</li> <li>Allow for changing TZ variable and cache it for <code>Local</code> timezone (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/853">#853</a>)</li> <li>Add optional support for the <code>arbitrary::Arbitrary</code> trait (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/849">#849</a>, thanks to <a href="https://github.com/greyblake"><code>@greyblake</code></a> and <a href="https://github.com/asayers"><code>@asayers</code></a>)</li> </ul> <h3>Fixes</h3> <ul> <li>Support tzdb location on AIX (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/826">#826</a>)</li> <li>Fix warnings in documentation (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/847">#847</a>)</li> </ul> <p>On behalf of <a href="https://github.com/esheppa"><code>@esheppa</code></a> and <a href="https://github.com/djc"><code>@djc</code></a>, thanks to all contributors!</p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
José Julián Espina | fdac8ece5b |
Fix some Date tests (#2431)
Found some tests on the `Date` builtin that were failing for incorrect length attributes and missing checks. |
2 years ago |
raskad | 6eff7ca00e |
Handle `__proto__` fields in object literals (#2423)
This Pull Request changes the following: - Handle `__proto__` fields in object literals |
2 years ago |
Anuvrat | 70f73b45d8 |
Safe wrapper for `JsDate` (#2181)
This PR adds a safe wrapper around JavaScript `JsDate` from `builtins::date`, and is being tracked at #2098. #### Implements following methods - [x] `new Date()` - [x] `Date.prototype.getDate()` - [x] `Date.prototype.getDay()` - [x] `Date.prototype.getFullYear()` - [x] `Date.prototype.getHours()` - [x] `Date.prototype.getMilliseconds()` - [x] `Date.prototype.getMinutes()` - [x] `Date.prototype.getMonth()` - [x] `Date.prototype.getSeconds()` - [x] `Date.prototype.getTime()` - [x] `Date.prototype.getTimezoneOffset()` - [x] `Date.prototype.getUTCDate()` - [x] `Date.prototype.getUTCDay()` - [x] `Date.prototype.getUTCFullYear()` - [x] `Date.prototype.getUTCHours()` - [x] `Date.prototype.getUTCMilliseconds()` - [x] `Date.prototype.getUTCMinutes()` - [x] `Date.prototype.getUTCMonth()` - [x] `Date.prototype.getUTCSeconds()` - [x] `Date.prototype.getYear()` - [x] `Date.now()` - [ ] `Date.parse()` Issue 4 - [x] `Date.prototype.setDate()` - [x] `Date.prototype.setFullYear()` - [ ] `Date.prototype.setHours()` Issue 3 - [x] `Date.prototype.setMilliseconds()` - [ ] `Date.prototype.setMinutes()` Issue 3 - [x] `Date.prototype.setMonth()` - [x] `Date.prototype.setSeconds()` - [x] `Date.prototype.setTime()` - [x] `Date.prototype.setUTCDate()` - [x] `Date.prototype.setUTCFullYear()` - [x] `Date.prototype.setUTCHours()` - [x] `Date.prototype.setUTCMilliseconds()` - [x] `Date.prototype.setUTCMinutes()` - [x] `Date.prototype.setUTCMonth()` - [x] `Date.prototype.setUTCSeconds()` - [x] `Date.prototype.setYear()` - [ ] `Date.prototype.toDateString()` Issue 5 - [ ] `Date.prototype.toGMTString()` Issue 5 - [ ] `Date.prototype.toISOString()` Issue 5 - [ ] `Date.prototype.toJSON()` Issue 5 - [ ] `Date.prototype.toLocaleDateString()` Issue 5 and 6 - [ ] `Date.prototype.toLocaleString()` Issue 5 and 6 - [ ] `Date.prototype.toLocaleTimeString()` Issue 5 and 6 - [ ] `Date.prototype.toString()` Issue 5 - [ ] `Date.prototype.toTimeString()` Issue 5 - [ ] `Date.prototype.toUTCString()` Issue 5 - [x] `Date.UTC()` - [x] `Date.prototype.valueOf()` ### Issues 1. ~~`get_*()` and some other methods - They take `&self` as input internally, and internal struct shouldn't be used in a wrapper API. Therefore, these would require input to be `this: &JsValue, args: &[JsValue], context: &mut Context` like others and use `this_time_value()`?~~ Fixed using `this_time_value()` 2. ~~`to_string()`- how can I use `Date::to_string()` rather than `alloc::string::ToString`.~~ My bad it compiles, just `rust-analyzer` was showing it as an issue. 3. `set_hours()` and `set_minutes()` - they subtract local timezones when setting the value, e.g. - On further look: ```rust // both function call `builtins:📅:mod.rs#L1038 this.set_data(ObjectData::date(t)); // `ObjectData::date` creates a new `Date` object `object::mods.rs#L423 // | this date is chrono::Date<Tz(TimezoneOffset)> and Tz default is being used here which is GMT+0 pub fn date(date: Date) -> Self { Self { kind: ObjectKind::Date(date), internal_methods: &ORDINARY_INTERNAL_METHODS, } } ``` - BTW, in `object::mod.rs`'s `enum ObjectKind` there is `Date(chrono::Date)` and it requires the generic argument, how is it being bypassed here? - Also in `set_minutes()` step 6, `LocalTime` should be used. ```rust // reference date = 2000-01-01T06:26:53.984 date.set_hours(&[23.into(), 23.into(), 23.into(), 23.into()], context)?; // would add tiemzone(+5:30) to it // Is 2000-01-01T17:53:23.023 // Should be 2000-01-01T23:23:23.023 ``` 4. `parse()` - it uses `chrono::parse_from_rfc3339` internally, while es6 spec recommends ISO8601. And it can also parse other formats like from [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse) `04 Dec 1995 00:12:00 GMT` which fails. So what should be done about it. 5. `to_*()` - This is more general, as the internal date object uses `chrono::NaiveDateTime` which doesn't have timezone. It doesn't account for `+4:00` in example below. ```rust // Creates new `Date` object from given rfc3339 string. let date = JsDate::new_from_parse(&JsValue::new("2018-01-26T18:30:09.453+04:00"), context); println!("to_string: {:?}", date2.to_string(context)?); // IS: Sat Jan 27 2018 00:00:09 GMT+0530 // Should: Fri Jan 26 2018 20:00:09 GMT+0530 ``` 6. `to_locale_*()` - requires [`ToDateTimeOptions`](https://402.ecma-international.org/9.0/#sec-todatetimeoptions) and localization would require chrono's `unstable-locales` feature, which is available for `DateTime` and not for `NaiveDateTime`. - I should have looked properly, `to_date_time_options` is already implemented in `builtins::intl`. Anyway, I would still need some tips on how to use it. What would function signature be like in wrapper API, how would `options` be passed to the said API. - So `to_date_time_options()` takes `options: &JsValue` as an argument and build an object from it and fetch properties through `Object.get()`. If I want `options` to be `{ weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }` what would `JsValue` look like to make it all work. ```rust date.to_locale_date_string(&[JsValue::new("en_EN"), OPTIONS], context)?; // OPTIONS need to be a JsValue which when converted into an object // have these properties { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; ``` ### Possible improvements 1. Right now, `object::jsdate::set_full_year()` and alike (input is a slice) are like below, `into()` doesn't feel ergonomic. ```rust #[inline] pub fn set_full_year(&self, values: &[JsValue], context: &mut Context) -> JsResult<JsValue> { Date::set_full_year(&self.inner.clone().into(), values, context) } // Usage date.set_full_year(&[2000.into(), 0.into(), 1.into()], context)?; // How can something like this be made to work #[inline] pub fn set_full_year<T>(&self, values: &[T], context: &mut Context) -> JsResult<JsValue> where T: Into<JsValue>, { | expected reference `&[value::JsValue]` | found reference `&[T]` Date::set_full_year(&self.inner.clone().into(), values, context) } ``` 2. Any other suggestion? |
2 years ago |
dependabot[bot] | fe280ec268 |
Bump sys-locale from 0.2.1 to 0.2.3 (#2420)
Bumps [sys-locale](https://github.com/1Password/sys-locale) from 0.2.1 to 0.2.3. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/1Password/sys-locale/releases">sys-locale's releases</a>.</em></p> <blockquote> <h2>v0.2.3</h2> <p>See <a href="https://github.com/1Password/sys-locale/blob/main/CHANGELOG.md#023---2022-11-06">the changelog</a> for details.</p> <h2>v0.2.2</h2> <p>See <a href="https://github.com/1Password/sys-locale/blob/main/CHANGELOG.md#022---2022-11-06">the changelog</a> for details.</p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/1Password/sys-locale/blob/main/CHANGELOG.md">sys-locale's changelog</a>.</em></p> <blockquote> <h2>[0.2.3] - 2022-11-06</h2> <h3>Fixed</h3> <ul> <li>Re-release 0.2.2 and correctly maintain <code>no_std</code> compatibility on Apple targets.</li> </ul> <h2>[0.2.2] - 2022-11-06</h2> <h3>Changed</h3> <ul> <li>The Apple backend has been rewritten in pure Rust instead of Objective-C.</li> </ul> <h3>Fixed</h3> <ul> <li>The locale returned on UNIX systems is now always a correctly formatted BCP-47 tag.</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
2 years ago |
raskad | 6c7240195a |
Add early error for `yield` in `GeneratorExpression` parameters (#2413)
This Pull Request changes the following: - Add early error for `yield` in `GeneratorExpression` parameters |
2 years ago |
Addison Crump | e64a20e2a6 |
Parser Idempotency Fuzzer (#2400)
This Pull Request offers a fuzzer which is capable of detecting faults in the parser and interner. It does so by ensuring that the parsed AST remains the same between a parsed source and the result of parsing the `to_interned_string` result of the first parsed source. It changes the following: - Adds a fuzzer for the parser and interner. Any issues I raise in association with this fuzzer will link back to this fuzzer. You may run the fuzzer using the following commands: ```bash $ cd boa_engine $ cargo +nightly fuzz run -s none parser-idempotency ``` Co-authored-by: Addison Crump <addison.crump@cispa.de> |
2 years ago |
José Julián Espina | b88736a5c9 |
Extract the parser into a crate (#2409)
Depends on #2408. This finally separates parsing from execution, which should make compilations a bit faster. |
2 years ago |
Iban Eguia Moraza | 23f0335bf1 |
Reduced boilerplate code in the parser (#2410)
This PR adds an `OrAbrupt` trait, with the `or_abrupt()` function. This function is equivalent to the previous `?.ok_or(ParseError::AbruptEnd)`, but it's cleaner. It's implemented for the parser cursor results types. It also adds an `advance()` function to the parser cursor (which might be possible to optimize further), that just advances the cursor without returning any token. This shows a clearer intent in many places where it's being used. I also used `ParseResult` in more places, since we were not using it in many places. |
2 years ago |
José Julián Espina | 8a664f2f24 |
Make `JsString` conform to miri tests (#2412)
This PR rewrites some patterns of the `JsString` implementation in order to pass all its miri tests. This can be verified by running: ```bash cargo +nightly miri test -p boa_engine string::tests -- --skip builtins --skip parser ``` Basically, we were doing two operations that were Undefined Behaviour per the [Stacked Borrows](https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md) model: - Casting `&JsString` to `&mut RawJsString` to `&[u16]`. The intermediate mutable borrow must not exist, or Miri considers this as Undefined Behaviour. - Trying to access `RawJsString.data` using the dot operator. Miri complains with `this is a zero-size retag ([0x10..0x10]) so the tag in question does not exist anywhere`. To fix this, we can recompute the position of `data` every time we want to access it. |
2 years ago |
José Julián Espina | 8e14d76893 |
Rewrite scope analysis operations using visitors (#2408)
This PR rewrites all syntax-directed operations that find declared names and variables using visitors.
Hopefully, this should be the last step before finally being able to separate the parser from the engine.
I checked the failing [tests](
|
2 years ago |
José Julián Espina | aad78154cf |
Pretty print promise objects (#2407)
Right now our promises print `{ }` on display. This PR improves a bit the display and ergonomics of promises in general. Now, promises will print... - When pending: `Promise { <pending> }` - When fulfilled: `Promise { "hi" }` - When rejected: `Promise { <rejected> ReferenceError: x is not initialized }` |
2 years ago |
José Julián Espina | 91235c77fe |
Rewrite some patterns with let-else and ok_or_else (#2404)
This Pull Request updates the codebase to the newest version of rustc (1.65.0). It changes the following: - Bumps `rust-version` to 1.65.0. - Rewrites some snippets to use the new let else, ok_or_else and some other utils. - Removes the `rustdoc::missing_doc_code_examples` allow lint from our codebase. (Context: https://github.com/rust-lang/rust/pull/101732) |
2 years ago |
raskad | dc3b09a001 |
Implement async arrow functions (#2393)
This Pull Request fixes #1805. It changes the following: - Implement async arrow function parsing and execution. - Handle special case when a function expressions binding identifier need to be bound in the function body. - Implement special silent ignored assignment for the above case. - Fix issue with getting the correct promise capability for function returns. - Complete function object `toString` todo. I will fix the two failing assignmenttargettype tests in a follow up PR. |
2 years ago |
José Julián Espina | 49a58675cc |
Replace `contains` and friends with visitors (#2403)
This Pull Request replaces `contains`, `contains_arguments`, `has_direct_super` and `function_contains_super` with visitors. (~1000 removed lines!) Also, the new visitor implementation caught a bug where we weren't setting the home object of async functions, generators and async generators for methods of classes, which caused a stack overflow on `super` calls, and I think that's pretty cool! Next is `var_declared_names`, `lexically_declared_names` and friends, which will be on another PR. |
2 years ago |
José Julián Espina | b4da172f91 |
Extract the ast to a crate (#2402)
This should hopefully improve our compilation times, both from a clean build and from an incremental compilation snapshot. Next would be the parser, but it imports `Context`, so it'll require a bit more work. The number of file changes is obviously big, but almost nothing was changed, I just moved everything to another crate and readjusted the imports of the `parser` module. (Though, I did have to change some details, because there were some functions on the ast that returned `ParseError`s, and the tests had to be moved to the parser) |
2 years ago |
Addison Crump | b5b8cdfa18 |
Implement AST Visitor pattern (attempt #3) (#2392)
This Pull Request closes no specific issue, but allows for analysis and post-processing passes by both internal and external developers. It changes the following: - Adds a Visitor trait, to be implemented by visitors of a particular node type. - Adds `Type`Visitor traits which offer access to private members of a node. - Adds an example which demonstrates the use of Visitor traits by walking over an AST and printing its contents. At this time, the PR is more of a demonstration of intent rather than a full PR. Once it's in a satisfactory state, I'll mark it as not a draft. Co-authored-by: Addison Crump <addison.crump@cispa.de> |
2 years ago |