1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:47:36 +00:00

LibJS: Rename VM::string_cache to deprecated_string_cache

And rename the member variable from m_string_cache to
m_deprecated_string_cache to match.
This commit is contained in:
Timothy Flynn 2023-01-13 09:41:24 -05:00 committed by Linus Groh
parent 3a004e8f1a
commit ca655f5e7d
3 changed files with 6 additions and 6 deletions

View file

@ -57,7 +57,7 @@ Heap::Heap(VM& vm)
Heap::~Heap() Heap::~Heap()
{ {
vm().string_cache().clear(); vm().deprecated_string_cache().clear();
collect_garbage(CollectionType::CollectEverything); collect_garbage(CollectionType::CollectEverything);
} }

View file

@ -38,7 +38,7 @@ PrimitiveString::PrimitiveString(Utf16String string)
PrimitiveString::~PrimitiveString() PrimitiveString::~PrimitiveString()
{ {
if (has_deprecated_string()) if (has_deprecated_string())
vm().string_cache().remove(*m_deprecated_string); vm().deprecated_string_cache().remove(*m_deprecated_string);
} }
void PrimitiveString::visit_edges(Cell::Visitor& visitor) void PrimitiveString::visit_edges(Cell::Visitor& visitor)
@ -139,7 +139,7 @@ NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, DeprecatedString s
return vm.single_ascii_character_string(ch); return vm.single_ascii_character_string(ch);
} }
auto& string_cache = vm.string_cache(); auto& string_cache = vm.deprecated_string_cache();
auto it = string_cache.find(string); auto it = string_cache.find(string);
if (it == string_cache.end()) { if (it == string_cache.end()) {
auto new_string = vm.heap().allocate_without_realm<PrimitiveString>(string); auto new_string = vm.heap().allocate_without_realm<PrimitiveString>(string);

View file

@ -73,9 +73,9 @@ public:
JS_ENUMERATE_WELL_KNOWN_SYMBOLS JS_ENUMERATE_WELL_KNOWN_SYMBOLS
#undef __JS_ENUMERATE #undef __JS_ENUMERATE
HashMap<DeprecatedString, PrimitiveString*>& string_cache() HashMap<DeprecatedString, PrimitiveString*>& deprecated_string_cache()
{ {
return m_string_cache; return m_deprecated_string_cache;
} }
PrimitiveString& empty_string() { return *m_empty_string; } PrimitiveString& empty_string() { return *m_empty_string; }
PrimitiveString& single_ascii_character_string(u8 character) PrimitiveString& single_ascii_character_string(u8 character)
@ -257,7 +257,7 @@ private:
void import_module_dynamically(ScriptOrModule referencing_script_or_module, ModuleRequest module_request, PromiseCapability const& promise_capability); void import_module_dynamically(ScriptOrModule referencing_script_or_module, ModuleRequest module_request, PromiseCapability const& promise_capability);
void finish_dynamic_import(ScriptOrModule referencing_script_or_module, ModuleRequest module_request, PromiseCapability const& promise_capability, Promise* inner_promise); void finish_dynamic_import(ScriptOrModule referencing_script_or_module, ModuleRequest module_request, PromiseCapability const& promise_capability, Promise* inner_promise);
HashMap<DeprecatedString, PrimitiveString*> m_string_cache; HashMap<DeprecatedString, PrimitiveString*> m_deprecated_string_cache;
Heap m_heap; Heap m_heap;
Vector<Interpreter*> m_interpreters; Vector<Interpreter*> m_interpreters;