mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibJS: Cache commonly used FlyStrings in the VM
Roughly 7% of test-js runtime was spent creating FlyStrings from string literals. This patch frontloads that work and caches all the commonly used names in LibJS on a CommonPropertyNames struct that hangs off VM.
This commit is contained in:
@@ -33,15 +33,16 @@
|
||||
namespace JS {
|
||||
|
||||
ProxyConstructor::ProxyConstructor(GlobalObject& global_object)
|
||||
: NativeFunction("Proxy", *global_object.function_prototype())
|
||||
: NativeFunction(vm().names.Proxy, *global_object.function_prototype())
|
||||
{
|
||||
}
|
||||
|
||||
void ProxyConstructor::initialize(GlobalObject& global_object)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
define_property("prototype", global_object.proxy_prototype(), 0);
|
||||
define_property("length", Value(2), Attribute::Configurable);
|
||||
define_property(vm.names.prototype, global_object.proxy_prototype(), 0);
|
||||
define_property(vm.names.length, Value(2), Attribute::Configurable);
|
||||
}
|
||||
|
||||
ProxyConstructor::~ProxyConstructor()
|
||||
|
||||
Reference in New Issue
Block a user