diff options
author | Andreas Kling <kling@serenityos.org> | 2021-10-24 15:34:30 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-24 17:18:07 +0200 |
commit | da9821200113dc1edd59ffb5531c573e963a2ae4 (patch) | |
tree | 63f866d9bec0b42cbcba3b39f3f8c302288d9e0c /Userland/Libraries/LibJS/Bytecode/Executable.h | |
parent | 13f04e37e5005b92ea51996eff7466d9498b5684 (diff) | |
download | serenity-da9821200113dc1edd59ffb5531c573e963a2ae4.zip |
LibJS: Add a separate "identifier table" to bytecode executables
This is a specialized string table for storing identifiers only.
Identifiers are always FlyStrings, which makes many common operations
faster by allowing O(1) comparison.
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode/Executable.h')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Executable.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Executable.h b/Userland/Libraries/LibJS/Bytecode/Executable.h index c861222d52..6f1c3f9939 100644 --- a/Userland/Libraries/LibJS/Bytecode/Executable.h +++ b/Userland/Libraries/LibJS/Bytecode/Executable.h @@ -9,6 +9,7 @@ #include <AK/FlyString.h> #include <AK/NonnullOwnPtrVector.h> #include <LibJS/Bytecode/BasicBlock.h> +#include <LibJS/Bytecode/IdentifierTable.h> #include <LibJS/Bytecode/StringTable.h> namespace JS::Bytecode { @@ -17,9 +18,11 @@ struct Executable { FlyString name; NonnullOwnPtrVector<BasicBlock> basic_blocks; NonnullOwnPtr<StringTable> string_table; + NonnullOwnPtr<IdentifierTable> identifier_table; size_t number_of_registers { 0 }; String const& get_string(StringTableIndex index) const { return string_table->get(index); } + FlyString const& get_identifier(IdentifierTableIndex index) const { return identifier_table->get(index); } void dump() const; }; |