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

[Merged by Bors] - Implement JsArrayBuffer #2170

Closed
wants to merge 1 commit into from

Conversation

HalidOdat
Copy link
Member

This PR adds the ArrayBuffer rust wrapper. It also provides a capability to construct a JsArrayBuffer from a user defined blob of data ( Vec<u8> ) and it is not cloned, it is directly used as the internal buffer.

This allows us to replace the inifficent Vec<u8> to JsArray then to TypedArray (in typed arrays from_iter), with a JsArrayBuffer created from user data to TypedArray. With this Vec<u8> to JsTypedArray should be fully fixed as discussed in #2058.

@HalidOdat HalidOdat added enhancement New feature or request performance Performance related changes and issues API labels Jul 7, 2022
@HalidOdat HalidOdat added this to the v0.16.0 milestone Jul 7, 2022
- Added example `jsarraybuffer.rs`
@github-actions
Copy link

github-actions bot commented Jul 7, 2022

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 90,847 90,847 0
Passed 59,090 59,090 0
Ignored 14,012 14,012 0
Failed 17,745 17,745 0
Panics 0 0 0
Conformance 65.04% 65.04% 0.00%

@codecov
Copy link

codecov bot commented Jul 7, 2022

Codecov Report

Merging #2170 (0f88f7b) into main (5bbc225) will decrease coverage by 0.09%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #2170      +/-   ##
==========================================
- Coverage   42.28%   42.19%   -0.10%     
==========================================
  Files         228      229       +1     
  Lines       21167    21206      +39     
==========================================
- Hits         8951     8948       -3     
- Misses      12216    12258      +42     
Impacted Files Coverage Δ
boa_engine/src/builtins/array_buffer/mod.rs 9.77% <0.00%> (ø)
boa_engine/src/object/jsarraybuffer.rs 0.00% <0.00%> (ø)
boa_engine/src/object/jstypedarray.rs 0.00% <ø> (ø)
boa_engine/src/object/mod.rs 20.86% <ø> (-0.14%) ⬇️
boa_engine/src/syntax/ast/node/spread/mod.rs 57.14% <0.00%> (-14.29%) ⬇️
...parser/expression/primary/array_initializer/mod.rs 38.88% <0.00%> (-1.86%) ⬇️
boa_engine/src/vm/mod.rs 48.09% <0.00%> (-0.19%) ⬇️
...a_engine/src/syntax/parser/statement/switch/mod.rs 39.53% <0.00%> (+1.16%) ⬆️
...a_engine/src/syntax/ast/node/statement_list/mod.rs 81.25% <0.00%> (+3.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bbc225...0f88f7b. Read the comment docs.

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

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

Looks really good! Thanks!!

@raskad
Copy link
Member

raskad commented Jul 7, 2022

bors r+

bors bot pushed a commit that referenced this pull request Jul 7, 2022
This PR adds the `ArrayBuffer` rust wrapper. It also provides a capability to construct a `JsArrayBuffer` from a user defined blob of data ( `Vec<u8>` ) and it is not cloned, it is directly used as the internal buffer.

This allows us to replace the inifficent `Vec<u8>` to `JsArray` then to `TypedArray` (in typed arrays `from_iter`), with a `JsArrayBuffer` created from user data to `TypedArray`. With this `Vec<u8>` to `JsTypedArray` should be fully fixed as discussed in #2058.
@bors
Copy link

bors bot commented Jul 7, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Implement JsArrayBuffer [Merged by Bors] - Implement JsArrayBuffer Jul 7, 2022
@bors bors bot closed this Jul 7, 2022
@bors bors bot deleted the feature/jsarraybuffers branch July 7, 2022 17:54
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 performance Performance related changes and issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants