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] - Avoid creating prototype property on methods #2553

Closed
wants to merge 1 commit into from

Conversation

raskad
Copy link
Member

@raskad raskad commented Jan 21, 2023

This Pull Request changes the following:

  • Stop creating a prototype property on class methods by passing a flag to the relevant opcodes.

@raskad raskad added bug Something isn't working vm Issues and PRs related to the Boa Virtual Machine. labels Jan 21, 2023
@raskad raskad added this to the v0.17.0 milestone Jan 21, 2023
@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 94,205 94,205 0
Passed 70,624 70,634 +10
Ignored 18,622 18,622 0
Failed 4,959 4,949 -10
Panics 0 0 0
Conformance 74.97% 74.98% +0.01%
Fixed tests (10):
test/language/statements/class/definition/getters-prop-desc.js [strict mode] (previously Failed)
test/language/statements/class/definition/getters-prop-desc.js (previously Failed)
test/language/statements/class/definition/numeric-property-names.js [strict mode] (previously Failed)
test/language/statements/class/definition/numeric-property-names.js (previously Failed)
test/language/statements/class/definition/accessors.js [strict mode] (previously Failed)
test/language/statements/class/definition/accessors.js (previously Failed)
test/language/statements/class/definition/setters-prop-desc.js [strict mode] (previously Failed)
test/language/statements/class/definition/setters-prop-desc.js (previously Failed)
test/language/statements/class/definition/methods.js [strict mode] (previously Failed)
test/language/statements/class/definition/methods.js (previously Failed)

@codecov
Copy link

codecov bot commented Jan 21, 2023

Codecov Report

Merging #2553 (51c7a21) into main (f19467a) will increase coverage by 0.22%.
The diff coverage is 17.14%.

@@            Coverage Diff             @@
##             main    #2553      +/-   ##
==========================================
+ Coverage   49.99%   50.21%   +0.22%     
==========================================
  Files         379      376       -3     
  Lines       37642    37478     -164     
==========================================
+ Hits        18819    18821       +2     
+ Misses      18823    18657     -166     
Impacted Files Coverage Δ
boa_engine/src/builtins/function/mod.rs 30.05% <0.00%> (-0.43%) ⬇️
boa_engine/src/bytecompiler/class.rs 0.00% <0.00%> (ø)
boa_engine/src/vm/flowgraph/mod.rs 0.00% <0.00%> (ø)
boa_engine/src/vm/opcode/get/generator.rs 0.00% <0.00%> (ø)
boa_engine/src/vm/opcode/mod.rs 45.45% <ø> (ø)
boa_engine/src/vm/code_block.rs 30.55% <20.00%> (-0.05%) ⬇️
boa_engine/src/bytecompiler/mod.rs 58.08% <50.00%> (-0.03%) ⬇️
boa_engine/src/vm/opcode/get/function.rs 50.00% <50.00%> (ø)
boa_engine/src/vm/mod.rs 48.75% <0.00%> (-1.00%) ⬇️
boa_examples/src/bin/closures.rs
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -138,6 +138,7 @@ impl ByteCompiler<'_, '_> {
let index = self.code_block.functions.len() as u32;
self.code_block.functions.push(code);
self.emit(Opcode::GetFunction, &[index]);
self.emit_u8(0);
Copy link
Member

@nekevss nekevss Jan 23, 2023

Choose a reason for hiding this comment

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

Thoughts on creating an emit method like emit_with_opcode_and_u8 (maybe not the best name) to bind the pushing of the two operands together?

Edit: maybe even better emit_opcode_with_operand_and_bool, it's a long name, but then you can feed index and true/false as the arguments.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we could maybe generate emit functions for every opcode via a macro e.g. Opcode::GetFunction::emit. These functions could then automatically take the correct arguments.
Do we want to create a dedicated issue for making bytecode generation more typesafe?

Copy link
Member

@nekevss nekevss Jan 24, 2023

Choose a reason for hiding this comment

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

Yeah, that would make sense to me. Submitted an issue #2561 😄

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.

The rest looks good to me :)

Copy link
Member

@jedel1043 jedel1043 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!

@jedel1043
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Jan 24, 2023
This Pull Request changes the following:

- Stop creating a `prototype` property on class methods by passing a flag to the relevant opcodes.
@bors
Copy link

bors bot commented Jan 24, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Avoid creating prototype property on methods [Merged by Bors] - Avoid creating prototype property on methods Jan 24, 2023
@bors bors bot closed this Jan 24, 2023
@bors bors bot deleted the remove-method-prototype-property branch January 24, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants