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

Merge CodeBlock constant pools #3413

Merged
merged 2 commits into from Oct 26, 2023
Merged

Merge CodeBlock constant pools #3413

merged 2 commits into from Oct 26, 2023

Conversation

HalidOdat
Copy link
Member

This PR merges the literals, names, functions, compile_environments constant pools into one constant pool called constants

@HalidOdat HalidOdat added technical debt execution Issues or PRs related to code execution Internal Category for changelog labels Oct 24, 2023
@HalidOdat HalidOdat added this to the v0.18.0 milestone Oct 24, 2023
@HalidOdat HalidOdat requested a review from a team October 24, 2023 06:36
@github-actions
Copy link

github-actions bot commented Oct 24, 2023

Test262 conformance changes

Test result main count PR count difference
Total 95,609 95,609 0
Passed 75,978 75,978 0
Ignored 18,872 18,872 0
Failed 759 759 0
Panics 0 0 0
Conformance 79.47% 79.47% 0.00%

@HalidOdat HalidOdat requested a review from a team October 24, 2023 06:51
@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

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

Comparison is base (4a55990) 45.64% compared to head (a2a8472) 45.40%.
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3413      +/-   ##
==========================================
- Coverage   45.64%   45.40%   -0.24%     
==========================================
  Files         483      483              
  Lines       49517    49790     +273     
==========================================
+ Hits        22600    22609       +9     
- Misses      26917    27181     +264     
Files Coverage Δ
boa_engine/src/bytecompiler/env.rs 100.00% <100.00%> (ø)
boa_engine/src/environments/runtime/mod.rs 75.96% <ø> (ø)
boa_engine/src/object/internal_methods/function.rs 91.17% <100.00%> (+0.56%) ⬆️
boa_engine/src/vm/mod.rs 56.37% <ø> (ø)
boa_engine/src/vm/opcode/define/own_property.rs 77.08% <100.00%> (ø)
boa_engine/src/vm/opcode/delete/mod.rs 64.15% <100.00%> (+1.40%) ⬆️
boa_engine/src/vm/opcode/get/property.rs 76.27% <100.00%> (+0.83%) ⬆️
boa_engine/src/vm/opcode/push/literal.rs 69.44% <100.00%> (+4.92%) ⬆️
boa_engine/src/vm/opcode/set/property.rs 63.54% <100.00%> (+1.17%) ⬆️
boa_engine/src/bytecompiler/mod.rs 66.79% <93.33%> (-0.13%) ⬇️
... and 18 more

... and 26 files with indirect coverage changes

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

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.

Overall, this looks pretty good to me. Just had one thing regarding docs.

Definitely interested to see the new codeblock trace! 😄

return value.clone();
}

panic!("there should be a string constant at index {index}")
Copy link
Member

Choose a reason for hiding this comment

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

Can there be Panic docs added to these functions so they pass future lints.

Also, a little nitpicky aside, I don't dislike naming the functions as _expect. I do think it's clear, but would it be worthwhile being more explicit with _or_panic? I'm fine with either/or but wanted to at least mention it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we should remove the postfix? I only added it because we have .resolve_expect() and .environment_expect() to be consistent with the naming. But there isn't a rust guideline neither does the std lib do this.

Copy link
Member

@jedel1043 jedel1043 Oct 25, 2023

Choose a reason for hiding this comment

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

+1 to the suggestion about removing the suffix. It's not common for Rust APIs to name panicking functions with a suffix. It's much more common to panic by default, then offer try_* variants for non-panicking functions.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I was sort of thinking about the try_* naming convention when I was looking at it. It's much more common for us to return a JsResult throughout the engine as a default. So instead of adding try_* everywhere, adding some sort of naming convention on the panicking functions in our case might be a bit better clarity-wise.

That being said, sticking to the typical naming convention and removing the suffix is also a valid option.

Copy link
Member

@raskad raskad left a comment

Choose a reason for hiding this comment

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

Look good. I only have one very minor suggestion.

boa_engine/src/vm/code_block.rs Outdated Show resolved Hide resolved
@HalidOdat HalidOdat requested review from nekevss, jedel1043 and a team October 25, 2023 06:29
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.

This looks good to me 😄 Thanks for adding the panic docs!

@nekevss nekevss added this pull request to the merge queue Oct 26, 2023
Merged via the queue into main with commit fee4048 Oct 26, 2023
14 checks passed
@jedel1043 jedel1043 deleted the merge-constant-pools branch October 28, 2023 06:40
sam-finch-tezos pushed a commit to trilitech/boa that referenced this pull request Nov 29, 2023
* Merge `CodeBlock` constant pools

* Apply review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execution Issues or PRs related to code execution Internal Category for changelog technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants