1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:25:07 +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

@ -47,7 +47,7 @@ void SymbolConstructor::initialize(GlobalObject& global_object)
define_native_function("keyFor", key_for, 1, Attribute::Writable | Attribute::Configurable);
#define __JS_ENUMERATE(SymbolName, snake_name) \
define_property(#SymbolName, global_object.interpreter().well_known_symbol_##snake_name(), 0);
define_property(#SymbolName, global_object.vm().well_known_symbol_##snake_name(), 0);
JS_ENUMERATE_WELL_KNOWN_SYMBOLS
#undef __JS_ENUMERATE
}
@ -78,7 +78,7 @@ JS_DEFINE_NATIVE_FUNCTION(SymbolConstructor::for_)
description = interpreter.argument(0).to_string(interpreter);
}
return interpreter.get_global_symbol(description);
return global_object.vm().get_global_symbol(description);
}
JS_DEFINE_NATIVE_FUNCTION(SymbolConstructor::key_for)