1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibJS: Move well-known symbols to the VM

No need to instantiate unique symbols for each Interpreter; they can
be VM-global. This reduces the memory cost and startup time anyway.
This commit is contained in:
Andreas Kling 2020-09-22 16:18:51 +02:00
parent 676cb87a8f
commit d1b58ee9ad
20 changed files with 60 additions and 52 deletions

View file

@ -26,6 +26,7 @@
#pragma once
#include <AK/HashMap.h>
#include <AK/RefCounted.h>
#include <LibJS/Heap/Heap.h>
@ -63,6 +64,13 @@ public:
void gather_roots(HashTable<Cell*>&);
#define __JS_ENUMERATE(SymbolName, snake_name) \
Symbol* well_known_symbol_##snake_name() const { return m_well_known_symbol_##snake_name; }
JS_ENUMERATE_WELL_KNOWN_SYMBOLS
#undef __JS_ENUMERATE
Symbol* get_global_symbol(const String& description);
private:
VM();
@ -70,6 +78,13 @@ private:
Heap m_heap;
Vector<Interpreter*> m_interpreters;
HashMap<String, Symbol*> m_global_symbol_map;
#define __JS_ENUMERATE(SymbolName, snake_name) \
Symbol* m_well_known_symbol_##snake_name { nullptr };
JS_ENUMERATE_WELL_KNOWN_SYMBOLS
#undef __JS_ENUMERATE
};
}