-
-
Notifications
You must be signed in to change notification settings - Fork 406
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 generator execution #1790
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overal design looks very reasonable from my side, but I still didn't get the chance to get into the VM a lot, so I'm not sure.
I would like to see how the conformance changes if we don't ignore generators in the test_ignore file, and I added some comments on a couple of things that could be interesting.
Also, for this to be mergeable I'm missing some Debug&Copy implementations and some documentation in some structures and en una, but looks very promising!
I ran the Test262 suite in my local machine, and it looks very, very promising:
The
So overall, 1,413 tests fixed, and 1.62% of coverage increase! This test is now failing, both in strict and non-strict modes (previously passing, but might have been just by chance):
These parser tests also fail (I guess we just need to re-check the AST changes and update the tests):
Unfortunately I got a panic one of the times I ran it: Test:
This panic seems to not happen always, and I was only able to reproduce it once, somehow. Might not be related to this PR. |
1d2493c
to
db8fff6
Compare
I re-based the branch to get the interner changes. |
I think the The panic seems unrelated to me. I will fix the parser tests and look at bitflags for the parameterlist. |
db8fff6
to
59bb076
Compare
Codecov Report
@@ Coverage Diff @@
## main #1790 +/- ##
==========================================
- Coverage 56.26% 46.67% -9.59%
==========================================
Files 201 204 +3
Lines 17940 16701 -1239
==========================================
- Hits 10094 7796 -2298
- Misses 7846 8905 +1059
Continue to review full report at Codecov.
|
59bb076
to
4c45301
Compare
I guess #1809 should be merged / discarded before this goes in. But for the rest, what is this missing? Seems pretty good, right? |
#1809 merged! 😄 |
4c45301
to
af87126
Compare
Rebased on top of #1829. |
af87126
to
cde17cb
Compare
Benchmark for 3e83868Click to view benchmark
|
Benchmark for dd000b8Click to view benchmark
|
cde17cb
to
369d23e
Compare
Benchmark for 00682bbClick to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Looks pretty good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides some very small things. This looks very good to me :)
Awesome work @raskad !
@@ -192,7 +196,7 @@ impl Function { | |||
pub fn is_constructor(&self) -> bool { | |||
match self { | |||
Self::Native { constructor, .. } | Self::Closure { constructor, .. } => *constructor, | |||
Self::VmOrdinary { code, .. } => code.constructor, | |||
Self::VmOrdinary { code, .. } | Self::VmGenerator { code, .. } => code.constructor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should rename VmOrdinary
=> Ordinary
and VmGenerator
=> Generator
, This is an artifact from when we had an AST walker and I named it with a Vm
prefix so we could have the vm and AST walker and work on both at the same time. But now I don't see a reason to keep that naming since there is only a vm now.
.property( | ||
WellKnownSymbols::to_string_tag(), | ||
"Generator", | ||
Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE, | |
Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE, |
VM implementation
Fixed tests (1387):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good! I added some comments, mostly about documentation, but also about some structures which could implement some extra traits, and some Copy
implementations could speed things up a little bit.
369d23e
to
486ca8e
Compare
Benchmark for 16a33caClick to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good now! I added a couple of suggestions. Feel free to implement them or merge them, they are not very critical :)
let mut flags = FormalParameterListFlags::empty(); | ||
if is_simple { | ||
flags |= FormalParameterListFlags::IS_SIMPLE; | ||
} | ||
if has_duplicates { | ||
flags |= FormalParameterListFlags::HAS_DUPLICATES; | ||
} | ||
if has_rest_parameter { | ||
flags |= FormalParameterListFlags::HAS_REST_PARAMETER; | ||
} | ||
if has_expressions { | ||
flags |= FormalParameterListFlags::HAS_EXPRESSIONS; | ||
} | ||
if has_arguments { | ||
flags |= FormalParameterListFlags::HAS_ARGUMENTS; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be more efficient if it's set when the booleans are defined. So, instead of using those booleans, add the flags when they are defined. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So obvious I didn't even notice it :D
#[unsafe_ignore_trace] | ||
pub(crate) state: GeneratorState, | ||
|
||
// The `[[GeneratorContext]]` internal slot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The `[[GeneratorContext]]` internal slot. | |
/// The `[[GeneratorContext]]` internal slot. |
Benchmark for 40f0953Click to view benchmark
|
bors r+ |
This Pull Request fixes/closes #1559. It changes the following: - Implement GeneratorFunction Objects - Implement Generator Objects - Implement generator execution in vm - Create `FormalParameterList` to remove duplicate checks on function parameters - Refactor `MethodDefinition` on object literals
Pull request successfully merged into main. Build succeeded: |
This Pull Request fixes/closes #1559.
It changes the following:
FormalParameterList
to remove duplicate checks on function parametersMethodDefinition
on object literals