1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:45:06 +00:00

LibJS: Add an EliminateLoads pass to Bytecode

This pass tries to eliminate repeated lookups of variables by name, by
remembering where these where last loaded to.

For now the lookup cache needs to be fully cleared with each call or
property access, because we do not have a way to check if these have any
side effects on the currently visible scopes.

Note that property accesses can cause getters/setters to be called, so
these are treated as calls in all cases.
This commit is contained in:
Hendiadyoin1 2022-10-22 20:23:47 +02:00 committed by Linus Groh
parent fafe498238
commit eb50969781
4 changed files with 208 additions and 0 deletions

View file

@ -233,6 +233,7 @@ Bytecode::PassManager& Interpreter::optimization_pipeline(Interpreter::Optimizat
pm->add<Passes::MergeBlocks>();
pm->add<Passes::GenerateCFG>();
pm->add<Passes::PlaceBlocks>();
pm->add<Passes::EliminateLoads>();
} else {
VERIFY_NOT_REACHED();
}