-
Notifications
You must be signed in to change notification settings - Fork 687
Add Generator prototype custom dispatcher #3864
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
Add Generator prototype custom dispatcher #3864
Conversation
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony [email protected]
zherczeg
left a comment
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.
This custom dispatcher is a good idea!
| { | ||
| return ecma_builtin_generator_prototype_object_do (executable_object_p, | ||
| arguments_list_p[0], | ||
| ECMA_ITERATOR_RETURN); |
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.
What about putting the type into a local variable and call ecma_builtin_generator_prototype_object_do once after the switch?
| arguments_list_p[0], | ||
| ECMA_ITERATOR_RETURN); | ||
| } | ||
| default: |
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.
Instead of JERRY_UNREACHABLE, the last case (ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN) can be a default case, and put an assert which checks the type.
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'd still insist to the JERRY_UNREACHABLE solution.
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.
Why? It should be one less check to the compiler.
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 reason why I'm adding custom dispatchers is not just for the binary gain but so the code itself is more readable and uniform.
Imho using the default case with an assert is less "pretty" as simply using the switch cases. I would prefer it the way it is now too.
zherczeg
left a comment
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.
LGTM
rerobika
left a comment
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.
LGTM
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony [email protected]