Commit graph

14 commits

Author SHA1 Message Date
MacDue
17a5af04e3 LibJS: Actually generate the bytecode CFG
This is just something I spotted looking around the code, previously
the PassPipelineExecutable was passed by value to
generate_cfg_for_block, which generated the CFG then just dropped it on
the floor. Making this a reference results in the CFG actually getting
generated.
2023-07-21 06:59:51 +02:00
Luke Wilde
d66eb4e3ba LibJS/Bytecode: Add Await and AsyncIteratorClose instructions 2023-07-15 01:08:52 +02:00
Daniel Bertalan
be7bc41470 LibJS: Fix mix-up between assignment and comparison 2023-05-02 07:03:57 -04:00
Hendiadyoin1
170f732000 LibJS: Fix a bunch of unwind related errors in GenerateCFG
We were missing some unwind related control flow paths, and followed
some in improper ways, leading us to access a dead unwind frame in some
cases, as well as generating a technically wrong CFG.

This reorders the ways EnterUnwindContext works and alleviates those
errors.
2023-03-17 09:57:51 +00:00
Andreas Kling
359d6e7b0b Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Hendiadyoin1
8e5ebb04f4 LibJS: Use a pseudo top-level UnwindFrame in GenerateCFG
Previously we assumed that there is always one such frame, now there is.
2023-02-26 23:09:37 +01:00
Hendiadyoin1
f5376cb282 LibJS: Generate unwind chains for break in Bytecode
This uses a newly added instruction `ScheduleJump`
This instruction tells the finally proceeding it, that instead of
jumping to it's next block it should jump to the designated block.
2023-02-26 19:40:09 +01:00
Hendiadyoin1
495ba53e46 LibJS: Correctly handle unwind frames in the GenerateCFG pass
To achieve this it now uses recursive descend, to make the state
managements easier.

With this we now correctly handle try-catch-finally blocks correctly,
modeling all possible controll flows between these blocks, which allows
analysis and optimization passes to make more accurate descisions about
accessibility of the enclosed blocks
2023-02-26 19:40:09 +01:00
Hendiadyoin1
5181957da5 LibJS: VERIFY on unknown terminator opcodes in GenerateCFG
If we mess up in here it could break promises later optimization stages
assume, so rather than having wrong results, make it scream as load as
it can.
2023-02-26 19:40:09 +01:00
Hendiadyoin1
133faa0acc LibJS: Remove FinishUnwind instruction
This is essentially a LeaveUnwind+Jump, so lets just do that, that will
make it easier to optimize it, or see unwind state transitions
2022-12-06 16:09:24 +03:30
Hendiadyoin1
a00c421d61 LibJS: Handle FinishUnwind in GenerateCFG 2022-12-03 17:07:30 +03:30
Hendiadyoin1
ded7545db1 LibJS: Use a switch statement in GenerateCFG 2022-12-03 17:07:30 +03:30
Matthew Olsson
f39ab2e60a LibJS: Add JumpUndefined bytecode 2021-06-19 09:38:26 +02:00
Ali Mohammad Pur
1414c7b049 LibJS: Add a basic pass manager and add some basic passes
This commit adds a bunch of passes, the most interesting of which is a
pass that merges blocks together, and a pass that places blocks that
flow into each other next to each other, and a very simply pass that
removes duplicate basic blocks.
Note that this does not remove the jump at the end of each block in that
pass to avoid scope creep in the passes.
2021-06-15 22:06:33 +04:30