-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Redesign bytecode virtual machine #1361
Conversation
Benchmark for 247eb6dClick to view benchmark
|
Benchmark for 54fb08eClick to view benchmark
|
Looks good so far, and yes i was hoping to reduce the bytecodes down to actual codes rather than fat enums. Thanks for refactoring this. |
Benchmark for 725a2c8Click to view benchmark
|
Benchmark for 5d799faClick to view benchmark
|
Test262 conformance changes:
|
This is ready to review/merge :) I wanted to add more stuff like function/calls and catching error (both require a lot of change to the current execution scheme, call frames and stack unwinding). But I already added a lot in this PR, so I will leave this for separate PRs after this gets merged. Hopefully in the near future we will completely replace the AST walker executor. |
Benchmark for 62e7ae6Click to view benchmark
|
Benchmark for 9f20035Click to view benchmark
|
Benchmark for b1df807Click to view benchmark
|
Benchmark for bea70aaClick to view benchmark
|
Benchmark for 8598a21Click 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 :) I think this will improve how we build the VM. Dividing statements, expressions and so on in Node
should improve the big matches.
- Implemented Jump and JumpIfFalse opcodes - Implemented If in vm - Implement assign to identifiers - Implement JumpIfTrue opcode - Implemented short circuit operators - Implement while loop - Implement do-while loop - Pop expressions - Split compilation for epression and statement - simplify boolean compilation - Implement loop break and continue with labels - Implement getting property from object - Implement setting object properties - Implement binary assign - Implement throw - Split variable names from literals - Implement conditional operator - Implement array expressions without spread - Implement some unary operators - Add accessor types - Implement this - Add opcode for pushing rationals - Implement instanceof operator
Benchmark for 25179caClick to view benchmark
|
Will take a look today/tomorrow hopefully |
Lets merge this, so other features are not blocked :) |
The previous virtual machine was not really a bytecode vm, since did not interpret bytecode, rather it interpreted and array of fat enums, while this is easier to implement is has bad space efficiency (also bad performance), one instruction was 32 bytes (on 64-bit machine) and consequently all other instructions where 32 bytes.
So for this code:
It would take 64 bytes. But now with an actual bytecode vm we only need 2 bytes.
Also implemented some other stuff:
If-else
while
do-while
break
continue
&&
,||
,??
)?:
)[1, 2, 3, 4]
)this
instanceof
operator