mirror of https://github.com/boa-dev/boa.git
Tree:
1356a5efd6
add-vhs-ci
benchmarks
bump-test262
control-flow-graph
dependabot/cargo/rust-dependencies-50dc4690b8
expect-lints
feature/node_span
feature/snapshot
features
gh-readonly-queue/main/pr-2877-b0ddf5eed00a53281d67fc7d846233fc0d99ce9c
gh-readonly-queue/main/pr-3144-8e48cec73fae708420b9af88813d4870243c491a
local-parameters-if-mapped-arguments-object-not-accessed
main
nan-boxing
optimization/static-shapes
real_conformance
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.20
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 }
477 Commits (1356a5efd688cfcde68fa1ca537f144d78d8170d)
Author | SHA1 | Message | Date |
---|---|---|---|
raskad | 6c8e9c7070 |
Avoid creating `prototype` property on methods (#2553)
This Pull Request changes the following: - Stop creating a `prototype` property on class methods by passing a flag to the relevant opcodes. |
2 years ago |
raskad | 9355c77e0b |
Fix error for static class methods named `prototype` (#2552)
This Pull Request changes the following: - Remove wrong early errors for static class methods with the computed property name `prototype`. - Switch static class method definition opcodes from `__define_own_property__` to `define_property_or_throw` to correctly throw runtime errors on property redefinitions. |
2 years ago |
raskad | 96a6e0a346 |
Return the correct value from a statement list (#2554)
When compiling a statement list we need to make sure that the last expression that returns a value is compiled with the `use_expr` flag. Currently we set `use_expr` on the last statement of the statement list. This leads to incorrect returns when the last statement does not return a value. This PR fixes this by looking up the last value returning expression in a statement list and setting the `use_expr` appropriately. |
2 years ago |
José Julián Espina | 7c9eef8edc |
Improve the design of ephemerons in our GC (#2530)
This PR changes the following: - Modifies `EphemeronBox` to be more akin to `GcBox`, with its own header, roots and markers. This also makes it more similar to [Racket's](https://docs.racket-lang.org/reference/ephemerons.html) implementation. - Removes `EPHEMERON_QUEUE`. - Ephemerons are now tracked on a special `weak_start` linked list, instead of `strong_start` which is where all other GC boxes live. - Documents all unsafe blocks. - Documents our current garbage collection algorithm. I hope this'll clarify a bit what exactly are we doing on every garbage collection. - Renames/removes some functions. |
2 years ago |
Kevin | 90d310b184 |
Labelled ByteCompiler Fix (#2534)
<!--- 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 addresses #2295, and another case that I came across when I was adding `Break` to the `ByteCompiler` I did have a question that came up during this regarding the spec. We currently don't implement the [BreakableStatement](https://tc39.es/ecma262/#prod-BreakableStatement). Any thoughts on whether we should be? Especially since `BreakableStatement` seems to be a bit of a inaccurate since `LabelledStatement` is breakable too. It changes the following: - Moves handling of label jump out of `compile_block` and into `compile_labelled`. - Adds a couple more tests to keep track of `LabelledStatement` breaks. Co-authored-by: Ness <Kevin.Ness@Staples.com> |
2 years ago |
José Julián Espina | 5ab0aa21cc |
Implement host hooks and job queues APIs (#2529)
Follows from #2528, and should complement #2411 to implement the module import hooks. ~~Similarly to the Intl/ICU4X PR (#2478), this has a lot of trivial changes caused by the new lifetimes. I thought about passing the queue and the hooks by value, but it was very painful having to wrap everything with `Rc` in order to be accessible by the host. In contrast, `&dyn` can be easily provided by the host and has the advantage of not requiring additional allocations, with the downside of adding two more lifetimes to our `Context`, but I think it's worth.~~ I was able to unify all lifetimes into the shortest one of the three, making our API just like before! Changes: - Added a new `HostHooks` trait and a `&dyn HostHooks` field to `Context`. This allows hosts to implement the trait for their custom type, then pass it to the context. - Added a new `JobQueue` trait and a `&dyn JobQueue` field to our `Context`, allowing custom event loops and other fun things. - Added two simple implementations of `JobQueue`: `IdleJobQueue` which does nothing and `SimpleJobQueue` which runs all jobs until all successfully complete or until any of them throws an error. - Modified `boa_cli` to run all jobs until the queue is empty, even if a job returns `Err`. This also prints all errors to the user. |
2 years ago |
José Julián Espina | 08e5e46117 |
Make `JsSymbol` thread-safe (#2539)
The section about `Symbol` on the [specification](https://tc39.es/ecma262/#sec-ecmascript-language-types-symbol-type) says: > The Symbol type is the set of all non-String values that may be used as the key of an Object property ([6.1.7](https://tc39.es/ecma262/#sec-object-type)). Each possible Symbol value is unique and immutable. Our previous implementation of `JsSymbol` used `Rc` and a thread local `Cell<usize>`. However, this meant that two different symbols in two different threads could share the same hash, making symbols not unique. Also, the [GlobalSymbolRegistry](https://tc39.es/ecma262/#table-globalsymbolregistry-record-fields) is meant to be shared by all realms, including realms that are not in the same thread as the main one; this forces us to replace our current thread local global symbol registry with a thread-safe one that uses `DashMap` for concurrent access. However, the global symbol registry uses `JsString`s as keys and values, which forces us to either use `Vec<u16>` instead (wasteful and needs to allocate to convert to `JsString` on each access) or make `JsString` thread-safe with an atomic counter. For this reason, I implemented the second option. This PR changes the following: - Makes `JsSymbol` thread-safe by using Arc instead of Rc, and making `SYMBOL_HASH_COUNT` an `AtomicU64`. - ~~Makes `JsString` thread-safe by using `AtomicUsize` instead of `Cell<usize>` for its ref count.~~ EDIT: Talked with @jasonwilliams and we decided to use `Box<[u16]>` for the global registry instead, because this won't penalize common usage of `JsString`, which is used a LOT more than `JsSymbol`. - Makes the `GLOBAL_SYMBOL_REGISTRY` truly global, using `DashMap` as our global map that is shared by all threads. - Replaces some thread locals with thread-safe alternatives, such as static arrays and static indices. - Various improvements to all related code for this. |
2 years ago |
raskad | 1269381ac8 |
Correctly parse consecutive semicolons (#2533)
This Pull Request changes the following: - Do not skip consecutive semicolons while parsing a `StatementList`. - Expect semicolon in `LexicalDeclaration` and add an special case for `for` loop parsing. - Adjust `StatementList` compilation to skip empty statements. - Adjust/add tests to make sure consecutive semicolons are correctly parsed. |
2 years ago |
Kevin | ff06690140 |
Clarity changes for the VM (#2531)
<!--- Thank you for contributing to Boa! Please fill out the template below, and remove or add any information as you feel necessary. ---> Some small changes to the VM with the hopes of making it a bit more clear and concise. It changes the following: - Changes `code` to `code_block` and `code` to `bytecode` in `CallFrame` and `CodeBlock`, respectively. - Adds some creation methods to `CallFrame`. - Implements `Default` for `Vm`. |
2 years ago |
raskad | 3dca430588 |
Refactor some class features (#2513)
This Pull Request fixes various bugs related to classes. The biggest changes are: - Changed private names to be unique across multiple classes. - Changed private name resolution to work via a visitor after a class is parsed. The way class early errors are defined makes it impossible to perform private name resolution while parsing. - Added function names to class methods. - Added class name binding to method function environments. - Separated opcodes for `static` and non-`static` class method definitions to make the above operations possible. There are still some bugs and further issues with classes but this is already a lot. |
2 years ago |
José Julián Espina | 1bef214a35 |
Prepare `Promises` for new host hooks and job queue API (#2528)
As part of the new modules PR, I was working on implementing the [host hooks](https://tc39.es/ecma262/#sec-host-hooks-summary) for the module import hooks and custom job queues. However, the promises module needed a bit of a refactor in order to couple with the new API. So, I thought it was a good idea to separate the promises refactor into its own PR, since the other PR is already big as it is. - Replaced some usages of `JobCallback` with a new `NativeJob` that isn't traced by the GC, since those closures are always rooted and executed by the `Context` globally. This will also allow hosts to pass their custom jobs to the job queue, and maybe could also accept futures in the Future (pun intended 😆). - Refactored several functions to account for the `HostPromiseRejectionTracker` hook which needs the promise `JsObject`. - Rewrote some patterns with newer Rust idioms. |
2 years ago |
Kevin | 989edd42c7 |
`Break` Opcode and `ByteCompiler` changes (#2523)
<!--- Thank you for contributing to Boa! Please fill out the template below, and remove or add any information as you feel necessary. ---> Hi all! 😄 This Pull Request addresses #2424. There are also a few changes made to the `ByteCompiler`, the majority of which are involving `JumpControlInfo`. It changes the following: - Adds `Break` Opcode - Shifts `compile_stmt` into the `statement` module. - Moves `JumpControlInfo` to it's own module. |
2 years ago |
José Julián Espina | edd404ba7f |
Redesign native functions and closures API (#2499)
This PR is a complete redesign of our current native functions and closures API.
I was a bit dissatisfied with our previous design (even though I created it 😆), because it had a lot of superfluous traits, a forced usage of `Gc<GcCell<T>>` and an overly restrictive `NativeObject` bound. This redesign, on the other hand, simplifies a lot our public API, with a simple `NativeCallable` struct that has several constructors for each type of required native function.
This new design doesn't require wrapping every capture type with `Gc<GcCell<T>>`, relaxes the trait requirement to `Trace + 'static` for captures, can be reused in both `JsObject` functions and (soonish) host defined functions, and is (in my opinion) a bit cleaner than the previous iteration. It also offers an `unsafe` API as an escape hatch for users that want to pass non-Copy closures which don't capture traceable types.
Would ask for bikeshedding about the names though, because I don't know if `NativeCallable` is the most precise name for this. Same about the constructor names; I added the `from` prefix to all of them because it's the "standard" practice, but seeing the API doesn't have any other method aside from `call`, it may be better to just remove the prefix altogether.
Let me know what you think :)
|
2 years ago |
raskad | 082d36280b |
Pass a receiver value in property getter opcodes (#2516)
This Pull Request changes the following: - Pass a receiver value to the object `get` function in the `GetPropertyBy*` opcodes. The receiver value may be different from the object, because `ToObject` is not called on it. |
2 years ago |
Veera | 616b7a4513 |
Remove `Literal::Undefined` (#2518)
<!--- 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 #2512 . Removes `Literal::Undefined` so that `undefined` is treated as an identifier name. Ran the parser's idempotency fuzzer and ensured the bug doesn't reproduce. |
2 years ago |
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 |