Implement Performance.now() and Performance.timeOrigin
Adds implementation of the W3C High Resolution Time API's performance.now() method and performance.timeOrigin getter property.
Some benchmarks use this if available, which hopefully will remove the very big fluctuations in performance measurement.
Test262 conformance changes
| Test result | main count | PR count | difference |
|---|---|---|---|
| Total | 52,598 | 52,598 | 0 |
| Passed | 49,385 | 49,385 | 0 |
| Ignored | 2,134 | 2,134 | 0 |
| Failed | 1,079 | 1,079 | 0 |
| Panics | 0 | 0 | 0 |
| Conformance | 93.89% | 93.89% | 0.00% |
Codecov Report
:x: Patch coverage is 68.42105% with 12 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 57.35%. Comparing base (6ddc2b4) to head (cb87a90).
:warning: Report is 617 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #4551 +/- ##
===========================================
+ Coverage 47.24% 57.35% +10.11%
===========================================
Files 476 505 +29
Lines 46892 57964 +11072
===========================================
+ Hits 22154 33248 +11094
+ Misses 24738 24716 -22
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Ideally this should inherit from EventTarget (not implemented) have some work on that in a separate PR.
Ideally this should inherit from EventTarget
@HalidOdat I was starting work on class inheritance with that specifically in mind, but hit a road block and inheritance in Rust currently is broken. Do you have pointers to help?
Oh didn't know you where working on that... the way I implemented it was on the boa_class by adding a #[boa(inherit)] that can be added to a method that takes context and returns JsResult<JsObject> (returns the prototype to be inherited) (see here).
Since we can attach custom host fields on the realm, I was thinking of adding an RuntimeIntrinsics (like we do on boa_engine) and that can be accessed (through the context) and we can get the prototype. This avoids having to do globalThis gets.
Having the inherit being an attribute on the class is more natural and closer to what JavaScript really does. Here's my PR: https://github.com/boa-dev/boa/pull/4431/changes#diff-37970e7d817d4316a093bb967d74ff7e26d9c6c01d93f5a79d3d195ba9f6155bR389
Also this allows for JS classes to inherit Rust classes which inherit JS classes, etc.
I think the main blocker is that Rust's JsObject prototype stuff is broken and doesn't work. I could get it to work for static methods but not instance, for some reason. We also need to figure out a way to call super from the base class (I think I had JsSuper as an argument in that PR).