mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +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:
parent
9f6c5f68b6
commit
7b863330dc
45 changed files with 651 additions and 392 deletions
|
@ -154,8 +154,10 @@ TestRunnerGlobalObject::~TestRunnerGlobalObject()
|
|||
void TestRunnerGlobalObject::initialize()
|
||||
{
|
||||
JS::GlobalObject::initialize();
|
||||
define_property("global", this, JS::Attribute::Enumerable);
|
||||
define_native_function("isStrictMode", is_strict_mode);
|
||||
static FlyString global_property_name { "global" };
|
||||
static FlyString is_strict_mode_property_name { "isStrictMode" };
|
||||
define_property(global_property_name, this, JS::Attribute::Enumerable);
|
||||
define_native_function(is_strict_mode_property_name, is_strict_mode);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(TestRunnerGlobalObject::is_strict_mode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue