-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Initial implementation for increment/decrement in VM #1621
Initial implementation for increment/decrement in VM #1621
Conversation
@abhishekc-sharma looks good, could you explain the use of Access in your bytecode generation im not familiar with it or understand why it was used here. (im guessing because
Very good spot, im not sure why they're processed in reverse here, maybe @HalidOdat knows |
I agree @jasonwilliams , there's very little documentation currently. These should probably be addressed as part of #1608 and #1609. To be honest I based my implementation largely on the existing binary operators that also have a side effect similar to the increment/decrement operators like the assignment shorthand operations - Line 470 in 94992a4
My understanding from my quick survey through the code is that the Access enum represents any kind of variable, object access. The Also I wasn't sure if I was supposed to add any kind of tests for this new functionality and where am I supposed to add them. |
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 implementation looks good to me.
@abhishekc-sharma are you able to rebase? |
- Added two new opcodes Inc and Dec to the VM for increment and decrement. - Implementated compilation for Post/Pre Increment and Decrement operators to VM operations. - Implemented running the Inc and Dec opcodes on the VM.
6f6c832
to
34ea4f9
Compare
Done @jasonwilliams |
I think this is good to go. @abhishekc-sharma in regards to tests that’s a good question, we’re currently not testing the VM path so I think we’ll need to decide how to deal with that outside of this. Maybe a new discussion. |
- Added two new opcodes Inc and Dec to the VM for increment and decrement. - Implementated compilation for Post/Pre Increment and Decrement operators to VM operations. - Implemented running the Inc and Dec opcodes on the VM.
This Pull Request fixes/closes #1611
It changes the following:
I tested my implementation on some relatively complicated expressions and I did notice an issue. For example the following works correctly -
But the following does not -
I may be mistaken but this seems to be primarily because we evaluate arguments to function calls in reverse order and push them to the stack when making function calls -
boa/boa/src/bytecompiler.rs
Line 588 in 94992a4