Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement non-erased JsObjects #3618

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Implement non-erased JsObjects #3618

merged 1 commit into from
Jan 29, 2024

Conversation

jedel1043
Copy link
Member

@jedel1043 jedel1043 commented Jan 27, 2024

This PR implements non-erased JsObjects aka JsObject<T>. This allows accessing the inner data of an object without having to call downcast_ref/mut every time, which is a big ergonomics win that should avoid calling expect a lot of times.

This is an MVP that doesn't support calling internal methods using a JsObject<T>; adding support for that would require a slight redesign on the API. However, the current MVP is enough to support most of the use cases of the API in our builtin wrappers.

This also uses the new API to improve the JsArrayBuffer wrapper on some parts, but it still needs some more work that can be done on subsequent PRs.

Thanks to @HalidOdat for nerd-sniping me into implementing this 🤣

@jedel1043 jedel1043 added enhancement New feature or request API labels Jan 27, 2024
@jedel1043 jedel1043 added this to the v0.18.0 milestone Jan 27, 2024
@jedel1043 jedel1043 requested a review from a team January 27, 2024 07:26
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 95,960 95,960 0
Passed 76,594 76,594 0
Ignored 18,477 18,477 0
Failed 889 889 0
Panics 0 0 0
Conformance 79.82% 79.82% 0.00%

Copy link

codecov bot commented Jan 27, 2024

Codecov Report

Attention: 72 lines in your changes are missing coverage. Please review.

Comparison is base (6be4296) 47.46% compared to head (7c1fa18) 47.43%.

Files Patch % Lines
core/engine/src/object/jsobject.rs 54.28% 32 Missing ⚠️
core/engine/src/builtins/typed_array/builtin.rs 0.00% 16 Missing ⚠️
core/engine/src/object/builtins/jsarraybuffer.rs 0.00% 15 Missing ⚠️
core/engine/src/object/builtins/jsdataview.rs 0.00% 4 Missing ⚠️
core/engine/src/builtins/array_buffer/mod.rs 0.00% 3 Missing ⚠️
core/engine/src/builtins/array_buffer/utils.rs 0.00% 1 Missing ⚠️
core/gc/src/pointers/ephemeron.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3618      +/-   ##
==========================================
- Coverage   47.46%   47.43%   -0.04%     
==========================================
  Files         475      476       +1     
  Lines       46044    46082      +38     
==========================================
+ Hits        21855    21857       +2     
- Misses      24189    24225      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @jedel1043! :)

Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 😄

@nekevss nekevss added this pull request to the merge queue Jan 29, 2024
Merged via the queue into main with commit 0872238 Jan 29, 2024
14 checks passed
@jedel1043 jedel1043 deleted the non-erased-objects branch January 29, 2024 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants