summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Bytecode/Op.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-24 15:36:24 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-24 17:18:07 +0200
commit715e7fada8ed00a7680bb8f4ed65afd3026d3d59 (patch)
tree16128a8cac827905f38d2f20f2bf8589f9525a59 /Userland/Libraries/LibJS/Bytecode/Op.h
parentda9821200113dc1edd59ffb5531c573e963a2ae4 (diff)
downloadserenity-715e7fada8ed00a7680bb8f4ed65afd3026d3d59.zip
LibJS: Add the "fast non-local access" optimization to the bytecode VM
The GetVariable bytecode op now caches environment coordinates for fast cross-scope variable lookup.
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode/Op.h')
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Op.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h
index 697da20715..7043f6617c 100644
--- a/Userland/Libraries/LibJS/Bytecode/Op.h
+++ b/Userland/Libraries/LibJS/Bytecode/Op.h
@@ -16,6 +16,7 @@
#include <LibJS/Bytecode/StringTable.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Runtime/Environment.h>
+#include <LibJS/Runtime/EnvironmentCoordinate.h>
#include <LibJS/Runtime/Value.h>
namespace JS::Bytecode::Op {
@@ -310,6 +311,8 @@ public:
private:
IdentifierTableIndex m_identifier;
+
+ Optional<EnvironmentCoordinate> mutable m_cached_environment_coordinate;
};
class GetById final : public Instruction {