summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
diff options
context:
space:
mode:
authorHendiadyoin1 <leon.a@serenityos.org>2022-10-22 20:23:47 +0200
committerLinus Groh <mail@linusgroh.de>2022-12-03 15:25:05 +0000
commiteb50969781ab11d9253ae7c27600132c8fc19ad6 (patch)
tree2e30c7b743c10602a55ed1b8236c14ae11438452 /Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
parentfafe498238e06fa7e87cdcc9b8f88aa2d6e311c9 (diff)
downloadserenity-eb50969781ab11d9253ae7c27600132c8fc19ad6.zip
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.
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode/Interpreter.cpp')
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Interpreter.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
index 428b0f3be6..b5756e173b 100644
--- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
@@ -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();
}